Skip to content

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

Closed

Description

@MineThingIssues

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

Activity

  1. harskish commented on May 14, 2020

    @harskish
    Owner

    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.

  2. MineThingIssues commented on May 15, 2020

    @MineThingIssues
    Author

    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

  3. MineThingIssues commented on May 15, 2020

    @MineThingIssues
    Author

    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

  4. added a commit that references this issue on Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions