It’s hard to say for sure what’s going wrong since the code that actually produced the error isn’t included in your post, but it looks from the stack trace like you’re trying to use SVI with a continuous autoguide. The error is telling you that you can’t use a continuous variational distribution for a discrete latent variable. You’ll need to write your own guide or use a combination of a continuous and discrete autoguide (pyro.contrib.autoguide.AutoDiscreteParallel
) via pyro.contrib.autoguide.AutoGuideList
.
Note that inference in models like this with lots of discrete latent variables is difficult, especially variational inference, and if you want to work with a larger version of the model you may need to write your own guide and use pyro.infer.TraceGraph_ELBO
with neural baselines to reduce gradient variance. See the SVI gradient estimator tutorial and one of the references there on amortized variational inference in SBNs for more background.