anvoynov / GANLatentDiscovery

The authors official implementation of Unsupervised Discovery of Interpretable Directions in the GAN Latent Space
416 stars 52 forks source link

No module named 'torch_utils' #31

Closed dokluch closed 3 years ago

dokluch commented 3 years ago

I'm running this repository code in Google Colab setting the environment with Conda to match the requirements.txt and getting this issue

python run_train.py --gan_type StyleGAN2 --gan_weights ../network-snapshot-000200.pkl --deformator ortho --out ../Results/
Traceback (most recent call last):
  File "run_train.py", line 106, in <module>
    main()
  File "run_train.py", line 64, in main
    G = load_generator(args.__dict__, weights_path)
  File "/content/GANLatentDiscovery/loading.py", line 19, in load_generator
    G = make_style_gan2(args['gan_resolution'], G_weights, args['w_shift'])
  File "/content/GANLatentDiscovery/models/gan_load.py", line 110, in make_style_gan2
    G.load_state_dict(torch.load(weights, map_location='cpu')['g_ema'])
  File "/usr/local/envs/latent/lib/python3.8/site-packages/torch/serialization.py", line 529, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/usr/local/envs/latent/lib/python3.8/site-packages/torch/serialization.py", line 692, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
ModuleNotFoundError: No module named 'torch_utils'

What might be the issue?

anvoynov commented 3 years ago

Hi @dokluch sorry for the late response. Have you managed to fix the issue?

dokluch commented 3 years ago

Hi @anvoynov. Thank you for following up on this. As in most cases, this has been an issue of me not reading instructions properly. I should have fed run_train.py with a .pt converted file, not a .pkl pickle. That fixed the issue. I would have loved to be able to feed your tool with StyleGAN2-ada-pytorch pickles directly though, so maybe some tinkering on my side would do the trick.