Skip to content

Commit 5dd1dcb

Browse files
authored
Clarify when to use TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD (#15353)
* 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>
1 parent 2fbcfe2 commit 5dd1dcb

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ multi-GPU/multi-node training.
289289
- Pytorch 2.6 or above
290290
- NVIDIA GPU (if you intend to do model training)
291291

292+
As of [Pytorch 2.6](https://docs.pytorch.org/docs/stable/notes/serialization.html#torch-load-with-weights-only-true), `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.
293+
292294
## Developer Documentation
293295

294296
| Version | Status | Description |

0 commit comments

Comments
 (0)