# Pipeline text classification with two sequences for each example

**URL:** <https://discuss.huggingface.co/t/pipeline-text-classification-with-two-sequences-for-each-example/15083>\
**Category:** 🤗Transformers\
**Created:** [February 23, 2022, 7:50pm UTC](https://discuss.huggingface.co/t/pipeline-text-classification-with-two-sequences-for-each-example/15083 "2022-02-23T19:50:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![blemi](https://avatars.discourse-cdn.com/v4/letter/b/cc9497/32.png) [@blemi](https://discuss.huggingface.co/u/blemi)\
**Post date:** [February 23, 2022, 7:50pm UTC](https://discuss.huggingface.co/t/pipeline-text-classification-with-two-sequences-for-each-example/15083/1 "2022-02-23T19:50:45Z")

</div>

Hello, I am trying to figure out how to use pipelines for inference when I have two input sequences per example for tasks like entailment.

I’m training a binary sequence classifier that takes two input sequences. Example:

```auto
{
    "sequence_a": "There are no giraffes in Canada.",
    "sequence_b": "Giraffes are only native to a handful of countries in Africa."
}

```

Is this possible?

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![blemi](https://avatars.discourse-cdn.com/v4/letter/b/cc9497/32.png) [@blemi](https://discuss.huggingface.co/u/blemi)\
**Post date:** [February 23, 2022, 9:20pm UTC](https://discuss.huggingface.co/t/pipeline-text-classification-with-two-sequences-for-each-example/15083/2 "2022-02-23T21:20:24Z")

</div>

I’ve resolved this by creating my own `Pipeline` class. Curious to know if there is another way to do this though.

---

<div class="post-metadata">

**Author:** ![merve](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/merve/32/49809_2.png) [@merve](https://discuss.huggingface.co/u/merve)\
**Post date:** [February 24, 2022, 10:50am UTC](https://discuss.huggingface.co/t/pipeline-text-classification-with-two-sequences-for-each-example/15083/3 "2022-02-24T10:50:05Z")

</div>

Hello and welcome to the forum 🤗  
You can just pass two sentences like this in the input:  
“There are no giraffes in Canada. There are no giraffes in Canada are only native to a handful of countries in Africa.” like in the inference API widget. I know it’s will not work for when you want to do this beyond the sentences (e.g. two paragraphs) so I raised it.
