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.
Deze oefening maakt deel uit van de cursus
Working with Hugging Face
Oefeninstructies
- 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.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# 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)