-
Notifications
You must be signed in to change notification settings - Fork 896
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
FutureWarning: You are using torch.load
with weights_only=False
#1429
Comments
The error can be suppressed by using the following before calling stanza functions but is not a solution import warnings |
Aware of it. There's a limitation where we are saving plenty of things
other than weights in the current file. Config strings and numbers,
mostly. Would those still work?
…On Tue, Oct 22, 2024, 10:19 PM mskaif ***@***.***> wrote:
The error can be suppressed by using the following before calling stanza
functions but is not a solution
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
source: ultralytics/ultralytics#14994 (comment)
<ultralytics/ultralytics#14994 (comment)>
—
Reply to this email directly, view it on GitHub
<#1429 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA2AYWPIB3WEPPBSGN337ALZ44WXBAVCNFSM6AAAAABQN6FUXGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMZQHEZTAMBQGY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
…re in the save files, use weights_only=True. Significantly cuts down on the number of torch warnings. #1429
…re in the save files, use weights_only=True. Significantly cuts down on the number of torch warnings. #1429
Some of the models can be updated to use |
…re in the save files, use weights_only=True. Significantly cuts down on the number of torch warnings. #1429
…re in the save files, use weights_only=True. Significantly cuts down on the number of torch warnings. #1429
sorry for not getting back earlier. I'm using the built-in models like so: affected from the pipeline are: Thank you for the commit! |
…re in the save files, use weights_only=True. Significantly cuts down on the number of torch warnings. #1429
…re in the save files, use weights_only=True. Significantly cuts down on the number of torch warnings. #1429
…re in the save files, use weights_only=True. Significantly cuts down on the number of torch warnings. #1429
…re in the save files, use weights_only=True. Significantly cuts down on the number of torch warnings. #1429
Please, be aware that on pytorch 2.6 this warning will become an error. That got reported to pytorch as: I posted more details in pytorch/pytorch#142123 (comment), but shortly huggingface/transformers#34632 PR on pytorch side has flipped the default of You can consider to add explicit list of allowed safe globals following similar approach which was done in Huggingface Transformers and Accelerate. For the reference, see: |
I am finishing up some model training and will be able to make a new release with the updated models soon. |
@AngledLuffa : note that at the moment the failure reported in pytorch/pytorch#142123 is not fixed in the latest stanza from main branch (I tried 539760c - see log below). The repro is with:
The #1430 previously merged in stanza is not enough to handle this case. The failure happens on this stanza/stanza/models/common/pretrain.py Line 56 in 539760c
Full log:
|
Got it, but that's the main branch. The updates merged in are in the dev branch, which at that line has stanza/stanza/models/common/pretrain.py Line 60 in 5754ec0
|
Ah, sorry. I missed that. |
This should now be pushed in v1.10.0 |
Describe the bug
FutureWarning: You are using
torch.load
withweights_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 forweights_only
will be flipped toTrue
. 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 viatorch.serialization.add_safe_globals
. We recommend you start settingweights_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.state = torch.load(filename, lambda storage, loc: storage)
This warning is triggered by all torch.load used in stanza. The issue does not cause any problem with data processing at the moment but the long warnings are distracting.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
no error
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: