ignite icon indicating copy to clipboard operation
ignite copied to clipboard

[Bug][Examples] TextCNN.ipynb is broken due to legacy torchtext 0.9.1 dependency

Open TahaZahid05 opened this issue 9 months ago • 6 comments

Hi there!

While working on updates to the examples directory, I identified that examples/notebooks/TextCNN.ipynb is currently unusable in modern Python/Torch environments. The notebook explicitly attempts to install torchtext==0.9.1, which creates a fundamental version conflict with the core library requirements.

  • Project Python Requirement: >=3.9, <=3.13
  • Project Torch Requirement: >=1.10, <3

torchtext 0.9.1 was built for torch 1.8.1. Because the project now requires torch >= 1.10, attempting to force-install the legacy version causes a binary mismatch.

In a Python 3.10 / Torch 2.x environment, importing the library results in the following crash:

OSError: /.../site-packages/torchtext/lib/libtorchtext.so: undefined symbol: _ZN5torch6detail10class_baseC2ERKSsS3_SsRKSt9type_infoS6_

The notebook requires a refactor to remove the torchtext dependency entirely.

I am documenting this issue here as it falls outside the scope of my current PR (which focuses on pbar clean-up), but it remains an inconvenience for users trying to follow this tutorial.

I am happy to work on this refactor in a separate follow-up PR if assigned to this issue.

TahaZahid05 avatar Feb 07 '26 23:02 TahaZahid05

Thanks for the report @TahaZahid05 . The best would be to rewrite entirely the notebook and use a modern model and other python packages like hf datasets.

vfdev-5 avatar Feb 09 '26 08:02 vfdev-5

Best, makes sense. I'll get started on refactoring and will submit a PR accordingly.

TahaZahid05 avatar Feb 09 '26 09:02 TahaZahid05

@vfdev-5 Before I start implementing, I want to confirm that my implementation aligns with your goals:

  1. I plan to use DistilBERT via transformers. A modern model but lightweight compared to BERT as well.
  2. I'll use datasets to load IMDB and AutoTokenizer for preprocessing. This will remove the torchtext dependency.
  3. Lastly, I'll use Ignite's features to drive the training.

Let me know if there is anything you'll like me to change.

TahaZahid05 avatar Feb 12 '26 18:02 TahaZahid05

Yes, it makes sense. It can be similar to https://code-generator.pytorch-ignite.ai/create (text classification template). Thanks!

vfdev-5 avatar Feb 12 '26 20:02 vfdev-5

@vfdev-5 The link doesn't seem to be working.

TahaZahid05 avatar Feb 13 '26 08:02 TahaZahid05

@TahaZahid05 it is hosted on netlify which may be blocked by some countries.

vfdev-5 avatar Feb 13 '26 09:02 vfdev-5