Ravindra BagaleCourses & study guides मराठी Track your progress

50. Tiny Text Classifier with a Transformer Intro in PyTorch

50.1 Tiny Text Classification Goal

Why. Finish Phase 3 with a small text classification loop — embeddings + mean pool + linear head (transformer-style intro without downloading a giant model).

What. Fictional task: label Mauli Dairy WhatsApp-style reviews as positive (1) or negative (0).

How.

Scope the demo

  1. Fixed tiny vocabulary.
  2. Pad sequences to equal length.
  3. Model: Embedding → mean over time → Linear → logit.
  4. This is an on-ramp; full TransformerEncoder can come later as stretch.
print("Goal: sentiment 0/1 on tiny fictional reviews")