Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -67,8 +67,9 @@ def server(input: Inputs, output: Outputs, session: Session):
|
|
67 |
|
68 |
# Create an instance of the model architecture with the loaded configuration
|
69 |
model = SamModel(config=model_config)
|
70 |
-
# Update the model by loading the weights from saved file
|
71 |
-
|
|
|
72 |
|
73 |
# set the device to cuda if available, otherwise use cpu
|
74 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
67 |
|
68 |
# Create an instance of the model architecture with the loaded configuration
|
69 |
model = SamModel(config=model_config)
|
70 |
+
# Update the model by loading the weights from saved file
|
71 |
+
model_state_dict = torch.load(str(dir / "checkpoint.pth"), map_location=torch.device('cpu'))
|
72 |
+
model.load_state_dict(model_state_dict)
|
73 |
|
74 |
# set the device to cuda if available, otherwise use cpu
|
75 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|