How do trouble-shoot the PyMC3 hanging when trying to run on multiple cores?

Viewed 142

I'm not able to use multi-core processing on my Mac with Pymc3. I've read through forums on developer forums for PyMC3 but it seems like the issue I'm encountering is mostly with Windows.

Basically, the code below just hangs. If I run on one core it works fine.

It does work on multi-core if I wrap the below snippet in a function that call that function after a if __name__ == '__main__' statement

Below is the code I'm running in my Jupyter cell

    print('Running:',specialty_filter)
    with pm.Model() as logistic_model:
        pm.glm.GLM.from_formula(
            "is_noshow ~ binnednoshows + priorthvisitcount + priorthvisitcount  + priornoshowvisits  + priornoshowvisits:priorthvisitcount + priorthvisitcount:priornoshowvisits:priorthvisitcount + age + C(same_day_yn) + C(is_telehealth_visit) + C(diane_elizabeth) + C(prc_name_binned)",  #  + priornoshowvisits + priorthvisitcount age
            df_hist,
            family=pm.glm.families.Binomial(),
        )
        trace = pm.sample(
            10000,
            tune=6400,
            random_seed=951,
            max_treedepth=16,
            target_accept=0.98,
            # chains=4,
            # cores=4,
            init="adapt_diag",
        )
0 Answers
Related