Lightning-Universe / lightning-flash

Your PyTorch AI Factory - Flash enables you to easily configure and run complex AI recipes for over 15 tasks across 7 data domains

Home Page:https://lightning-flash.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lightning-flash Tabular Import error

DrRaja opened this issue · comments

Hi, I'm back again :(
I installed lightning-flash[tabular] in Google Colab notebook and tried to run the code from the toy example: https://lightning-flash.readthedocs.io/en/stable/reference/tabular_classification.html, however I get the following error:

ModuleNotFoundError: No module named 'torchtext.legacy'

Note: lightning-flash[text] in the same notebook runs fine!

Hi @DrRaja Sorry you're experiencing issues. This can unfortunately happen in environments where torchtext comes pre-installed (like colab). Could you try uninstalling it first before installing Flash following the example here? https://lightning-flash.readthedocs.io/en/stable/installation.html#torchtext-incompatibility

Hope that helps 😃

Thanks for the quick response. Just to clear things for myself, lightning-flash[text] uses a different version of torchtext? I say this because I can import the library without any errors for lightning-flash[text].

Hi @DrRaja, the issue happens when you have torchtext installed but then change to a different version of torch. Because we don't explicitly state a torchtext dependency in our non-text requirements the error gets triggered. In contrast, with the text requirements, we explicitly state torchtext so the correct version gets installed always.

Hope that clears things up! Closing this issue but please feel free to re-open if needed 😃