Downloads · 30 days
4
3% of all-time downloads
yusiwen/tang_poetry
tang_poetry is a machine learning model from yusiwen. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
A character-level Transformer (GPT-like) trained on 全唐诗 (Complete Tang Poetry, ~57,000 poems).
Downloads · 30 days
4
3% of all-time downloads
All-time downloads
125
Public
Repo size
211 MB
Likes
0
Public
Click a slice to open those files.
.pt211 MB · 100%
From the Hugging Face model README
A character-level Transformer (GPT-like) trained on 全唐诗 (Complete Tang Poetry, ~57,000 poems).
| Property | Value |
|---|---|
| Architecture | 6-layer Transformer decoder |
| Attention | 6-head MultiheadAttention |
| Embedding dim | 384 |
| Parameters | 17.5M |
| Context length | 128 characters |
| Vocab size | 8,879 (Chinese chars + punctuation) |
| Training data | ~3.9M chars from 全唐诗 (simplified Chinese) |
pip install torch zhconv
from inference import load_model
gen = load_model("poetry_model.pt")
print(gen("床前明月光", max_new_tokens=100))
| File | Description |
|---|---|
poetry_model.pt | Model checkpoint (weights, optimizer, config, tokenizer) |
config.json | Hyperparameters |
tokenizer.json | Character vocabulary (stoi / itos) |
inference.py | Standalone inference script |
train_poetry.py | Full training script |
Trained on Apple MPS (M4 MacBook Pro) with:
Seed: 大漠孤烟直
Generated:
大漠孤烟直,秋霜未落残。
后期殊灼得,前事有堆劳。
恩势已云懦,幽深不可逃。
王程未去绝,左右空踟蹰。
门径微月色,庭盘晓云初。
MIT