Add weights_only=True in torch.load
FutureWarning: You are using torch.load with weights_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 for weights_only will be flipped to True. 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 via torch.serialization.add_safe_globals. We recommend you start setting weights_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.
I didnt check which case should not use weights_only=True. I just add it in all of the torch.load. Hope it will help.
I didnt check which case should not use weights_only=True. I just add it in all of the torch.load. Hope it will help.
@terry-for-github, thanks for making DeepSpeed more secure.
Is this OK? I haven't use pre-commit tools brefore. I do it by myself lol.
Is this OK? I haven't use pre-commit tools brefore. I do it by myself lol.
Yes @terry-for-github thanks, the formatting checks appear to be passing, though other checks are not now.
I found that not all of the torch.load are compatible with weights_only=True. Some of them should be set to weights_only=False explicitly instead.
I found that not all of the
torch.loadare compatible withweights_only=True. Some of them should be set toweights_only=Falseexplicitly instead.
Agreed, we've fixed most of the unrelated CI issues, would you be interested in continuing this PR?
I found that not all of the
torch.loadare compatible withweights_only=True. Some of them should be set toweights_only=Falseexplicitly instead.Agreed, we've fixed most of the unrelated CI issues, would you be interested in continuing this PR?
Hi @terry-for-github - no worries if you aren't, but I'll make a PR as well to fix these warnings.
Closing in favor of #6751