Buckets:
18 MB
5 files
Updated about 2 months ago
Ctrl+K
| Name | Size | Uploaded | Xet hash |
|---|---|---|---|
| .gitattributes | 345 Bytes xet | 563d75a5 | |
| README.md | 2.35 kB xet | df78f1d0 | |
| config.json | 285 Bytes xet | 0d5cdf0a | |
| pytorch_model.bin | 17.8 MB xet | 0ec0a64f | |
| vocab.txt | 232 kB xet | 23d0b8a3 |
bert-tiny (mirror)
A 2-layer, 128-hidden BERT — about 4.4M parameters / 17 MB. Small enough to fine-tune on a laptop CPU in minutes, which makes it the go-to model for smoke tests, CI pipelines, unit tests for training code, and edge deployment.
This is a mirror. The weights and tokenizer files here are an unmodified copy of
prajjwal1/bert-tiny, re-hosted on this profile for reproducibility and convenience. All credit for the original work belongs to its authors. The upstream license (mit) is preserved and applies to this copy. If you need the canonical version, please use the upstream repository.
Specs
| Layers | 2 |
| Hidden size | 128 |
| Attention heads | 2 |
| Parameters | ~4.4M |
| Vocab | 30,522 (uncased WordPiece) |
| Disk | ~17 MB |
Usage
from transformers import AutoTokenizer, AutoModel
tok = AutoTokenizer.from_pretrained("priyaganesh2050/bert-tiny")
model = AutoModel.from_pretrained("priyaganesh2050/bert-tiny")
out = model(**tok("A tiny BERT for fast experiments.", return_tensors="pt"))
print(out.last_hidden_state.shape) # torch.Size([1, 9, 128])
Fine-tuning for classification:
from transformers import AutoModelForSequenceClassification
model = AutoModelForSequenceClassification.from_pretrained("priyaganesh2050/bert-tiny", num_labels=2)
When to use this
- Good for: CI/CD tests of training loops, hyperparameter search, teaching, edge/mobile, latency-critical baselines.
- Not good for: accuracy-sensitive production NLP. A 2-layer model gives up a lot of quality
versus
bert-base. Use it as a baseline, then scale up.
Citation
The tiny BERT variants come from the well-read-students line of work:
@misc{turc2019,
title = {Well-Read Students Learn Better: On the Importance of Pre-training Compact Models},
author = {Turc, Iulia and Chang, Ming-Wei and Lee, Kenton and Toutanova, Kristina},
year = {2019},
eprint = {1908.08962},
archivePrefix = {arXiv}
}
- Total size
- 18 MB
- Files
- 5
- Last updated
- Aug 21
- Pre-warmed CDN
- US EU US EU