Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0e970cc

Browse files
fix: pass weights_only=True to torch.load (#203)
1 parent 02ed72b commit 0e970cc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎tests/data/pytorch_mnist/mnist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def model_fn(model_dir):
169169
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
170170
model = torch.nn.DataParallel(Net())
171171
with open(os.path.join(model_dir, 'model.pth'), 'rb') as f:
172-
model.load_state_dict(torch.load(f))
172+
model.load_state_dict(torch.load(f, weights_only=True))
173173
return model.to(device)
174174

175175

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /