Reuters GPT From Scratch (pererabsdt/reuters-gpt-from-scratch)

A 30.8M-parameter GPT-2 style autoregressive language model trained from randomly initialized weights using causal language modeling (next-token prediction) on the ingeniumacademy/reuters_articles corpus.

Model Architecture

  • Architecture: GPT2LMHeadModel (initialized from scratch via GPT2Config)
  • Parameters: 30,812,160
  • Layers (n_layer): 6
  • Attention Heads (n_head): 6
  • Embedding Dimension (n_embd): 384
  • Context Window (n_positions): 512 tokens
  • Tokenizer: ingeniumacademy/gpt2-reuters-tokenizer (vocab_size=52000)

Training Results

  • Objective: Self-supervised causal language modeling (mlm=False) on concatenated title + body sequences
  • Final Validation Loss (8 epochs): 4.2008
  • Final Validation Perplexity (8 epochs): 66.74

Training vs Validation Loss

Usage

from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("pererabsdt/reuters-gpt-from-scratch")
model = AutoModelForCausalLM.from_pretrained("pererabsdt/reuters-gpt-from-scratch")

inputs = tokenizer("NEW YORK - U.S. Treasury bond prices", return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=60, do_sample=True, temperature=0.8)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Downloads last month
29
Safetensors
Model size
30.8M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Dataset used to train pererabsdt/reuters-gpt-from-scratch