# Tokenizer for Translation Pipeline with Bert2Bert EncoderDecoder

**URL:** <https://discuss.huggingface.co/t/tokenizer-for-translation-pipeline-with-bert2bert-encoderdecoder/15089>\
**Category:** Intermediate\
**Created:** [February 23, 2022, 10:23pm UTC](https://discuss.huggingface.co/t/tokenizer-for-translation-pipeline-with-bert2bert-encoderdecoder/15089 "2022-02-23T22:23:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![danringwald](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/danringwald/32/1614_2.png) [@danringwald](https://discuss.huggingface.co/u/danringwald)\
**Post date:** [February 23, 2022, 10:23pm UTC](https://discuss.huggingface.co/t/tokenizer-for-translation-pipeline-with-bert2bert-encoderdecoder/15089/1 "2022-02-23T22:23:47Z")

</div>

Hello,

I would like to build a translation pipeline with a Bert2Bert EncoderDecoder model.

Calling an input tokenizer, then the custom Bert2Bert model, and finally the output tokenizer goes fine. However building a pipeline is very hard because of the tokenizer: the pipeline function accepts only 1 tokenizer:  
generator = pipeline(task=“text-generation”, model=model, tokenizer=tokenizer)

How can I build a “bilingual” BertTokenizerFast which encodes french inputs in regular context, and decodes english targets under the as\_target\_tokenizer() context ? (just like the MarianMT tokenizer)

Any help would be esteemed deeply
