Skip to content

Clarify when to use TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD#15353

Merged
chtruong814 merged 2 commits intomainfrom
chtruong/torch-weights-msg
Feb 5, 2026
Merged

Clarify when to use TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD#15353
chtruong814 merged 2 commits intomainfrom
chtruong/torch-weights-msg

Conversation

@chtruong814
Copy link
Collaborator

What does this PR do ?

Clarify when to use TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD

Collection: [Note which collection this PR will affect]

Changelog

  • Add specific line by line info of high level changes in this PR.

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this 

GitHub 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:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

PR Type:

  • New Feature
  • Bugfix
  • Documentation

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

  • Related to # (issue)

Signed-off-by: Charlie Truong <chtruong@nvidia.com>
- 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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, we should have an FAQ section maybe..

Signed-off-by: Charlie Truong <chtruong@nvidia.com>
@chtruong814 chtruong814 merged commit 5dd1dcb into main Feb 5, 2026
39 checks passed
@chtruong814 chtruong814 deleted the chtruong/torch-weights-msg branch February 5, 2026 13:36
@chtruong814 chtruong814 added the r2.6.0 Cherry-pick label for the r2.6.0 release branch label 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 chtruong814 added r2.7.0 Cherry-pick to r2.7.0 release branch and removed r2.6.0 Cherry-pick label for the r2.6.0 release branch labels 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



* Add link to Pytorch 2.6 update



---------

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



* Add link to Pytorch 2.6 update



---------

Signed-off-by: Charlie Truong <chtruong@nvidia.com>
Signed-off-by: NeMo Bot <nemo-bot@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

r2.7.0 Cherry-pick to r2.7.0 release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants