tgieruc commited on
Commit
6d84c7f
1 Parent(s): 1f87905

loads weights to cpu if cuda not available

Browse files
Files changed (1) hide show
  1. model.py +1 -1
model.py CHANGED
@@ -15,7 +15,7 @@ class SegmentationModel:
15
  path: The path to the model file.
16
  device: The device to run the model on.
17
  """
18
- self.model = torch.load(path)
19
  self.model.to(device)
20
  self.model.eval()
21
  self.device = device
 
15
  path: The path to the model file.
16
  device: The device to run the model on.
17
  """
18
+ self.model = torch.load(path, map_location=device)
19
  self.model.to(device)
20
  self.model.eval()
21
  self.device = device