Instructions to use EryriLabs/EryriLabs-cymraeg-12B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use EryriLabs/EryriLabs-cymraeg-12B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="EryriLabs/EryriLabs-cymraeg-12B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("EryriLabs/EryriLabs-cymraeg-12B") model = AutoModelForMultimodalLM.from_pretrained("EryriLabs/EryriLabs-cymraeg-12B", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use EryriLabs/EryriLabs-cymraeg-12B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "EryriLabs/EryriLabs-cymraeg-12B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "EryriLabs/EryriLabs-cymraeg-12B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/EryriLabs/EryriLabs-cymraeg-12B
- SGLang
How to use EryriLabs/EryriLabs-cymraeg-12B 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 "EryriLabs/EryriLabs-cymraeg-12B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "EryriLabs/EryriLabs-cymraeg-12B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "EryriLabs/EryriLabs-cymraeg-12B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "EryriLabs/EryriLabs-cymraeg-12B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use EryriLabs/EryriLabs-cymraeg-12B with Docker Model Runner:
docker model run hf.co/EryriLabs/EryriLabs-cymraeg-12B
EryriLabs Cymraeg 12B
A Welsh fine-tune of Gemma 4 12B. It continues from
EryriLabs/gemma-4-12b-cymraeg-v6:
six further rounds that were never published on their own (v7 to v7.4: spoken Welsh,
yes/no answer forms, mutations, two DPO rounds against refusals and loops), then one more
SFT round, v8, aimed at what v7.4 still got wrong: coarse language, yes/no answers when
told which way to answer, and word and sentence judgements.
This repository has the merged bf16 weights and the last round's LoRA adapter in
adapters/sft-v8. A Q8_0 GGUF is in
EryriLabs/EryriLabs-cymraeg-12B-GGUF.
Load it the same way as v6, with Gemma4UnifiedForConditionalGeneration and transformers
5.15 or newer. The chat template opens the model turn with an empty thought block; use the
template as shipped, with thinking off.
Results
CymraegBench v0.1, run locally on the Q8_0 GGUF with llama.cpp: up to 100 cases per suite, seed 1, temperature 0, thinking off. These are my own runs, not an independent evaluation. v6 is the figure AIsteddfod published.
| v6 (published) | v7.4 | this model | |
|---|---|---|---|
| Overall | 52.70 | 57.87 | 62.36 |
| Welsh reasoning | 54.52 | 57.75 | 60.72 |
| Practical Welsh | 50.89 | 58.00 | 64.00 |
| Legislation translation, BLEU | 52.30 | 50.18 | 48.52 |
| CCC language audit, mean of seven | 72.56 | 71.72 |
Most of the gain over v7.4 is one suite: welsh-obscenities went from 20 to 81, which is
worth 3.4 of the 4.5 points. That suite expects "Y" for every item, so it rewards a model
for recognising coarse words but cannot show whether it also wrongly flags clean ones. On
a balanced held-out set of my own (coarse words against look-alikes and neutral words) the
model scores 73%, up from 60%. Other changes: welsh-yes-no 56 to 64, welsh-lexicon 87 to
92, piqa 64 to 70, arc-welsh-easy 74 to 79. Per-suite tables are in
eval/cymraegbench-v0.1/.
Where it is weaker
- welsh-toxigen fell from 82 to 72 and welsh-grammar from 63 to 55. On my own held-out grammar set the model is only a little above chance (58%).
- Legislation translation BLEU dropped by 1.7, and place names are still very poor (5).
- Maths without working is weak (mgsm-cy 26).
- It invents facts freely and is better at short spoken replies than long explanations; v6's card describes the same limits.
I looked at CymraegBench results between rounds to decide what data to build, so the model is tuned towards the kinds of task that benchmark asks. No benchmark item was used in training: every generator loads the relevant suite and drops any matching word, sentence, question or place name, and the translated sets come from the train splits of datasets whose test splits the benchmark uses.
Training
v8 is one epoch of QLoRA on the merged v7.4 weights: 4-bit base, rank 32, alpha 32, on the attention and MLP projections of the language model, learning rate 5e-5 with cosine decay and 3% warmup, effective batch 16, loss on the final assistant turn. 16,972 rows on one RTX 3090 in about two hours.
| Rows | What | Source |
|---|---|---|
| 3,000 | replay of the v7.4 round | as for v7.4 |
| 3,000 | general instructions | BangorAI/alpaca-cy-1 (CC-BY-NC-4.0) |
| 2,400 | yes/no answers with a stated polarity | generated (mine) |
| 2,000 | grammatical or not | Senedd record (OGL v3), Cardiff University TM (CC-BY-4.0), own sentences, one error put in by rule |
| 1,600 | swearing and coarse slang | hand-compiled list (mine), checked against CC0 transcripts |
| 1,500 | is this a Welsh word | techiaith/lecsicon-cymraeg-bangor (CC0) and generated non-words |
| 1,500 | NLI | nyu-mll/multi_nli train, fiction genre left out, machine translated |
| 1,000 | maths word problems | openai/gsm8k train (MIT), machine translated |
| 372 | Welsh place names | Welsh Language Commissioner, Standard Welsh Place-names (OGL v3) |
| 800 | output formats, context-grounded answers | generated; Stop! Think Fraud Welsh pages (OGL v3) |
The NLI and maths rows were translated from English by an automated pipeline and filtered by rule. An automated review of a 70-row sample found about 3% with a broken answer and about 30% with minor wording faults. No Welsh speaker has reviewed them, and the list of coarse words has not had a native review either.
The v7.4 weights this round started from were rebuilt from v6 and the six round adapters. The rebuilt model gives the same answer as the original v7.4 GGUF on 96.9% of 1,758 held-out prompts.
Licence and attribution
CC-BY-NC-4.0, non-commercial use only. v6 and the Gemma 4 12B base are Apache-2.0, but the v7 to v7.4 rounds and this one trained on BangorAI/alpaca-cy-1, which is CC-BY-NC-4.0, so these weights carry the same restriction. Contains public sector information licensed under the Open Government Licence v3.0 (Senedd Cymru record of proceedings; Welsh Language Commissioner place-names list, which contains OS data, Crown copyright and database right 2024). MultiNLI is by Williams, Nangia and Bowman (2018), used under the OANC terms and CC-BY 3.0. Cardiff University translation memories are CC-BY-4.0. Diolch to techiaith and Bangor University for the open Welsh data this rests on.
- Downloads last month
- 75
Model tree for EryriLabs/EryriLabs-cymraeg-12B
Base model
EryriLabs/gemma-4-12b-cymraeg-v6