Skip to content

ModuleNotFoundError: No module named 'torchtext.legacy' #21

@Ziaurrehman1234

Description

@Ziaurrehman1234

I run the demo code. installed all required libraries but got error

ModuleNotFoundError Traceback (most recent call last)
in <cell line: 5>()

  4 from pathlib import Path

----> 5 from pytorch_lightning import Trainer
6 from pytorch_lightning.callbacks.model_checkpoint import ModelCheckpoint
7 # from pytorch_lightning.profiler import AdvancedProfiler

/usr/local/lib/python3.8/site-packages/pytorch_lightning/utilities/apply_func.py in
27 if _TORCHTEXT_AVAILABLE:
28 if _compare_version("torchtext", operator.ge, "0.9.0"):
---> 29 from torchtext.legacy.data import Batch
30 else:
31 from torchtext.data import Batch

ModuleNotFoundError: No module named 'torchtext.legacy'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions