Skip to content

Cannot unpickle certain step samplers when mp_ctx=spawn or forkserver #7857

@jessegrabowski

Description

@jessegrabowski

Description

This error came up in pymc-devs/pymc-extras#542. It is caused by PointFunc recursively trying to access self.f during unpickling. MWE:

import pymc as pm
with pm.Model() as m:
    x = pm.Categorical('x', logit_p=[1., 1., 1., 1.]))
    idata = pm.sample(step=pm.CategoricalGibbsMetropolis([x]), mp_ctx='spawn')

A simple fix would add a check that f has been set inside PointFunc.__getattr__

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions