gpt2-reuters / README.md
MeshMax's picture
Main GPT-2 model trained from scratch
5f441c7 verified
|
Raw History Blame Contribute Delete
1.32 kB
---
library_name: transformers
tags: [gpt2, causal-lm, from-scratch, reuters]
datasets: [ingeniumacademy/reuters_articles]
---
# GPT-2 (small, from scratch) on Reuters articles
Trained **from random initialisation** with the causal (next-token) language-modelling objective
on the concatenated *title + body* of `ingeniumacademy/reuters_articles`, using the tokenizer `ingeniumacademy/gpt2-reuters-tokenizer`.
## Results
| metric | value |
|---|---|
| parameters | 18,116,608 |
| epochs | 5 |
| training time | 7.8 min |
| validation loss / perplexity | 4.4245 / 83.47 |
| test loss / perplexity | 4.1997 / 66.67 |
## Configuration
```json
{
"run": "main",
"epochs": 5,
"n_embd": 256,
"n_layer": 6,
"n_head": 8,
"block_size": 256,
"learning_rate": 0.0005,
"batch_size": 32,
"total_params": 18116608,
"embedding_params": 13377536,
"non_embedding_params": 4739072,
"train_time_sec": 465.7,
"final_train_loss": 4.1007,
"avg_train_loss": 4.7803,
"val_loss": 4.4245,
"val_perplexity": 83.47,
"test_loss": 4.1997,
"test_perplexity": 66.67
}
```
![loss curve](loss_curve.png)
## Usage
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
tok = AutoTokenizer.from_pretrained("MeshMax/gpt2-reuters")
model = AutoModelForCausalLM.from_pretrained("MeshMax/gpt2-reuters")
```