FutureWarning with `torch.load` in `PostHocEMA` Example
HiDolen opened this issue · 3 comments
First, thank you for creating such a clear and excellent project. I have learned a lot from your code.
I encountered a FutureWarning when using the PostHocEMA
example code in the README.md:
ema_pytorch\post_hoc_ema.py:388: 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.
My PyTorch version is 2.4.0. I wanted to bring this to your attention and see if there's a recommended way to handle this warning in the project.
if you want to remove the warning, you can just set to weights_only=False
if you want to remove the warning, you can just set to weights_only=False
I think It should be adding weights_only=True
. I just submitted a PR and hope the maintainer can see it.
if you want to remove the warning, you can just set to weights_only=False
I think It should be adding
weights_only=True
. I just submitted a PR and hope the maintainer can see it.
well if it works, yeah that would be optimal