aagoluoglu commited on
Commit
9170044
·
verified ·
1 Parent(s): bfbd76a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
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
- model.load_state_dict(torch.load(str(dir / "checkpoint.pth")))
 
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"