pyro
pyro copied to clipboard
Variational Autoencoders Example is broken
Issue Description
I tried to run the Variational Autoencoders tutorial here and it returns an error
Environment
Both on my machine (Macbook Pro 2019 Catalina) and a Google Colab environment.
pyro.__version__=='1.8.1'
torch.__version__=='1.11.0+cu113'
I tried a couple of combinations of torch and pyro versions, I got always the dame bug
Error
ValueError: Error while computing log_prob at site 'obs':
Expected value argument (Tensor of shape (256, 784)) to be within the support (Boolean()) of the distribution Bernoulli(probs: torch.Size([256, 784])), but found invalid values:
tensor([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]])
Trace Shapes:
Param Sites:
decoder$$$fc1.weight 400 50
decoder$$$fc1.bias 400
decoder$$$fc21.weight 784 400
decoder$$$fc21.bias 784
Sample Sites:
latent dist 256 | 50
value 256 | 50
log_prob 256 |
obs dist 256 | 784
value 256 | 784
Hmm, I can't reproduce this on Colab, and I would expect this warning/error to be suppressed by the disabling of distribution runtime checks pyro.distributions.enable_validation(False)
. Can you run pip freeze
and post the output?
I ran this example locally (2019 MacBook Pro using macOS Monterey) a couple days ago and it worked fine:
pyro-api=0.1.2
pyro-ppl=1.8.1
torch=1.11.0
My results were in line with the example notebook results.