Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
Open
Description
Bug report
Related:huggingface/transformers#8978
importcollectionsimportcopyimportdataclasses@dataclasses.dataclassclassModelOutputDictBase(dict):a:intb:int=2# workscopy.deepcopy(ModelOutputDictBase(a=1,b=2, ))@dataclasses.dataclassclassModelOutputAllDefaults(collections.OrderedDict):a:int=1b:int=2# workscopy.deepcopy(ModelOutputAllDefaults(a=1,b=2, ))@dataclasses.dataclassclassModelOutput(collections.OrderedDict):a:intb:int=2# failscopy.deepcopy(ModelOutput(a=1,b=2, ))
---------------------------------------------------------------------------TypeError Traceback (most recent call last)Cell In[4], line 3935 a:int36 b:int=2---> 39 copy.deepcopy(40 ModelOutput(41 a=1,42 b=2,43 )44 )File [...lib/python3.8/copy.py:172), in deepcopy(x, memo, _nil)170 y= x171else:--> 172 y = _reconstruct(x, memo, *rv)174# If is its own copy, don't memoize.175if yisnot x:File [.../lib/python3.8/copy.py:264), in _reconstruct(x, memo, func, args, state, listiter, dictiter, deepcopy)262if deepand args:263 args= (deepcopy(arg, memo)for argin args)--> 264 y = func(*args)265if deep:266 memo[id(x)]= yTypeError:__init__() missing 1 required positional argument: 'a'
Your environment
- CPython versions tested on: Python 3.8.16 (default, Jan 17 2023, 23:13:24) [GCC 11.2.0] :: Anaconda, Inc. on linux
- Operating system and architecture: Ubuntu 20.04.6 LTS x86_64