I have a hierarchical time-varying weibull survival model with a model structure based off of this pymc3 example

It works fine for pymc3 (3.11.5), but it ends up with 100% divergences in pymc v4 (4.1.4). When I look at the posterior, every draw within chains is identical

(i.e. for all i, 0:1000, this returns the same array `idata1.posterior["beta"].sel({"chain":0, "draw": i })`

. This also occurs for all RVs, not just beta ). I ran into the same issue where all of the draws were identical in this thread as well.

Any ideas?

Had to include this one as a notebook since the simulation code is so long, but here’s the model code below

```
with pm.Model(coords=coords) as model:
# style level parameters
log_k = pm.Normal('log_k', 0.4, 0.4, dims="group")
log_lambd = pm.Normal('log_lambd', 3.5, 0.5, dims="group")
# Helper variables
k = pm.Deterministic("k", pm.math.exp(log_k), dims="group")
lambd = pm.Deterministic("lambd", pm.math.exp(log_lambd), dims="group")
# base hazard
lambda0 = pm.Deterministic("lambda0", k/lambd * (intervals[:,None]/lambd)**(k-1), dims=("intervals", "group") )
# constrain the sd to 0.5, since I think 99% of the effect below 5x impact ( exp(0.5*3) = 4.5 )
beta = pm.Normal("beta", 0.0, 0.5, dims="group")
# hazard
lambda_ = pm.Deterministic("lambda_", pm.math.exp(beta[g_i] * X.T) * lambda0[:, g_i] )
# force the likelihood to be 0 for any time point that a unit never reached
mu = pm.Deterministic("mu", exposure * lambda_.T)
obs = pm.Poisson("obs", mu, observed=damage)
```

And to see the full code, just download the attachment and change the .py extension to .ipynb

pymc-time varying.py (16.5 KB)