# TemplateProcessing for encoder-decoder

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftemplateprocessing-for-encoder-decoder%2F26135%3E%5C
**Category:** 🤗Tokenizers\
**Created:** [November 16, 2022, 12:30am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftemplateprocessing-for-encoder-decoder%2F26135 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fastariul)%5C
**Post date:** [November 16, 2022, 12:30am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftemplateprocessing-for-encoder-decoder%2F26135%2F1 "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 ?**
