A small GPT-2 style autoregressive language model trained from randomly initialised weights (no pretrained GPT-2 weights) on the Reuters articles dataset (title + body as full text) for the Self-Supervised Learning assignment. Next-token prediction (causal LM) objective.
| Setting | Value |
|---|---|
| Layers / heads | 6 / 8 |
| Hidden size (d_model) | 256 |
| FFN size | 1024 |
| Context length | 256 |
| Vocabulary | 52000 (ingeniumacademy/gpt2-reuters-t) |
| Parameters | 18,116,608 |
| Split | Loss | Perplexity |
|---|---|---|
| Validation | 5.0261 | 152.34 |
| Test | 4.7997 | 121.47 |
from transformers import AutoTokenizer, AutoModelForCausalLM
tok = AutoTokenizer.from_pretrained("Induwara02/gpt2-reuters-scratch-2ep")
model = AutoModelForCausalLM.from_pretrained("Induwara02/gpt2-reuters-scratch-2ep")
ids = tok("AMEX SAYS SHORT INTEREST", return_tensors="pt")
print(tok.decode(model.generate(**ids, max_new_tokens=50, do_sample=True, top_p=0.9)[0]))
Small corpus (~3M tokens) and small model: output is topical but often incoherent, and the model can repeat or invent facts. Not for real use. Educational project only.