Downloads · 30 days
0
DanielRegaladoCardoso/cronica-jax-5m
cronica-jax-5m is a text generation model from DanielRegaladoCardoso. Use it when you need the model to write or continue text. It is set up for jax. The card lists the license as apache-2.0.
A 5.26M parameter decoder-only Transformer, hand-written in pure JAX (no Flax, no Equinox), that learns the data-to-text task: take a structured football match <STATS block and produce a Spanish-language crónica in on…
Downloads · 30 days
0
Access
Public
Updated May 15, 2026
Repo size
21 MB
Likes
0
Public
Click a slice to open those files.
.pkl21 MB · 97%
From the Hugging Face model README
A 5.26M parameter decoder-only Transformer, hand-written in pure JAX
(no Flax, no Equinox), that learns the data-to-text task: take a
structured football match <STATS> block and produce a Spanish-language
crónica in one of 8 regional commentator styles.
This model is a portfolio piece that demonstrates the craft of implementing a Transformer from first principles in JAX. It is intentionally small and is not a state-of-the-art language model.
<cronica>...</cronica> span; prompt tokens contribute zero loss.All forward-pass primitives — attention, RoPE, RMSNorm, SwiGLU, the training step — are hand-implemented in pure JAX, as a deliberate exercise in understanding the math.
import jax
from tokenizers import Tokenizer
from cronica.train import load_ckpt
from cronica.sample import generate_cronica
from huggingface_hub import hf_hub_download
tok_path = hf_hub_download("DanielRegaladoCardoso/cronica-jax-5m", "tokenizer.json")
ckpt = hf_hub_download("DanielRegaladoCardoso/cronica-jax-5m", "ckpt_002000.pkl")
tok = Tokenizer.from_file(tok_path)
params, cfg, step = load_ckpt(ckpt)
stats = ("<STATS>\n"
"liga: La Liga\n"
"fecha: 2024-03-15\n"
"local: Real Madrid\n"
"visitante: Atletico Madrid\n"
"resultado: 2-1\n"
"goles:\n"
" - 23' Vinicius Junior (Real Madrid)\n"
" - 67' Antoine Griezmann (Atletico Madrid)\n"
" - 88' Jude Bellingham (Real Madrid)\n"
"</STATS>")
text = generate_cronica(params, cfg, tok, stats,
style_label="rioplatense_apasionado",
temperature=0.85, top_k=50, top_p=0.9,
max_new_tokens=300)
print(text)
| label | region / flavor |
|---|---|
rioplatense_apasionado | Argentina, emotive, "gol" lengthened |
rioplatense_tecnico | Argentina, analytical |
rioplatense_literario | Uruguay, evocative prose |
mexicano_irreverente | Mexico, sarcastic |
mexicano_clasico | Mexico, formal |
centroamericano_espn | El Salvador / ESPN Latam, polished |
espanol_radiofonico | Spain, radio broadcast style |
comentario_tecnico | tactical analysis |
gpt-4o-mini,
which sometimes added manager names, stadium nicknames, or derby
references not present in the <STATS>. Our small model can reproduce
this hallucination tendency. Use with care if grounding matters.rioplatense_apasionado,
rioplatense_literario, comentario_tecnico) have strong distinctive
vocab (gooool, barrilete, transiciones); the other five share
more neutral journalistic vocabulary.Apache 2.0. See LICENSE.