Using a zero-shot classifier
In this recipe, we will classify a sentence using a zero-shot classifier. There are instances where we do not have the luxury of training a classifier from scratch or using a model that has been trained as per the labels of our data. Zero-shot classification can be used in such scenarios for any team to get up and running quickly. The zero in the terminology means that the classifier has not seen any data (zero samples precisely) from the target dataset that will be used for inference.
Getting ready
As part of this recipe, we will use the pipeline module from the transformers package. You can use the 8.4_Zero_shot_classification.ipynb
notebook from the code site if you need to work from an existing notebook.
How to do it...
In this recipe, we will use a couple of sentences and classify them. We will use our own set of labels for these sentences. We will use the facebook/bart-large-mnli
model for this recipe. This model is suitable for the task...