Clarify when to use TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD#15353
Merged
chtruong814 merged 2 commits intomainfrom Feb 5, 2026
Merged
Conversation
Signed-off-by: Charlie Truong <chtruong@nvidia.com>
XuesongYang
reviewed
Feb 4, 2026
| - NVIDIA GPU (if you intend to do model training) | ||
|
|
||
| As of Pytorch 2.6, `torch.load` defaults to using `weights_only=True`. Some model checkpoints may require using `weights_only=False`. In this case, you can set the env var `TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD=1` before running code that uses `torch.load`. However, this should only be done with trusted files. Loading files from untrusted sources with more than weights only can have the risk of arbitrary code execution. | ||
|
|
Collaborator
There was a problem hiding this comment.
LGTM. We could also link https://docs.pytorch.org/docs/stable/notes/serialization.html#torch-load-with-weights-only-true for reference
Collaborator
There was a problem hiding this comment.
Looks good, we should have an FAQ section maybe..
Signed-off-by: Charlie Truong <chtruong@nvidia.com>
pzelasko
approved these changes
Feb 5, 2026
chtruong814
added a commit
that referenced
this pull request
Feb 5, 2026
* Clarify when to use TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD Signed-off-by: Charlie Truong <chtruong@nvidia.com> * Add link to Pytorch 2.6 update Signed-off-by: Charlie Truong <chtruong@nvidia.com> --------- Signed-off-by: Charlie Truong <chtruong@nvidia.com> Signed-off-by: NeMo Bot <nemo-bot@nvidia.com>
chtruong814
added a commit
that referenced
this pull request
Feb 5, 2026
* Clarify when to use TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD Signed-off-by: Charlie Truong <chtruong@nvidia.com> * Add link to Pytorch 2.6 update Signed-off-by: Charlie Truong <chtruong@nvidia.com> --------- Signed-off-by: Charlie Truong <chtruong@nvidia.com> Signed-off-by: NeMo Bot <nemo-bot@nvidia.com>
chtruong814
added a commit
that referenced
this pull request
Feb 5, 2026
chtruong814
added a commit
that referenced
this pull request
Feb 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do ?
Clarify when to use TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD
Collection: [Note which collection this PR will affect]
Changelog
Usage
# Add a code snippet demonstrating how to use thisGitHub Actions CI
The Jenkins CI system has been replaced by GitHub Actions self-hosted runners.
The GitHub Actions CI will run automatically when the "Run CICD" label is added to the PR.
To re-run CI remove and add the label again.
To run CI on an untrusted fork, a NeMo user with write access must first click "Approve and run".
Before your PR is "Ready for review"
Pre checks:
PR Type:
If you haven't finished some of the above items you can still open "Draft" PR.
Who can review?
Anyone in the community is free to review the PR once the checks have passed.
Contributor guidelines contains specific people who can review PRs to various areas.
Additional Information