Open arvoelke opened 7 years ago
This happened because the __setstate__
and __getstate__
defined by FrozenObject
for serializing/deserializing the object are no compatible with the object.
Also see #109.
This is getting complicated. So far this supports nengo versions 2.1 through 2.6. However, parameters have a different interface between these two versions (validate
versus coerce
). I need to make my own parameter in order to for each instance to become a serializable FrozenObject
, but can't readily do so in a way that is compatible across nengo version.
Is the goal to be able to serialize something with Nengo 2.1 and deserialize with 2.6? Or serialize/deserialize within the same version? If within the same version, you can use a different parameter implementations depending on the Nengo version.
The goal is within the same version. And yep you are right. Half of it is that I'm being lazy and would like the solution to require as little maintenance/work as possible. No worries.
Due to the (intentionally) omitted super call in
LinearSystem
, objects don't contain the_paramdict
field set by Nengo'sFrozenObject
base class. Normally this doesn't cause any issues, but it did for @psipeter when using this in conjunction with the multiprocessing module.A hacky workaround is to manually set
sys._paramdict = {}
on the object before using it. A better fix is to set it at the class level inNengoLinearFilterMixin
alongside where I setseed
anddefault_dt
, but investigation is needed to see if we can do all of this properly in a way that is less likely to break down the road (e.g., actually making the super call).