Subject: Bug: torch.load with weights_only=True (PyTorch 2.6 default) fails on checkpoints containing easydict.EasyDict — SETITEMS error
Bug Report
Environment
- PyTorch version: 2.6+
- Platform: Google Colab (CUDA)
- Model: DiffFuSR (SR + Fusion network)
Description
Since PyTorch 2.6 changed the default of weights_only from False to True in torch.load, loading checkpoints that contain easydict.EasyDict objects now raises an UnpicklingError. This affects any model checkpoint saved with EasyDict in its state dict or config.
Steps to Reproduce
import torch
from pathlib import Path
# Any checkpoint that was saved with easydict.EasyDict in its state
checkpoint = torch.load('model.ckpt', map_location='cpu') # weights_only=True by default in 2.6
Error Message
torch.serialization.UnpicklingError: Weights only load failed.
WeightsUnpickler error: Can only SETITEMS for dict, collections.OrderedDict,
collections.Counter, but got <class 'easydict.EasyDict'>
Adding easydict.EasyDict via torch.serialization.add_safe_globals([easydict.EasyDict]) does not resolve the issue — the SETITEMS restriction is a separate, deeper limitation in the weights-only unpickler.
Subject: Bug:
torch.loadwithweights_only=True(PyTorch 2.6 default) fails on checkpoints containingeasydict.EasyDict— SETITEMS errorBug Report
Environment
Description
Since PyTorch 2.6 changed the default of
weights_onlyfromFalsetoTrueintorch.load, loading checkpoints that containeasydict.EasyDictobjects now raises anUnpicklingError. This affects any model checkpoint saved with EasyDict in its state dict or config.Steps to Reproduce
Error Message
Adding
easydict.EasyDictviatorch.serialization.add_safe_globals([easydict.EasyDict])does not resolve the issue — the SETITEMS restriction is a separate, deeper limitation in the weights-only unpickler.