Introduction

The facebook/wmt19-de-en model is a German-to-English translation model based on the Fairseq WMT19 transformer. It is part of the FSMT (FairSeqMachineTranslation) series and is designed to perform high-quality machine translation tasks.

Architecture

The model is a ported version of Fairseq's WMT19 transformer model which was used for the WMT19 News Translation Task. The architecture involves using a transformer with pretrained weights identical to those released by Fairseq. The abbreviation FSMT stands for FairSeqMachineTranslation.

Training

The model was trained using the WMT19 dataset, and the pretrained weights are directly taken from the original Fairseq model. The evaluation results show a BLEU score of 41.35 for the German-to-English translation task. This is slightly lower than the Fairseq-reported score due to the absence of model ensemble and re-ranking features in the current implementation.

Guide: Running Locally

To run the model locally, you need to install the transformers library and load the model using the following code:

from transformers import FSMTForConditionalGeneration, FSMTTokenizer

mname = "facebook/wmt19-de-en"
tokenizer = FSMTTokenizer.from_pretrained(mname)
model = FSMTForConditionalGeneration.from_pretrained(mname)

input = "Maschinelles Lernen ist großartig, oder?"
input_ids = tokenizer.encode(input, return_tensors="pt")
outputs = model.generate(input_ids)
decoded = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(decoded)  # Output: Machine learning is great, isn't it?

Suggested Cloud GPUs

For efficient execution, consider using cloud GPU services like AWS EC2, Google Cloud Platform, or Azure to handle the intensive computations required for model inference.

License

The facebook/wmt19-de-en model is released under the Apache-2.0 license, allowing for both academic and commercial use.

More Related APIs in Translation