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
As first reported by @ashley-stock, trying to save a Pipeline object which includes FieldFactory classes defined within the running notebook leads to error. A minimal version of such error can be seen below:
importimagineasimgimportimagine_datasetsasimg_dataoriginal_bregLSA=img.fields.hamx.BregLSAFactory()
classLocalBregLSAFactory(img.fields.FieldFactory):
"""This is fully equivalent to BregLSAFactory!"""FIELD_CLASS=original_bregLSA.field_classDEFAULT_PARAMETERS=original_bregLSA.default_parametersPRIORS=original_bregLSA.priorsfactory_list= [LocalBregLSAFactory()]
measurement=img.observables.Measurements(img_data.HEALPix.fd.Oppermann2012(Nside=2))
simulator=img.simulators.Hammurabi(measurement)
likelihood=img.likelihoods.EnsembleLikelihood(measurement)
pipeline=img.pipelines.MultinestPipeline(simulator=simulator,
likelihood=likelihood,
factory_list=factory_list)
pipeline.save()
this leads to
TypeError: can't pickle _abc_data objects
Interestingly, if one replaces LocalBregLSAFactory() by original_bregLSA, everything works normally.
The error is actually a problem with dill and the way it serializes objects defined in __main__. We can get the same error by simply doing (using the same definitions as above):
As first reported by @ashley-stock, trying to save a
Pipeline
object which includesFieldFactory
classes defined within the running notebook leads to error. A minimal version of such error can be seen below:this leads to
TypeError: can't pickle _abc_data objects
Interestingly, if one replaces
LocalBregLSAFactory()
byoriginal_bregLSA
, everything works normally.The error is actually a problem with
dill
and the way it serializes objects defined in__main__
. We can get the same error by simply doing (using the same definitions as above):Issue uqfoundation/dill#332 is related to this.
The text was updated successfully, but these errors were encountered: