Zero shot classification pipeline customization
I am using the pipeline for zero shot text classification. I am using a fine-tuned version offacebook/bart-large-mnlimodel.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?
2022-04-25T12:47:36Z
HelloYou can check the input parameters to call zero shot text classification pipelinehere. Let me know if it helps
2022-04-27T03:39:25Z
The parameter to convert labels to hypothesis ishypothesis_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 ispurchase. The hypothesis would be “This text is about purchase”.Another label isok. 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