GMM example in documentation gives warning about from TraceEnum_ELBO


I’ve tried to use enumeration feature of SVI in pyro but constantly receive a warning that TraceEnum_ELBO hasn’t found any discrete variable in a guide to sum out.

I’ve run the GMM example that utilizes this feature and still got the same warning:

anaconda3/lib/python3.6/site-packages/pyro/infer/ UserWarning: TraceEnum_ELBO found no sample sites configured for enumeration. If you want to enumerate sites, you need to @config_enumerate or set infer={"enumerate": "sequential"} or infer={"enumerate": "parallel"}? If you do not want to enumerate, consider using Trace_ELBO instead.
warnings.warn('TraceEnum_ELBO found no sample sites configured for enumeration. '

Is it just a false alarm or Pyro didn’t enumerate anything and just used ordinary Monte Carlo Estimation for all RVs?

Have you configured which sites you would like to enumerate over in your model/guide? You can specify this on a per sample site basis with the keyword arg infer={"enumerate": "parallel" (or “sequential”)} to pyro.sample() or you can annotate your guide/model with @config_enumerate(default="parallel") as in the tutorial, which will do the same behind the scenes for all the discrete sample sites in your model and guide. Otherwise, it will just do MC sampling over the discrete RVs when estimating the ELBO (with a very high variance).

I have used the GMM example as is without any changes. The authors use config_enumerate approach there. And still I get a warning that no RVs were found for enumeration

UPDATE: With infer={"enumerate": "parallel"} argument in the sample statement the warning disappeared

Thanks @areshytko, this was merely a bug in the initial call to svi.step(model, guide, ...) that was used to initialize the param store. During inference the guide was enumerated as expected. I’ve fixed this in Fix warning in gmm tutorial by fritzo · Pull Request #1360 · pyro-ppl/pyro · GitHub