Upload inference.py
Browse files- inference.py +5 -2
inference.py
CHANGED
|
@@ -176,8 +176,11 @@ class ModelInference:
|
|
| 176 |
tune=False
|
| 177 |
)
|
| 178 |
|
| 179 |
-
# Load fine-tuned checkpoint
|
| 180 |
-
checkpoint
|
|
|
|
|
|
|
|
|
|
| 181 |
self.model.load_state_dict(checkpoint['model'])
|
| 182 |
self.model.to(self.device)
|
| 183 |
self.model.eval()
|
|
|
|
| 176 |
tune=False
|
| 177 |
)
|
| 178 |
|
| 179 |
+
# Load fine-tuned checkpoint. torch 2.6+ flips weights_only to True;
|
| 180 |
+
# this trusted checkpoint pickles a numpy scalar, keep the full load.
|
| 181 |
+
checkpoint = torch.load(
|
| 182 |
+
str(self.model_path), map_location=self.device, weights_only=False
|
| 183 |
+
)
|
| 184 |
self.model.load_state_dict(checkpoint['model'])
|
| 185 |
self.model.to(self.device)
|
| 186 |
self.model.eval()
|