rajpurkar/squad
Viewer • Updated • 98.2k • 158k • 891
How to use xichenn/albert-base-v2-squad 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="xichenn/albert-base-v2-squad") # pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForQuestionAnswering
tokenizer = AutoTokenizer.from_pretrained("xichenn/albert-base-v2-squad")
model = AutoModelForQuestionAnswering.from_pretrained("xichenn/albert-base-v2-squad", device_map="auto")# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForQuestionAnswering
tokenizer = AutoTokenizer.from_pretrained("xichenn/albert-base-v2-squad")
model = AutoModelForQuestionAnswering.from_pretrained("xichenn/albert-base-v2-squad", device_map="auto")This model is a fine-tuned version of albert-base-v2 on the SQuAD 1.1 and adversarial_qa datasets. It achieves the following results on the SQuAD 1.1 evaluation set:
You can test the model directly using the Hugging Face Inference API:
from transformers import pipeline
# Load the pipeline
qa_pipeline = pipeline("question-answering", model="xichenn/albert-base-v2-squad")
# Run inference
result = qa_pipeline(question="What is the capital of France?", context="France is a country in Europe. Its capital is Paris.")
print(result)
Base model
albert/albert-base-v2
# 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="xichenn/albert-base-v2-squad")