Skip to content

Commit

Permalink
Fix 2 incorrect argument positioning in Tutorial (#3042)
Browse files Browse the repository at this point in the history
1. "weights_only" is augument of torch.load, not for model.load_state_dict

Here is the doc:
https://pytorch.org/docs/stable/generated/torch.load.html

Co-authored-by: Svetlana Karslioglu <[email protected]>
  • Loading branch information
davychxn and svekars authored Sep 9, 2024
1 parent 7377530 commit 129e318
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion beginner_source/saving_loading_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@
# .. code:: python
#
# modelB = TheModelBClass(*args, **kwargs)
# modelB.load_state_dict(torch.load(PATH), strict=False, weights_only=True)
# modelB.load_state_dict(torch.load(PATH, weights_only=True), strict=False)
#
# Partially loading a model or loading a partial model are common
# scenarios when transfer learning or training a new complex model.
Expand Down

0 comments on commit 129e318

Please sign in to comment.