GPT-2 (small, from scratch) trained on Reuters articles

CS4681 Assignment 02. Randomly initialised GPT-2 (no pretrained weights), trained with next-token prediction on title + "\n\n" + body of the Reuters articles dataset, using the tokenizer ingeniumacademy/gpt2-reuters-tokenizer.

main model (repo root)
layers / hidden / heads 6 / 384 / 6
context length 256
parameters 30,713,856
epochs / lr / batch 5 / 6e-4 (cosine) / 32
training time (T4) 11.3 min
validation loss (ppl) 4.2574 (70.6)
test loss (ppl) 4.0567 (57.8)

Sub-folders: run_2_epochs/ (2 epochs), run_small_model_5_epochs/ (3 layers, 256 hidden, 4 heads). Also: training_results.json, generated_samples.json, figures/.

from transformers import AutoTokenizer, GPT2LMHeadModel
tok = AutoTokenizer.from_pretrained("sehandi/gpt2-reuters-from-scratch")
model = GPT2LMHeadModel.from_pretrained("sehandi/gpt2-reuters-from-scratch")
Downloads last month
-
Safetensors
Model size
30.7M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Dataset used to train sehandi/gpt2-reuters-from-scratch