# TemplateProcessing for encoder-decoder

**URL:** <https://discuss.huggingface.co/t/templateprocessing-for-encoder-decoder/26135>\
**Category:** 🤗Tokenizers\
**Created:** [November 16, 2022, 12:30am UTC](https://discuss.huggingface.co/t/templateprocessing-for-encoder-decoder/26135 "2022-11-16T00:30:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![astariul](https://avatars.discourse-cdn.com/v4/letter/a/2acd7d/32.png) [@astariul](https://discuss.huggingface.co/u/astariul)\
**Post date:** [November 16, 2022, 12:30am UTC](https://discuss.huggingface.co/t/templateprocessing-for-encoder-decoder/26135/1 "2022-11-16T00:30:47Z")

</div>

I’ve seen the docs on how to define the encoding format with `TemplateProcessing`. For example for BERT it would be :

```python
from tokenizers.processors import TemplateProcessing

tokenizer.post_processor = TemplateProcessing(
    single="[CLS] $A [SEP]",
    pair="[CLS] $A [SEP] $B:1 [SEP]:1",
    special_tokens=[("[CLS]", 1), ("[SEP]", 0)],
)

```

* * *

But what about encoder-decoder ? What I want to achieve is :

- The encoder get a sentence with CLS and SEP : `<cls> sen1 <sep>`
- The decoder get a sentence with BOS and EOS : `<s> sen2 </s>`

I call my tokenizer like : `x = tokenizer([sen1], text_target=[sen2])`

So my question is : **how can I define `TemplateProcessing` to achieve this kind of format ?**
