Instructions to use mateo-19182/forocoches-lm-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mateo-19182/forocoches-lm-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mateo-19182/forocoches-lm-v2")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mateo-19182/forocoches-lm-v2") model = AutoModelForCausalLM.from_pretrained("mateo-19182/forocoches-lm-v2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mateo-19182/forocoches-lm-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mateo-19182/forocoches-lm-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mateo-19182/forocoches-lm-v2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/mateo-19182/forocoches-lm-v2
- SGLang
How to use mateo-19182/forocoches-lm-v2 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "mateo-19182/forocoches-lm-v2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mateo-19182/forocoches-lm-v2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "mateo-19182/forocoches-lm-v2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mateo-19182/forocoches-lm-v2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use mateo-19182/forocoches-lm-v2 with Docker Model Runner:
docker model run hf.co/mateo-19182/forocoches-lm-v2
forocoches-lm v2
Gemma 3 1B (pretrained) fully fine-tuned to write Spanish forum threads in the style of ForoCoches: title, opening post and replies, conditioned on a thread type. Demo at forocoches.m19182.dev (runs in the browser with the q4f16_1 MLC weights).
Prompt format
Plain text. Optional header line, then the title, then posts separated by blank lines. Authors are pseudonymised (OP, forero_a, forero_b, ...). Quotes are [cita=forero_a]...[/cita].
tipo: historia
TÍTULO: Lo que me ha pasado hoy en el Mercadona +tocho
#1 OP: Bueno shurs, ayer por la tarde...
#2 forero_a: ...
tipo is one of historia, pregunta, debate, noticia, humor, hipotetico, otro. Omit the header for an unconditioned thread. The model was trained with tipo only (v1 also saw calidad and páginas).
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("mateo-19182/forocoches-lm-v2")
model = AutoModelForCausalLM.from_pretrained("mateo-19182/forocoches-lm-v2", dtype="bfloat16", device_map="auto")
ids = tok("tipo: pregunta\n\nTÍTULO:", return_tensors="pt").to(model.device)
out = model.generate(**ids, max_new_tokens=300, do_sample=True, temperature=0.8, top_p=0.95, repetition_penalty=1.1)
print(tok.decode(out[0], skip_special_tokens=True))
Training
- Data: ~496M tokens, one epoch. Public ForoCoches archive 2018–2019 (Atenrev/forocoches-language-generation), up to 30 posts per thread, sales threads excluded, exact duplicates removed, 1% of threads held out. Stories sampled ×2, the rest ×1, plus 8% general-Spanish replay from FineWeb-2 (
spa_Latn). Long threads split into 4,096-token chunks with 256 tokens of masked context. - Thread types labelled from the opening post with Claude Haiku.
- Full fine-tune with Unsloth + TRL + FlexAttention on one RTX 3090: packed 4,096-token rows, 16 rows per step (65,536 tokens/step), 7,654 steps, lr 2e-5 cosine with 3% warmup, weight decay 0.01, bf16 compute with fp32 master weights. Completion-only loss: the header conditions and is not predicted. 26 h.
- Final eval loss 1.992 (v1: 2.026 on its own validation set).
Evaluation
Completion perplexity on 4,873 held-out threads (same set for every model), lower is better.
| base | v1 | v2 | |
|---|---|---|---|
| all forum text | 11.11 | 7.08 | 6.81 |
| historia | 11.88 | 7.87 | 7.63 |
| humor | 12.53 | 6.60 | 6.40 |
| debate | 11.42 | 7.24 | 7.01 |
| pregunta | 10.58 | 6.95 | 6.65 |
| general Spanish (control) | 13.19 | 12.82 | 13.03 |
The control row (FineWeb-2 held-out) shows no forgetting of general Spanish. Perplexity does not measure story quality: short replies read well, long opening posts drift after ~150 tokens, as expected from a 1B model.
Limitations
Hobby/research artefact. It writes forum text, including the rude, sexist and otherwise offensive parts of the source. Pseudonymisation covers authors in the thread; a few @mentions of other usernames survived in the training text and the model can produce nickname-like strings. Spanish from Spain, 2018–2019 topics.
Weights are bf16 (2 GB). Base model terms: Gemma Terms of Use.
- Downloads last month
- 26