I try to save model and then load it. Is there any update in new torch version? or should I modify your main.py file?
in previous torch version is work without problem.
I also test these solutions :
model = torch.load('pyEDA/pyEDA/checkpoint.t7', weights_only=False)
or
model.load_state_dict(torch.load("autoencoder_weights.pth"))
(1) In PyTorch 2.6, we changed the default value of the weights_only argument in torch.load from False to True. Re-running torch.load with weights_only set to False will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.
(2) Alternatively, to load with weights_only=True please check the recommended steps in the following error message.
WeightsUnpickler error: Unsupported global: GLOBAL pyEDA.pyEDA.autoencoder.AE was not an allowed global by default. Please use torch.serialization.add_safe_globals([AE]) or the torch.serialization.safe_globals([AE]) context manager to allowlist this global if you trust this class/function.
I try to save model and then load it. Is there any update in new torch version? or should I modify your main.py file?
in previous torch version is work without problem.
I also test these solutions :
model = torch.load('pyEDA/pyEDA/checkpoint.t7', weights_only=False)
or
model.load_state_dict(torch.load("autoencoder_weights.pth"))
(1) In PyTorch 2.6, we changed the default value of the
weights_onlyargument intorch.loadfromFalsetoTrue. Re-runningtorch.loadwithweights_onlyset toFalsewill likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.(2) Alternatively, to load with
weights_only=Trueplease check the recommended steps in the following error message.WeightsUnpickler error: Unsupported global: GLOBAL pyEDA.pyEDA.autoencoder.AE was not an allowed global by default. Please use
torch.serialization.add_safe_globals([AE])or thetorch.serialization.safe_globals([AE])context manager to allowlist this global if you trust this class/function.