rajpurkar/squad
Viewer • Updated • 98.2k • 164k • 891
How to use real-jiakai/my_awesome_qa_model with Transformers:
# Use a pipeline as a high-level helper
# Warning: Pipeline type "question-answering" is no longer supported in transformers v5.
# You must load the model directly (see below) or downgrade to v4.x with:
# pip install "transformers<5.0.0"
from transformers import pipeline
pipe = pipeline("question-answering", model="real-jiakai/my_awesome_qa_model") # pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForQuestionAnswering
tokenizer = AutoTokenizer.from_pretrained("real-jiakai/my_awesome_qa_model")
model = AutoModelForQuestionAnswering.from_pretrained("real-jiakai/my_awesome_qa_model", device_map="auto")This model is a fine-tuned version of distilbert-base-uncased, trained on the SQuAD v1.1 dataset.
It achieved the following results on the validation set:
from transformers import pipeline
# Load the model
question_answerer = pipeline(
"question-answering",
model="real-jiakai/my_awesome_qa_model",
tokenizer="real-jiakai/my_awesome_qa_model"
)
# English example
context_en = """
Donald Trump was the 45th president of the United States, serving from 2017 to 2021.
"""
question_en = "Who was the 45th president of the United States?"
result_en = question_answerer(question=question_en, context=context_en)
print("Answer:", result_en['answer'])
This model is licensed under the MIT License.
If you use this model in your work, please cite:
@misc{my_awesome_qa_model,
author = {real-jiakai},
title = {my_awesome_qa_model},
year = {2024},
url = {https://huggingface.co/real-jiakai/my_awesome_qa_model},
publisher = {Hugging Face}
}
Base model
distilbert/distilbert-base-uncased