TypeError: can't pickle weakref objects Standalone code to reproduce the issue import tensorflow as tf import pickle output_file=open('save.dat','wb')pickle.dump(tf.keras.optimizers.Adam(),output_file) Relevant log output No response @NoteDancing Could you please refer to the similarissue_1&...
>>> import dill >>> import weakref >>> dill.loads(dill.dumps(weakref.WeakKeyDictionary()))>>> dill.loads(dill.dumps(weakref.WeakValueDictionary()))>>> class _class: ... def _method(self): ... pass ... >>> _instance = _class() >>> dill.loads(dill.dumps(weakref.ref(_instance...
(obj) TypeError: can't pickle weakref objects Traceback (most recent call last): File "<string>", line 1, in <module> File "D:\ProgramData\Anaconda3\lib\multiprocessing\spawn.py", line 105, in spawn_main exitcode = _main(fd) File "D:\ProgramData\Anaconda3\lib\multiprocessing\spawn....
I haven't found a fix yet, though AlexFuster commented Dec 4, 2019 Hey guys, came out with a solution. It's ugly but it seems to work. I hope it helps By the way, I'm using dill because pickle does not serialize weakref objects. import tensorflow as tf import dill import threadi...
JyNIgate is kind of a bridge between CPython and JyNI. JyNI contains lots of code that comes from CPython, but it is too different from CPython to be maintained as a fork. JyNIgate is a fork of CPython that contains some JyNI-specific changes (note that