# How can we customize pipeline?

**URL:** <https://discuss.huggingface.co/t/how-can-we-customize-pipeline/3226>\
**Category:** 🤗Transformers\
**Created:** [January 16, 2021, 10:08am UTC](https://discuss.huggingface.co/t/how-can-we-customize-pipeline/3226 "2021-01-16T10:08:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![s4sarath](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@s4sarath](https://discuss.huggingface.co/u/s4sarath)\
**Post date:** [January 16, 2021, 10:08am UTC](https://discuss.huggingface.co/t/how-can-we-customize-pipeline/3226/1 "2021-01-16T10:08:36Z")

</div>

How pipeline handles custom pre-processing or post-processing. For example, different doc\_stride, max\_seq\_length in Question Answering?

---

<div class="post-metadata">

**Author:** ![jominmathew](https://avatars.discourse-cdn.com/v4/letter/j/76d3ee/32.png) [@jominmathew](https://discuss.huggingface.co/u/jominmathew)\
**Post date:** [January 19, 2021, 6:06am UTC](https://discuss.huggingface.co/t/how-can-we-customize-pipeline/3226/2 "2021-01-19T06:06:49Z")

</div>

I dont think that is possible. But lets hear from someone experienced.

---

<div class="post-metadata">

**Author:** ![valhalla](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/valhalla/32/4179_2.png) [@valhalla](https://discuss.huggingface.co/u/valhalla)\
**Post date:** [January 19, 2021, 6:15am UTC](https://discuss.huggingface.co/t/how-can-we-customize-pipeline/3226/3 "2021-01-19T06:15:45Z")

</div>

Hi @s4sarath

it’s possible to pass different `doc_stride`, `max_seq_length` etc directly to the ` __call__ ` method, i.e when calling the pipeline, have a look at the docstring of ` __call__ ` of QA pipeline [here](https://huggingface.co/transformers/main_classes/pipelines.html#transformers.QuestionAnsweringPipeline. __call__ )

---

<div class="post-metadata">

**Author:** ![s4sarath](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@s4sarath](https://discuss.huggingface.co/u/s4sarath)\
**Post date:** [January 19, 2021, 10:34am UTC](https://discuss.huggingface.co/t/how-can-we-customize-pipeline/3226/4 "2021-01-19T10:34:15Z")

</div>

Agree. But I am asking more of like a custom preprocessing. Let’s say I want to add token type I’d 2 to question and 0s to context .

---

<div class="post-metadata">

**Author:** ![valhalla](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/valhalla/32/4179_2.png) [@valhalla](https://discuss.huggingface.co/u/valhalla)\
**Post date:** [January 19, 2021, 11:18am UTC](https://discuss.huggingface.co/t/how-can-we-customize-pipeline/3226/5 "2021-01-19T11:18:01Z")

</div>

In that case, you could subclass the pipeline to add the custom behavior.

---

<div class="post-metadata">

**Author:** ![s4sarath](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@s4sarath](https://discuss.huggingface.co/u/s4sarath)\
**Post date:** [January 19, 2021, 12:19pm UTC](https://discuss.huggingface.co/t/how-can-we-customize-pipeline/3226/6 "2021-01-19T12:19:19Z")

</div>

That’s what I was looking for .
