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

[Colab] cannot import name 'filter2d' from 'kornia' #102

Open
katongo opened this issue Oct 22, 2021 · 4 comments
Open

[Colab] cannot import name 'filter2d' from 'kornia' #102

katongo opened this issue Oct 22, 2021 · 4 comments

Comments

@katongo
Copy link

katongo commented Oct 22, 2021

Hi

Training on google Colab Pro, I started getting this error:

Traceback (most recent call last):
File "/usr/local/bin/lightweight_gan", line 5, in
from lightweight_gan.cli import main
File "/usr/local/lib/python3.7/dist-packages/lightweight_gan/init.py", line 1, in
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
from kornia import filter2d
ImportError: cannot import name 'filter2d' from 'kornia' (/usr/local/lib/python3.7/dist-packages/kornia/init.py)

Before that everything worked fine for several weeks

@arturocalvoacn
Copy link

arturocalvoacn commented Oct 23, 2021

It seems to be connected with the release 0.6.1 on Kornia (Oct 22nd), where they refactored the library namespaces.
kornia/kornia@218232c

I think filter2d is now under kornia.filters instead of directly under kornia. This causes the training and generation functions of lightweightGAN to crash.

In the meantime you can continue training / generating by reverting to the previous release on Kornia:
pip install kornia==0.5.4

FYI @lucidrains

@katongo
Copy link
Author

katongo commented Oct 23, 2021

Thank you @arturocalvoacn. Indeed downgrading to kornia 0.5.4 fixes the issue.
I guess a fix in the project imports or dependencies is still required

@CaptainStabs
Copy link
Contributor

This was fixed with the latest release

@domef
Copy link

domef commented Jan 15, 2022

I'm having the same problem, I fixed it by changing

from kornia import filter2d
in from kornia.filters import filter2d.

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

4 participants