Skip to content

Fix: Replace legacy TextCNN with modern DistilBERT example#3533

Merged
vfdev-5 merged 6 commits intopytorch:masterfrom
TahaZahid05:fix/new-text-classification-example
Feb 16, 2026
Merged

Fix: Replace legacy TextCNN with modern DistilBERT example#3533
vfdev-5 merged 6 commits intopytorch:masterfrom
TahaZahid05:fix/new-text-classification-example

Conversation

@TahaZahid05
Copy link
Copy Markdown
Collaborator

Fixes #3521

Description: This PR replaces the broken TextCNN.ipynb notebook with a modern text classification example, TextTransformers.ipynb.

The original notebook relied on torchtext 0.9.1, which caused binary mismatches and OSError crashes in modern environments (Torch >= 1.10). This new implementation adopts a modern model while showcasing Ignite's integration with the Hugging Face ecosystem.

Changes

  • Deleted: examples/notebooks/TextCNN.ipynb (Legacy dependency on torchtext==0.9.1).

  • Added: examples/notebooks/TextTransformers.ipynb.

Model: Uses DistilBERT from transformers.
Data: Replaces legacy loaders with datasets (HF) to load the IMDB dataset.
Workflow: Demonstrates Ignite's Trainer and Evaluator logic for fine-tuning a transformer model.

Check list:

  • New tests are added (if a new feature is added)
  • New doc strings: description and/or example code are in RST format
  • Documentation is updated (if required)

@github-actions github-actions bot added the examples Examples label Feb 13, 2026
Copy link
Copy Markdown
Collaborator

@vfdev-5 vfdev-5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @TahaZahid05 !
Looks good, I left few minor comments on how to improve it a bit.

Copy link
Copy Markdown
Collaborator

@vfdev-5 vfdev-5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @TahaZahid05, LGTM !

@vfdev-5 vfdev-5 merged commit 9c382b4 into pytorch:master Feb 16, 2026
6 of 7 checks passed
@TahaZahid05 TahaZahid05 deleted the fix/new-text-classification-example branch March 4, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

examples Examples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants