lucidrains / lightweight-gan

Implementation of 'lightweight' GAN, proposed in ICLR 2021, in Pytorch. High resolution image generations that can be trained within a day or two
MIT License
1.62k stars 220 forks source link

ImportError: cannot import name 'filter2d' from 'kornia' #111

Closed Technerder closed 2 years ago

Technerder commented 2 years ago

Trying to use lightweight-gan in a Google Colab notebook but I'm running into this issue.

Traceback (most recent call last):
  File "/usr/local/bin/lightweight_gan", line 5, in <module>
    from lightweight_gan.cli import main
  File "/usr/local/lib/python3.7/dist-packages/lightweight_gan/__init__.py", line 1, in <module>
    from lightweight_gan.lightweight_gan import LightweightGAN, Generator, Discriminator, Trainer, NanException
  File "/usr/local/lib/python3.7/dist-packages/lightweight_gan/lightweight_gan.py", line 25, in <module>
    from kornia import filter2d
ImportError: cannot import name 'filter2d' from 'kornia' (/usr/local/lib/python3.7/dist-packages/kornia/__init__.py)

Installed using pip install lightweight-gan

domef commented 2 years ago

In fixed it in this way https://github.com/lucidrains/lightweight-gan/issues/102#issuecomment-1013700520, but you need to first clone the repository and install it in edit mode:

git clone https://github.com/lucidrains/lightweight-gan.git
pip install -e /path/to/repository
lucidrains commented 2 years ago

let me know if 0.20.7 works!

domef commented 2 years ago

Now it works, thank you.