-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pyro v1.4.0 compatibility #286
Comments
Hi Alex, thanks for reaching out! I guess there are two potential reasons for your problem:
gives
With this change and using v0.11.1, your code finishes successfully for me. Let me know if this worked :) Michael |
Thanks for the fast reply! I first install your package using %pip install sbi and then execute import torch
import sbi
import sbi.utils as utils
from sbi.inference.base import infer
print('Version: ', sbi.__version__)
num_dim = 3
prior = utils.BoxUniform(low=-2*torch.ones(num_dim), high=2*torch.ones(num_dim))
def simulator(parameter_set):
return 1.0 + parameter_set + torch.randn(parameter_set.shape) * 0.1
posterior = infer(simulator, prior, method='SNRE', num_simulations=1000)
observation = torch.zeros(3)
samples = posterior.sample((100,), x=observation, mcmc_method = 'hmc', mcmc_parameters={'init_strategy': 'sir'}) Which gives the following output and stack of error messages. It looks to me more like it tries to call the method one more time even the sampling is already finished?
Not sure why it finishes for you but not here (and I just tried it on my own laptop and I got the same error message)... |
It seems that this is because of a recent update in pyro to v1.4.0. I do not yet know what exactly breaks our code, but a quick fix for you might be to
Let me know this worked :) Michael |
Yes, great! |
Glad to hear that! :) I'll leave this issue open until we have found a more stable fix for this. |
f7444cc pins pyro to v1.3.1 as a temporary solution |
I would rather not close until we got rid of |
Sure, we can keep it open For context: #339 introduced |
Pyro 1.5.0 including the bugfix was released. We decided to keep the workaround in place nevertheless, in order not to have to change the pyro requirement in |
Hi,
I was experimenting with SNRE and encountered the following problem:
This throws an error in the method pyro_potential of snre_base which seems to happen in the very last iteration. The same holds true for mcmc_method = 'nuts'.
The text was updated successfully, but these errors were encountered: