Upload inference.py
Browse files- inference.py +3 -1
inference.py
CHANGED
|
@@ -113,7 +113,9 @@ class DeepFauneModel(nn.Module):
|
|
| 113 |
raise FileNotFoundError(f"Model file not found: {self.model_path}")
|
| 114 |
|
| 115 |
try:
|
| 116 |
-
|
|
|
|
|
|
|
| 117 |
args = params['args']
|
| 118 |
|
| 119 |
# Validate number of classes matches
|
|
|
|
| 113 |
raise FileNotFoundError(f"Model file not found: {self.model_path}")
|
| 114 |
|
| 115 |
try:
|
| 116 |
+
# torch 2.6+ flips weights_only to True; this trusted checkpoint
|
| 117 |
+
# pickles a torchvision Compose, so keep the old full load.
|
| 118 |
+
params = torch.load(self.model_path, map_location=device, weights_only=False)
|
| 119 |
args = params['args']
|
| 120 |
|
| 121 |
# Validate number of classes matches
|