You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm training SNPE without an explicit prior on GPU. When I want to build the posterior, I get the following error massage.
If I repeat the training only on the CPU everything works.
Traceback (most recent call last): File "sbi_train_posterior.py", line 68, in <module> main(args.train_file, args.posterior_file) File "sbi_train_posterior.py", line 45, in main posterior = inference.build_posterior(density_estimator) File "/home/dingeldein/anaconda3/lib/python3.8/site-packages/sbi/inference/snpe/snpe_base.py", line 420, in build_posterior potential_fn, theta_transform = posterior_estimator_based_potential( File "/home/dingeldein/anaconda3/lib/python3.8/site-packages/sbi/inference/potentials/posterior_based_potential.py", line 46, in posterior_estimator_based_potential theta_transform = mcmc_transform(prior, device=device) File "/home/dingeldein/anaconda3/lib/python3.8/site-packages/sbi/utils/sbiutils.py", line 618, in mcmc_transform if hasattr(prior, "mean") and hasattr(prior, "stddev"): File "/home/dingeldein/anaconda3/lib/python3.8/site-packages/pyro/distributions/empirical.py", line 154, in mean return self._weighted_mean(self._samples) File "/home/dingeldein/anaconda3/lib/python3.8/site-packages/pyro/distributions/empirical.py", line 136, in _weighted_mean return (value * relative_probs).sum( RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
My code:
` device = 'cuda' if torch.cuda.is_available() else 'cpu'
Hi,
I'm training SNPE without an explicit prior on GPU. When I want to build the posterior, I get the following error massage.
If I repeat the training only on the CPU everything works.
Traceback (most recent call last): File "sbi_train_posterior.py", line 68, in <module> main(args.train_file, args.posterior_file) File "sbi_train_posterior.py", line 45, in main posterior = inference.build_posterior(density_estimator) File "/home/dingeldein/anaconda3/lib/python3.8/site-packages/sbi/inference/snpe/snpe_base.py", line 420, in build_posterior potential_fn, theta_transform = posterior_estimator_based_potential( File "/home/dingeldein/anaconda3/lib/python3.8/site-packages/sbi/inference/potentials/posterior_based_potential.py", line 46, in posterior_estimator_based_potential theta_transform = mcmc_transform(prior, device=device) File "/home/dingeldein/anaconda3/lib/python3.8/site-packages/sbi/utils/sbiutils.py", line 618, in mcmc_transform if hasattr(prior, "mean") and hasattr(prior, "stddev"): File "/home/dingeldein/anaconda3/lib/python3.8/site-packages/pyro/distributions/empirical.py", line 154, in mean return self._weighted_mean(self._samples) File "/home/dingeldein/anaconda3/lib/python3.8/site-packages/pyro/distributions/empirical.py", line 136, in _weighted_mean return (value * relative_probs).sum( RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
My code:
` device = 'cuda' if torch.cuda.is_available() else 'cpu'
The text was updated successfully, but these errors were encountered: