8000 Add explicit weights_only=False for checkpoint loading by ftshijt · Pull Request #6035 · espnet/espnet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add explicit weights_only=False for checkpoint loading #6035

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 5, 2025

Conversation

ftshijt
Copy link
Collaborator
@ftshijt ftshijt commented Feb 5, 2025

Why?

Starting from torch2.6, the default value of torch.load has been flipped to True. However, our checkpoint setup is not in that option. It would be good to explicitly set the weights_only=False in the checkpoint loading.

See also

Error msg when using torch2.6 with resuming.

FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details).

In a future release, the default value for weights_only will be flipped to True. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.

More info at pytorch.org https://dev-discuss.pytorch.org/t/bc-breaking-change-torch-load-is-being-flipped-to-use-weights-only-true-by-default-in-the-nightlies-after-137602/2573

Copy link
codecov bot commented Feb 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 57.35%. Comparing base (913d2cd) to head (b43997d).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6035   +/-   ##
=======================================
  Coverage   57.35%   57.35%           
=======================================
  Files         863      863           
  Lines       80824    80824           
=======================================
+ Hits        46356    46360    +4     
+ Misses      34468    34464    -4     
Flag Coverage Δ
test_integration_espnet2 47.45% <ø> (+<0.01%) ⬆️
test_integration_espnetez 38.19% <ø> (ø)
test_python_espnet2 50.56% <ø> (ø)
test_utils 20.64% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sw005320 sw005320 added this to the v.202503 milestone Feb 5, 2025
@sw005320
Copy link
Contributor
sw005320 commented Feb 5, 2025

Thanks, @ftshijt!

@sw005320 sw005320 merged commit b57dd04 into master Feb 5, 2025
40 checks passed
@sw005320 sw005320 deleted the ftshijt-patch-1 branch February 5, 2025 12:19
Shikhar-S pushed a commit to Shikhar-S/espnet that referenced this pull request Mar 13, 2025
Add explicit weights_only=False for checkpoint loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0