Machine Translation Models
Collection
8 items • Updated
How to use techiaith/mt-dspec-health-en-cy with Transformers:
# Use a pipeline as a high-level helper
# Warning: Pipeline type "translation" is no longer supported in transformers v5.
# You must load the model directly (see below) or downgrade to v4.x with:
# 'pip install "transformers<5.0.0'
from transformers import pipeline
pipe = pipeline("translation", model="techiaith/mt-dspec-health-en-cy") # Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("techiaith/mt-dspec-health-en-cy")
model = AutoModelForSeq2SeqLM.from_pretrained("techiaith/mt-dspec-health-en-cy")English-to-Welsh translation model specialised for the health and care domain, built using Marian NMT.
pip install sentencepiece transformers
import transformers
model_id = "techiaith/mt-dspec-health-en-cy"
tokenizer = transformers.AutoTokenizer.from_pretrained(model_id)
model = transformers.AutoModelForSeq2SeqLM.from_pretrained(model_id)
translate = transformers.pipeline("translation", model=model, tokenizer=tokenizer)
result = translate("The patient has a headache.")
print(result[0]["translation_text"])
# Mae gan y claf gur pen.
| Metric | Score |
|---|---|
| SacreBLEU | 54.16 |
| CER | 0.31 |
| WER | 0.47 |
| CHRF | 69.03 |
2026-02-26: Re-converted with weight tying fix. The previous version required
transformers<=4.30.2 due to issue #26271.
This version works with all transformers versions.
Apache 2.0