Addax-Data-Science commited on
Commit
cdf3149
·
verified ·
1 Parent(s): b3aa36a

Upload inference.py

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