Skip to content

Commit 36988bb

Browse files
Remove dangling comma from save/load example (#3593)
The tutorial currently loads a tuple of shape `(1,)` into `model`, which appears to be a typo: ```python model = torch.load('model.pth', weights_only=False), ``` This PR removes the comma so that `model` is actually a `Module`. Co-authored-by: Svetlana Karslioglu <[email protected]>
1 parent 8e3c260 commit 36988bb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

beginner_source/basics/saveloadrun_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
# below we use ``weights_only=False`` because this involves loading the
6363
# model, which is a legacy use case for ``torch.save``.
6464

65-
model = torch.load('model.pth', weights_only=False),
65+
model = torch.load('model.pth', weights_only=False)
6666

6767
########################
6868
# .. note:: This approach uses Python `pickle <https://docs.python.org/3/library/pickle.html>`_ module when serializing the model, thus it relies on the actual class definition to be available when loading the model.

0 commit comments

Comments
 (0)