# \[new model\] FSMT has been released + 9 models ported

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnew-model-fsmt-has-been-released-9-models-ported%2F1236%3E%5C
**Category:** 🤗Transformers\
**Created:** [September 23, 2020, 7:58pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnew-model-fsmt-has-been-released-9-models-ported%2F1236 "2020-09-23T19:58:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![stas](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/stas/32/19289_2.png) [@stas](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fstas)%5C
**Post date:** [September 23, 2020, 7:58pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnew-model-fsmt-has-been-released-9-models-ported%2F1236%2F1 "2020-09-23T19:58:23Z")

</div>

FSMT (=FairSeq Machine Translation) architecture has been ported from [fairseq wmt19](https://github.com/pytorch/fairseq/tree/master/examples/wmt19).

9 trained models have been ported and made available to everybody:

- [4 wmt19 facebook models](https://huggingface.co/models?filter=facebook&tag=fsmt) (Sergei Edunov, et al)
- [3 wmt16 and 2 wmt19 allenai models](https://huggingface.co/models?filter=allenai&tag=fsmt) (Jungo Kasai, et al)

You will find all the necessary details, including sample code and bleu scores and the scoring code on the model pages.

At the moment only the **translation** part has been thoroughly tested and eval’ed with `sacrebleu`, other parts (training/finetuning/etc.) may or may not work, so if you encounter any problems please file [an issue](https://github.com/huggingface/transformers/issues) and tag @stas00 to it.

It appears to be giving the best score for **en \<=\> ru** and **en \<=\> de** for the current `transformers` models we have (scores acquired using `sacrebleu` against the `wmt19` dataset). Metrics on v100 using `SortishSampler` + `--fp16 --bs 64`:

 ![screenshot_9](https://us1.discourse-cdn.com/hellohellohello/original/2X/1/1a11cdda1287d47ec3a7a8dbf566af7a8209dad9.png)

All the credits for the high BLEU scores go to the facebook team who did the original architecture design and massive pretraining.

Our scores are a tad below fairseq’s scores, since `transformers` at the moment doesn’t support model ensemble. So we use the best performing checkpoint.

I’m also working on an article of how the porting process went, so it might help others to do similar work. I will link to it once it’s done.

I want to thank @sshleifer for your incredible support, time and mentorship in this difficult process. Your caring help and encouragement were invaluable to me, Sam! I especially appreciated how every so often you were gently suggesting that I get back to work on this difficult project and not get distracted with multiple minor easy improvements I wanted to make for the `transformers` repo. Thank you.

### Conversion Instructions

This should work for fairseq models with moses+bpe tokenizers:

```bash
export save_dir='cool_new_fr-en'
python src/transformers/convert_fsmt_original_pytorch_checkpoint_to_pytorch.py \
    --fsmt_checkpoint_path path_to_fairseq_model.pt \
    --pytorch_dump_folder_path $save_dir
cp README.md $save_dir/ # model card
transformers-cli upload $save_dir

```

For examples please see these scripts that provide conversion for full sets of models:

- [allenai-wmt19](https://github.com/huggingface/transformers/blob/master/scripts/fsmt/convert-allenai-wmt19.sh)
- [allenai-wmt16](https://github.com/huggingface/transformers/blob/master/scripts/fsmt/convert-allenai-wmt16.sh)
- [facebook-wmt19](https://github.com/huggingface/transformers/blob/master/scripts/fsmt/convert-facebook-wmt19.sh)

---

<div class="post-metadata">

**Author:** ![sshleifer](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sshleifer/32/3304_2.png) [@sshleifer](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsshleifer)%5C
**Post date:** [September 23, 2020, 10:01pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnew-model-fsmt-has-been-released-9-models-ported%2F1236%2F2 "2020-09-23T22:01:43Z")

</div>

Great work stas 🙂 You finished a hard project with great test coverage!

---

<div class="post-metadata">

**Author:** ![valhalla](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/valhalla/32/4179_2.png) [@valhalla](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fvalhalla)%5C
**Post date:** [September 24, 2020, 2:08pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnew-model-fsmt-has-been-released-9-models-ported%2F1236%2F3 "2020-09-24T14:08:34Z")

</div>

@stas and @sshleifer you rock 🔥 . Great work!

---

<div class="post-metadata">

**Author:** ![stas](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/stas/32/19289_2.png) [@stas](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fstas)%5C
**Post date:** [September 25, 2020, 1:45am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnew-model-fsmt-has-been-released-9-models-ported%2F1236%2F5 "2020-09-25T01:45:08Z")

</div>

> [@sshleifer](#):
>
> Great work stas 🙂 You finished a hard project with great test coverage!

Don’t tell anybody, but most of the tests were already written - I just had to tweak the existing ones and I only wrote a few new tests. So the gratitude for the test coverage is to all those who wrote the extensive test suite before me.

In fact, most of the code has already been there, I only had to tweak it here and there, so if someone is planning to do a porting and it looks intimidating, the foundation has been already laid out for you and there are enough ported architectures, so different pieces can be stolen from different existing working models.
