Problems moving from shared variable to data container

Yes sorry I’ve made a mistake when trying to make a minimal example, (I can’t seem to be able to edit the original post) the code should be

age = data_df.age_num.astype(int).values
age_sh = shared(age)
n_age = len(set(age))

region = data_df.region
region_sh = shared(region)
n_region = len(set(region))

observed_data = data_df.obs

def hierarchical_normal(name, shape, μ=0.0):
    Δ = pm.Normal("Δ_{}".format(name), 0.0, 1, shape=(shape, 4))  # 4 is num parties
    σ = pm.HalfCauchy("σ_{}".format(name), 1)
    return pm.Deterministic(name, μ + Δ * σ)

with pm.Model() as model:
    α_region = hierarchical_normal("state", n_region)
    α_age = hierarchical_normal("age", n_age)
    β0 = pm.Normal(
        "β0",
        0.0,
        0.5,
        shape=(1, 4),
    )
    η =  β0 + α_age[age_sh ] + α_region[region_sh ]
    p = pm.math.softmax(η, axis=1)
    obs = pm.Multinomial("O", n_, p, shape=(len(observed_data ), 4), observed=observed_data )