BaşlayınÜcretsiz Başlayın

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.

Bu egzersiz

Working with Hugging Face

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Create a text classification QNLI pipeline using the model "cross-encoder/qnli-electra-base" and save as classifier.
  • Use this classifier to determine if the text provides enough information to answer the question.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# 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)
Kodu Düzenle ve Çalıştır