Skip to content

Commit

Permalink
Avoid warning in utils.download_file_from_hf (#739)
Browse files Browse the repository at this point in the history
Add `weights_only=False` argument to `torch.load`.
Starting in `torch=2.4.1`, `torch.load` prints a warning when the
`weights_only` argument is not given.
  • Loading branch information
albertsgarde authored Oct 4, 2024
1 parent ef1295a commit 64d0e5f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion transformer_lens/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def download_file_from_hf(
)

if file_path.endswith(".pth") or force_is_torch:
return torch.load(file_path, map_location="cpu")
return torch.load(file_path, map_location="cpu", weights_only=False)
elif file_path.endswith(".json"):
return json.load(open(file_path, "r"))
else:
Expand Down

0 comments on commit 64d0e5f

Please sign in to comment.