harskish / ganspace

Discovering Interpretable GAN Controls [NeurIPS 2020]
Apache License 2.0
1.78k stars 264 forks source link

"No module named 'model'" when trying to run interactive.py #10

Closed MineThingIssues closed 4 years ago

MineThingIssues commented 4 years ago

I have spent the last 5 hours trying to get this script to work assuming that it is something wrong on my end, but after reinstalling countless times I thought I would bring it up here to see if i could get some help. In SETUP.md for setting up stylegan2 it says to go to models/stylegan2/stylegan2-pytorch/op and run setup.py, however that directory does not exist, and so I was forced to skip that part of the setup, which I assume is causing this issue. The full error is as follows: Traceback (most recent call last): File "interactive.py", line 22, in <module> from models import get_instrumented_model File "/home/noah/ganspace-master/models/__init__.py", line 11, in <module> from .wrappers import * File "/home/noah/ganspace-master/models/wrappers.py", line 22, in <module> from . import stylegan2 File "/home/noah/ganspace-master/models/stylegan2/__init__.py", line 14, in <module> from model import Generator ModuleNotFoundError: No module named 'model'

I am also unsure as to how I am meant to load up my own .pt file, as with the normal PyTorch version of stylegan2 you are able to specify the file when you run the generate command

harskish commented 4 years ago

StyleGAN2 is included as a git submodule. You can download the submodules by running git submodule update --init --recursive.

As for loading your model: if you already have a pt file generated by Rosinality's stylegan2 implementation, then you only need to modify __init__() and download_checkpoint() in models/wrappers.py.

MineThingIssues commented 4 years ago

Ah thanks, I managed to get it up and running. Do you think you could explain what I need to modify it to? I don't quite understand how I am meant to change it

MineThingIssues commented 4 years ago

Oh i see! I didn't realise i was meant to upload the model to google drive. Issue fixed

Also if anyone has the "Unexpected key(s) in state_dict:" error, add "strict=False"to "self.model.load_state_dict([ckpt['g_ema'], strict=False)" in wrappers.py