Downloads · 30 days
0
sam231123/medieval-roleplay-engine
medieval-roleplay-engine is a machine learning model from sam231123. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
A medieval roleplay AI with two characters built from scratch and fine tuned on GPT-2 medium.
Downloads · 30 days
0
Access
Public
Updated Apr 13, 2026
Repo size
1.5 GB
Likes
0
Public
Click a slice to open those files.
.safetensors1.4 GB · 98%
From the Hugging Face model README
A medieval roleplay AI with two characters built from scratch and fine tuned on GPT-2 medium.
| Stat | Value |
|---|---|
| Parameters | ~8M |
| Architecture | Transformer + RoPE |
| Layers | 6 |
| Attention heads | 6 |
| Embedding dim | 384 |
| FFN dim | 768 |
| Max sequence length | 128 tokens |
| Vocabulary size | ~1300 tokens |
| Position encoding | Rotary RoPE |
| Activation | ReLU |
| Normalisation | LayerNorm |
| Weight tying | Yes |
| Training data | 240,000 conversations |
| Train epochs | 15 |
| Optimizer | AdamW |
| Learning rate | 3e-4 cosine decay |
| Batch size | 64 |
| Best val loss | 0.27 |
| Training time | ~30 minutes on T4 |
| Stat | Value |
|---|---|
| Base model | GPT-2 medium |
| Parameters | 354,826,240 |
| Layers | 24 |
| Attention heads | 16 |
| Embedding dim | 1024 |
| Vocabulary size | 50,260 + 2 custom |
| Custom tokens | [KNIGHT] [DRAGON] |
| Training data | 48,000 sampled conversations |
| Fine tune epochs | 1 |
| Optimizer | AdamW |
| Learning rate | 2e-5 cosine decay |
| Batch size | 8 |
| Max sequence length | 128 tokens |
| Best val loss | 0.2623 |
| Training time | ~48 minutes on T4 |
Input tokens
-> Token Embedding (vocab x 384)
-> Dropout
-> 6 x TransformerBlock
-> LayerNorm
-> SelfAttention (6 heads, RoPE)
-> Residual
-> LayerNorm
-> FeedForward (384 -> 768 -> 384, ReLU)
-> Residual
-> LayerNorm
-> LM Head (384 -> vocab, weight tied)
-> Softmax -> next token
You> what do you live for knight
Knight> i am simply a man who chose to stand when others fled.
purpose is the difference between a mercenary and a true hero.
meaning is not discovered.
You> are you afraid of death knight
Knight> death holds no terror for one who has lived with honour.
a knight feels fear and charges anyway.
You> i can offer you a great black stone dragon
Dragon> stone is heavy and soft and humans kill each other over it.
curious how the old tales about dragons repeat themselves.
your kind builds kingdoms.
You> tell me something i do not know dragon
Dragon> fire. what you see is merely the beginning.
everything dies. i am simply taking longer than most.
torch>=2.0.0
transformers>=4.30.0
tokenizers>=0.13.0
pip install torch transformers tokenizers
python src/chat.py