VAE tutorial issues in imports

Hi,

I’m trying to get the VAE tutorial to run on the MNIST dataset (before going further :sweat_smile:)
However, I struggle to find any reference regarding a tiny issue in the import statements. Here is the code taken from https://github.com/uber/pyro/blob/dev/examples/vae.py referenced here Variational Autoencoders — Pyro Tutorials 1.8.4 documentation

import argparse
import numpy as np
import torch
import torch.nn as nn
import visdom

import pyro
import pyro.distributions as dist
from pyro.infer import SVI
from pyro.optim import Adam
from utils.vae_plots import plot_llk, mnist_test_tsne, plot_vae_samples
from utils.mnist_cached import MNISTCached as MNIST
from utils.mnist_cached import setup_data_loaders

However, the “from utils.xxx import yyy” trigger this error :
ModuleNotFoundError: No module named 'utils'

I thought it was a Pyro dependency at first but I can’t manage to find it referenced anywhere.
Does anyone have a clue on where to find it/the correct import statement ?

Thanks ! :blush:

try running the example from the examples/ directory. that import is a relative path, which may be your issue. also dev is closely tracking pytorch master, which has significant backwards breaking changes. if you are using pyro release, i suggest you use the example here

1 Like

Sorry this is a known issue Include example utils in pip-installed package · Issue #621 · pyro-ppl/pyro · GitHub . Before Pyro 0.2 release we plan to reorganize so those utils live in the pyro package. Thanks for pointing out this difficulty.

1 Like

Thanks for your replies, I’ll try to achieve it like suggested by @jpchen :blush: