Skip to content

Commit

Permalink
fix: load model with explicit weights_only=False
Browse files Browse the repository at this point in the history
Torch 2.4.0 shows a FutureWarning about the default value of this arg changing if it's not set explicitly.
  • Loading branch information
gmertes committed Aug 16, 2024
1 parent 712aad2 commit 48f21cd
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/anemoi/inference/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,7 @@ def run(

with Timer(f"Loading {self.checkpoint}"):
try:
model = torch.load(
self.checkpoint.path,
map_location=device,
).to(device)
model = torch.load(self.checkpoint.path, map_location=device, weights_only=False).to(device)
except Exception:
self.checkpoint.report_loading_error()
raise
Expand Down

0 comments on commit 48f21cd

Please sign in to comment.