rajpurkar/squad_v2
Viewer • Updated • 142k • 36.2k • 251
How to use peeyush01/bert-qa-finetuned with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("question-answering", model="peeyush01/bert-qa-finetuned") # Load model directly
from transformers import AutoTokenizer, AutoModelForQuestionAnswering
tokenizer = AutoTokenizer.from_pretrained("peeyush01/bert-qa-finetuned")
model = AutoModelForQuestionAnswering.from_pretrained("peeyush01/bert-qa-finetuned")This model is a fine-tuned version of BERT-base uncased on the SQuAD v2 dataset for extractive question answering.
It was trained for 3 epochs and can answer questions given a context passage, while also handling unanswerable questions (a key feature of SQuAD v2).
You can try the model with the following code:
from transformers import pipeline
qa_pipeline = pipeline("question-answering", model="peeyush01/bert-squad-v2")
result = qa_pipeline({
"context": "Hugging Face is creating a tool that democratizes AI.",
"question": "What is Hugging Face creating?"
})
print(result)
Base model
google-bert/bert-base-uncased