Model Pipeline - Question answering
This pipeline takes a question and a related text passage as input. It processes the text to understand the context, then uses a trained model to find the answer to the question within the passage.
Jump into concepts and practice - no test required
This pipeline takes a question and a related text passage as input. It processes the text to understand the context, then uses a trained model to find the answer to the question within the passage.
Loss 1.2 |**** 0.9 |*** 0.7 |** 0.5 |* 0.4 |
| Epoch | Loss ↓ | Accuracy ↑ | Observation |
|---|---|---|---|
| 1 | 1.2 | 0.45 | Model starts learning, loss high, accuracy low |
| 2 | 0.9 | 0.60 | Loss decreases, accuracy improves |
| 3 | 0.7 | 0.70 | Model learns better answer spans |
| 4 | 0.5 | 0.78 | Loss continues to decrease, accuracy rises |
| 5 | 0.4 | 0.82 | Model converges with good performance |
from transformers import pipeline
qa = pipeline('question-answering')
context = "The Eiffel Tower is in Paris."
question = "Where is the Eiffel Tower located?"
result = qa(question=question, context=context)
print(result['answer'])
What will be printed?from transformers import pipeline
qa = pipeline('question-answering')
context = "Python is a programming language."
question = "What is Python?"
result = qa(question, context)
print(result['answer'])
What is the error and how to fix it?