Downloads · 30 days
13
9% of all-time downloads
John-Machado/distilbert-squad-qa
distilbert-squad-qa is a question answering model from John-Machado. Use it when the input is a question plus a passage. It is set up for transformers. The card lists the license as mit.
DistilBERT base uncased fine-tuned on a 5,000-sample subset of SQuAD for extractive question answering.
Downloads · 30 days
13
9% of all-time downloads
All-time downloads
139
Public
Parameters
66.4M
796 MB on disk
Likes
1
Public
Click a slice to open those files.
.pt531 MB · 67%
From the Hugging Face model README
DistilBERT base uncased fine-tuned on a 5,000-sample subset of SQuAD for extractive question answering.
from transformers import AutoTokenizer, AutoModelForQuestionAnswering
import torch
tokenizer = AutoTokenizer.from_pretrained("John-Machado/distilbert-squad-qa")
model = AutoModelForQuestionAnswering.from_pretrained("John-Machado/distilbert-squad-qa")
question = "How many official league titles has Juventus won?"
context = "The club has won 36 official league titles, 14 Coppa Italia titles and nine Supercoppa Italiana titles."
inputs = tokenizer(question, context, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
start = outputs.start_logits.argmax()
end = outputs.end_logits.argmax()
answer = tokenizer.decode(inputs.input_ids[0, start : end + 1])
print(answer) # "36"