Pass weights_only=False to torch.load for PyTorch 2.6+ compatibility#361
Open
netlinux-ai wants to merge 1 commit into
Open
Pass weights_only=False to torch.load for PyTorch 2.6+ compatibility#361netlinux-ai wants to merge 1 commit into
netlinux-ai wants to merge 1 commit into
Conversation
PyTorch 2.6 flipped the default value of `weights_only` to `True`, which rejects the pickled-object format used in the published ASR / JDC / PLBERT sub-module checkpoints and the LibriTTS pretrained model. Without this change, train_finetune*.py cannot load any of them under modern torch. These checkpoints are the project's own published artefacts, so loading them with weights_only=False is the correct (and trusted) call.
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.
Problem
In PyTorch 2.6, the default value of
weights_onlyintorch.loadwas changed fromFalsetoTrue. The published StyleTTS2 sub-module checkpoints (ASR, JDC, PLBERT) and the LibriTTS pretrained model contain pickled Python objects that the new safe loader rejects, so loading any of them under PyTorch ≥ 2.6 fails with:This blocks
train_finetune.py,train_finetune_accelerate.py, the ASR/JDC/PLBERT loaders, and theload_checkpointhelper.Reproducer (any of the published artefacts triggers it):
Fix
Pass
weights_only=Falseexplicitly at everytorch.loadcall site that loads these checkpoints. They come from a trusted source (the repo's own pretrained artefacts), so the new safety guard is a false positive here.Five call sites total — three in
models.py, one inUtils/PLBERT/util.py. (train_*.pyfiles load via these helpers, so no further changes are needed there.)Tested with