# Zero shot classification pipeline customization

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fzero-shot-classification-pipeline-customization%2F17005%3E%5C
**Category:** Intermediate\
**Created:** [April 20, 2022, 1:51pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fzero-shot-classification-pipeline-customization%2F17005 "2022-04-20T13:51:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShieldHero](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/shieldhero/32/4451_2.png) [@ShieldHero](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FShieldHero)%5C
**Post date:** [April 20, 2022, 1:51pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fzero-shot-classification-pipeline-customization%2F17005%2F1 "2022-04-20T13:51:43Z")

</div>

I am using the pipeline for zero shot text classification. I am using a fine-tuned version of [facebook/bart-large-mnli](https://huggingface.co/facebook/bart-large-mnli) model.

I want to know what is the template used to create hypothesis from label. Is it h = “this text is about {label}”? Is there a way to use my own custom template for this?

---

<div class="post-metadata">

**Author:** ![merve](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/merve/32/49809_2.png) [@merve](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fmerve)%5C
**Post date:** [April 25, 2022, 12:47pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fzero-shot-classification-pipeline-customization%2F17005%2F2 "2022-04-25T12:47:36Z")

</div>

Hello 👋  
You can check the input parameters to call zero shot text classification pipeline [here](https://huggingface.co/docs/transformers/main_classes/pipelines#transformers.ZeroShotClassificationPipeline. __call__ ). Let me know if it helps 🤗

---

<div class="post-metadata">

**Author:** ![ShieldHero](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/shieldhero/32/4451_2.png) [@ShieldHero](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FShieldHero)%5C
**Post date:** [April 27, 2022, 3:39am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fzero-shot-classification-pipeline-customization%2F17005%2F3 "2022-04-27T03:39:25Z")

</div>

The parameter to convert labels to hypothesis is **hypothesis\_template**. This accepts a string and uses the same template for every label. This isn’t optimal for my use case as the labels are very different and I want different hypothesis for them.

For example, one of the labels is _purchase_. The hypothesis would be “This text is about purchase”.  
Another label is _ok_. I want to keep the hypothesis is “ok” as no template seems to fit this(“This text is about ok” doesn’t sound good at all).

For now, I am manually doing the classification, by calling the model in loop(for all intents), then using softmax on entailment/ contradiction, then sorting, and finally taking the best label
