Skip to content

Testing and Validation

Sudhanshu edited this page Nov 11, 2026 · 1 revision

Testing and Validation

Verified on the supplied source in this package build

  • Python syntax: python -m py_compile transformer_from_scratch.py — passed.
  • Offline smoke-test: python transformer_from_scratch.py --smoke-test --output <temporary-dir> — passed on CPU with PyTorch 2.10.0+cpu.
  • Execution path: train for 2 epochs; select and save best checkpoint; reload checkpoint; perform final held-out synthetic test evaluation — completed.
  • Observed model size: 56,738 trainable parameters in smoke-test configuration.

Example observed synthetic metrics (not a Yelp benchmark)

Metric Observed value
Dataset sizes train 64 / validation 8 / test 8
Epochs 2
Best validation accuracy 0.6250
Held-out synthetic test accuracy 0.5000

These metrics are tiny-sample diagnostic results, not meaningful model-quality or generalization claims.

Not verified in this package build

  • Hugging Face dataset and MiniLM model downloads / real-data training.
  • CUDA GPU execution and SDPA backend performance.
  • Multi-GPU, distributed, or mixed-precision execution (not implemented).
  • torchview / Graphviz architecture PNG rendering (optional).

Reproducing the check

python -m py_compile transformer_from_scratch.py
python transformer_from_scratch.py --smoke-test

Optional manual robustness checks include testing --help, running --train with a small batch on an internet-connected machine, and inspecting the generated .pt file metadata. Keep .pt files out of public Git commits unless intentionally publishing trained artifacts.

Clone this wiki locally