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
I had to do something similar to the pm.Model object, which also has member _repr_latex_. Note that functools.partial is used in other modules as well.
A possible alternative could be to explicitly define attribute __name__ to the functools.partial object (see elastic/apm-agent-python#293). But I didn't try that since it'd require changing PyMC's source code.
The workaround above made it possible to dill.dump the object, but I'm getting an error when dill.load the file:
AttributeError: 'TensorVariable' object has no attribute 'str_for_dist'
Description of your problem
After upgrading from PyMC3 to PyMC (4.2.0), I can't use
dill
to pickle an object that has apm.Model
member.Error:
After debugging, I realized this seems to be caused by member
_repr_latex_
of classDistribution
(https://www.pymc.io/projects/docs/en/latest/_modules/pymc/distributions/distribution.html).Please provide a minimal, self-contained, and reproducible example.
I'm pickling the object that contains a
pm.Model
member as follows:Please provide the full traceback.
Several levels down
dill.dump
until it reaches afunctools.partial
object that can't be pickled.Please provide any additional information below.
The (ugly) workaround for me was to overwrite member
_repr_latex_
with alambda
function instead. Example:Or more generally:
I had to do something similar to the
pm.Model
object, which also has member_repr_latex_
. Note thatfunctools.partial
is used in other modules as well.A possible alternative could be to explicitly define attribute
__name__
to thefunctools.partial
object (see elastic/apm-agent-python#293). But I didn't try that since it'd require changing PyMC's source code.The workaround above made it possible to
dill.dump
the object, but I'm getting an error whendill.load
the file:with
So my problem is still not solved.
Versions and main components
The text was updated successfully, but these errors were encountered: