Question Natural Language Inference
Another task under the text classification umbrella is Question Natural Language Inference, or QNLI. This checks if a premise contains enough information to answer a posed question, determining whether the answer can be found in the given text.
Performing different tasks with the text-classification pipeline can be done by choosing different models. Each model is trained to predict specific labels and optimized for learning different context within a text.
pipeline from the transformers library is already loaded for you.
Questo esercizio fa parte del corso
Working with Hugging Face
Istruzioni dell'esercizio
- Create a text classification QNLI pipeline using the model
"cross-encoder/qnli-electra-base"and save asclassifier. - Use this classifier to determine if the text provides enough information to answer the question.
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
# Create the pipeline
____ = ____(____=____, ____="cross-encoder/qnli-electra-base")
# Predict the output
____ = ____("Where is the capital of France?, Brittany is known for its stunning coastline.")
print(output)