# Trainer for MT with source and target tokenizers

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrainer-for-mt-with-source-and-target-tokenizers%2F42669%3E%5C
**Category:** Intermediate\
**Created:** [June 9, 2023, 3:12pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrainer-for-mt-with-source-and-target-tokenizers%2F42669 "2023-06-09T15:12:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcmcmcmc](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mcmcmcmc/32/16717_2.png) [@mcmcmcmc](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fmcmcmcmc)%5C
**Post date:** [June 9, 2023, 3:12pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrainer-for-mt-with-source-and-target-tokenizers%2F42669%2F1 "2023-06-09T15:12:11Z")

</div>

I’m looking for examples of using HuggingFace’s Trainer with different source and target tokenizers for NMT. I see there is a as\_target\_tokenizer context available, but I could not find how to specify the tokenizers in the configuration.

To be specific, I have an EN-JP translation task that I want to train with HuggingFace’s Trainer. I have a HuggingFace tokenizer trained for EN and JP (separately) and I want to use them to train a vanilla seq2seq transformer model. What is the best way to set up this configuration?

I was able to find the fine-tuning T5 for EN-FR example ([Translation](https://huggingface.co/docs/transformers/tasks/translation#translation)), which seems to have a PreTrainedTokenizer that has a source and target tokenizer, but I could not find a good way to do this from scratch, where I provide the (non-pretrained) model, tokenizers, and data.

Any help would be appreciated.
