Addax-Data-Science commited on
Commit
6ee6f49
·
verified ·
1 Parent(s): 2ffa910

Upload inference.py

Browse files
Files changed (1) hide show
  1. 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
- params = torch.load(self.model_path, map_location=device)
 
 
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