You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can't serialise optimisers with dill because of the recorder
How to Reproduce
>>> opt = ScipyOptimizer("Powell", options={"maxiter":1})
>>> dill.dumps(opt)
Traceback (most recent call last):
File "<stdin>", line 1, in<module>
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 263, in dumps
dump(obj, file, protocol, byref, fmode, recurse, **kwds)#, strictio)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 235, in dump
Pickler(file, protocol, **_kwds).dump(obj)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 394, in dump
StockPickler.dump(self, obj)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 487, in dump
self.save(obj)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 388, in save
StockPickler.save(self, obj, save_persistent_id)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 603, in save
self.save_reduce(obj=obj, *rv)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 717, in save_reduce
save(state)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 388, in save
StockPickler.save(self, obj, save_persistent_id)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 560, in save
f(self, obj) # Call unbound method with explicit self
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 1186, in save_module_dict
StockPickler.save_dict(pickler, obj)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 971, in save_dict
self._batch_setitems(obj.items())
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 997, in _batch_setitems
save(v)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 388, in save
StockPickler.save(self, obj, save_persistent_id)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 560, in save
f(self, obj) # Call unbound method with explicit self
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 1824, in save_function
_save_with_postproc(pickler, (_create_function, (
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 1084, in _save_with_postproc
pickler._batch_setitems(iter(source.items()))
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 997, in _batch_setitems
save(v)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 388, in save
StockPickler.save(self, obj, save_persistent_id)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 560, in save
f(self, obj) # Call unbound method with explicit self
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 1698, in save_type
_save_with_postproc(pickler, (_create_type, (
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 1084, in _save_with_postproc
pickler._batch_setitems(iter(source.items()))
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 997, in _batch_setitems
save(v)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 388, in save
StockPickler.save(self, obj, save_persistent_id)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 560, in save
f(self, obj) # Call unbound method with explicit self
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 1698, in save_type
_save_with_postproc(pickler, (_create_type, (
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 1084, in _save_with_postproc
pickler._batch_setitems(iter(source.items()))
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 997, in _batch_setitems
save(v)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 388, in save
StockPickler.save(self, obj, save_persistent_id)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 560, in save
f(self, obj) # Call unbound method with explicit self
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 1824, in save_function
_save_with_postproc(pickler, (_create_function, (
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 1084, in _save_with_postproc
pickler._batch_setitems(iter(source.items()))
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 997, in _batch_setitems
save(v)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 388, in save
StockPickler.save(self, obj, save_persistent_id)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 560, in save
f(self, obj) # Call unbound method with explicit self
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 1824, in save_function
_save_with_postproc(pickler, (_create_function, (
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 1084, in _save_with_postproc
pickler._batch_setitems(iter(source.items()))
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 997, in _batch_setitems
save(v)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 388, in save
StockPickler.save(self, obj, save_persistent_id)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 560, in save
f(self, obj) # Call unbound method with explicit self
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 1698, in save_type
_save_with_postproc(pickler, (_create_type, (
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 1070, in _save_with_postproc
pickler.save_reduce(*reduction, obj=obj)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 692, in save_reduce
save(args)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 388, in save
StockPickler.save(self, obj, save_persistent_id)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 560, in save
f(self, obj) # Call unbound method with explicit self
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 901, in save_tuple
save(element)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 388, in save
StockPickler.save(self, obj, save_persistent_id)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 560, in save
f(self, obj) # Call unbound method with explicit self
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 1186, in save_module_dict
StockPickler.save_dict(pickler, obj)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 971, in save_dict
self._batch_setitems(obj.items())
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 997, in _batch_setitems
save(v)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/site-packages/dill/_dill.py", line 388, in save
StockPickler.save(self, obj, save_persistent_id)
File "/Users/vladimir/micromamba/envs/zapata/lib/python3.8/pickle.py", line 578, in save
rv = reduce(self.proto)
TypeError: cannot pickle '_abc_data' object
>>> opt.recorder = None
>>> dill.dumps(opt)
b'\x80\x04\x95\xb1\x00\x00\x00\x00\x00\x00\x00\x8c(orquestra.opt.optimizers.scipy_optimizer\x94\x8c\x0eScipyOptimizer\x94\x93\x94)\x81\x94}\x94(\x8c\x08recorder\x94N\x8c\x06method\x94\x8c\x06Powell\x94\x8c\x07options\x94}\x94\x8c\x07maxiter\x94K\x01s\x8c\x0bconstraints\x94]\x94\x8c\x06bounds\x94N\x8c\x15store_best_parameters\x94\x88ub.'
>>>
Expected behavior
It really seems as though the recorder cannot be serialised with dill:
Describe the bug
Can't serialise optimisers with dill because of the recorder
How to Reproduce
Expected behavior
It really seems as though the recorder cannot be serialised with dill:
fails
Actual behavior
See above
Environment (please complete the following information):**
Additional context
See https://github.com/zapatacomputing/orquestra-qml-core/issues/430
The text was updated successfully, but these errors were encountered: