Zero shot classification pipeline customization

I am using the pipeline for zero shot text classification. I am using a fine-tuned version of 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?

Hello :wave:
You can check the input parameters to call zero shot text classification pipeline here. Let me know if it helps :hugs:

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