Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while running run_inversion.py example #111

Open
Vibhu04 opened this issue Aug 19, 2023 · 1 comment
Open

Error while running run_inversion.py example #111

Vibhu04 opened this issue Aug 19, 2023 · 1 comment

Comments

@Vibhu04
Copy link

Vibhu04 commented Aug 19, 2023

I ran the following example code provided in the readme:

python run_inversion.py --outdir=inversion_out \
  --target media/jay.png \
  --inv-steps 1000 --run-pti --pti-steps 350 \
  --network=https://s3.eu-central-1.amazonaws.com/avg-projects/stylegan_xl/models/imagenet512.pkl

and got this error:

Loading networks from "https://s3.eu-central-1.amazonaws.com/avg-projects/stylegan_xl/models/imagenet512.pkl"...
Downloading https://s3.eu-central-1.amazonaws.com/avg-projects/stylegan_xl/models/imagenet512.pkl ... done
Traceback (most recent call last):
  File "run_inversion.py", line 336, in <module>
    run_projection() # pylint: disable=no-value-for-parameter
  File "/home/vibhu/miniconda3/envs/general/lib/python3.7/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/home/vibhu/miniconda3/envs/general/lib/python3.7/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/vibhu/miniconda3/envs/general/lib/python3.7/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/vibhu/miniconda3/envs/general/lib/python3.7/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "run_inversion.py", line 265, in run_projection
    G = legacy.load_network_pkl(fp)['G_ema'].to(device) # type: ignore
  File "/home/vibhu/Workspace/stylegan-xl/legacy.py", line 25, in load_network_pkl
    data = _LegacyUnpickler(f).load()
  File "/home/vibhu/Workspace/stylegan-xl/legacy.py", line 75, in find_class
    return super().find_class(module, name)
ModuleNotFoundError: No module named 'timm.models.layers.conv2d_same'

I'd really appreciate any help, thank you.

@Liu-Hy
Copy link

Liu-Hy commented Sep 5, 2023

This is likely an issue about timm version, when you run the file in another environment. You can try pip install timm==0.4.12.
Also, to merge all the requirements specified in a yaml file into an existing conda environment, you can deactivate from the environment and use this conda env update --name myenv --file environment.yml --prune

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants