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

which torchtext version? #15

Closed
FrancescoSaverioZuppichini opened this issue Nov 24, 2022 · 3 comments
Closed

which torchtext version? #15

FrancescoSaverioZuppichini opened this issue Nov 24, 2022 · 3 comments

Comments

@FrancescoSaverioZuppichini

With torchtext 0.14.0 I got

Traceback (most recent call last):
  File "app.py", line 12, in <module>
    from pytorch_lightning import seed_everything
  File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/__init__.py", line 20, in <module>
    from pytorch_lightning import metrics  # noqa: E402
  File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/metrics/__init__.py", line 15, in <module>
    from pytorch_lightning.metrics.classification import (  # noqa: F401
  File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/metrics/classification/__init__.py", line 14, in <module>
    from pytorch_lightning.metrics.classification.accuracy import Accuracy  # noqa: F401
  File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/metrics/classification/accuracy.py", line 18, in <module>
    from pytorch_lightning.metrics.utils import deprecated_metrics, void
  File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/metrics/utils.py", line 29, in <module>
    from pytorch_lightning.utilities import rank_zero_deprecation
  File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/utilities/__init__.py", line 18, in <module>
    from pytorch_lightning.utilities.apply_func import move_data_to_device  # noqa: F401
  File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/utilities/apply_func.py", line 31, in <module>
    from torchtext.legacy.data import Batch
ModuleNotFoundError: No module named 'torchtext.legacy'
@woctezuma
Copy link

Related:

@0xdevalias
Copy link

0xdevalias commented Nov 24, 2022

Googling the error message No module named 'torchtext.legacy':

https://www.datasciencelearner.com/modulenotfounderror-no-module-named-torchtext-legacy-solved/

The above Incorrect imports work properly in the lower version of torchtext (0.10.0 or lower ). Because these versions have the same directory structure. We will use the pip package manager to downgrade torchtext module. Here is the command for that-

pip install torchtext==0.10.0

Potentially related:

Originally posted by @0xdevalias in #8 (comment)


https://github.com/pytorch/text#installation

The following are the corresponding torchtext versions and supported Python versions.

..snip..


Based on that, it looks like you want to be using one of these combinations presumably?

PyTorch version torchtext version Supported Python version
1.10.0 0.11.0 >=3.6, <=3.9
1.9.1 0.10.1 >=3.6, <=3.9

What version of PyTorch are you using alongside torchtext 0.10? As I suspect that will likely be the source of your ModuleNotFoundError: No module named 'torch.ao.quantization' error.

Originally posted by @0xdevalias in #8 (comment)


Originally posted by @0xdevalias in #8 (comment)

@FrancescoSaverioZuppichini
Copy link
Author

Googling the error (which I did), doesn't fix it just generate another error (correctly shown in the other issue. Closing in favor of the other

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

3 participants