Spaces:
Runtime error
Runtime error
loads weights to cpu if cuda not available
Browse files
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
|