generated_quantities always re-computes the entire model - even when not the entire model is needed to actually generate the returned values. E.g.
@model function complicated_model()
a ~ Normal(0, 1)
sleep(0.1) # some expensive computation
b ~ Normal(0, 1)
return a
end
chn = sample(complicated_model(), NUTS(0.65), 100)
generated_quantities(complicated_model(), chn)
What is the easiest way around this? Submodels don't work because the variables have different names - so I suppose the only way is to make a new model that doesn't have the unnecessary expensive bits?