wmt/wmt14
Viewer • Updated • 47.8M • 12.3k • 29
How to use leukas/mt5-large-wmt14-deen 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="leukas/mt5-large-wmt14-deen") # Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("leukas/mt5-large-wmt14-deen")
model = AutoModelForSeq2SeqLM.from_pretrained("leukas/mt5-large-wmt14-deen")This model is released as part of the work from Are Character-level Translations Worth the Wait? Comparing Character- and Subword-level Models for Machine Translation. It is an mT5 model finetuned on German-->English translation the WMT14 dataset.
To use the model correctly, you must prepend the prompt with "translate X to Y: ", where X and Y are your source and target languages (e.g. German, English).
NOTE: The decoder_start_token_id is 259 for byt5 models and 250099 for mt5 models, which is different from the default token from google's byt5 and mt5 models (which is 0).