Back to all models
question-answering mask_token: [MASK]
Context
Query this model
🔥 This model is currently loaded and running on the Inference API. ⚠️ This model could not be loaded by the inference API. ⚠️ This model can be loaded on the Inference API on-demand.
JSON Output
API endpoint
								$
								curl -X POST \
-H "Content-Type: application/json" \
-d '{"question": "Where does she live?", "context": "She lives in Berlin."}' \
https://api-inference.huggingface.co/models/NeuML/bert-small-cord19qa
Share Copied link to clipboard

Monthly model downloads

NeuML/bert-small-cord19qa NeuML/bert-small-cord19qa
1,980 downloads
last 30 days

pytorch

tf

Contributed by

NeuML company
1 team member · 3 models

How to use this model directly from the 🤗/transformers library:

			
Copy to clipboard
from transformers import AutoTokenizer, AutoModelForQuestionAnswering tokenizer = AutoTokenizer.from_pretrained("NeuML/bert-small-cord19qa") model = AutoModelForQuestionAnswering.from_pretrained("NeuML/bert-small-cord19qa")

BERT-Small fine-tuned on CORD-19 QA dataset

bert-small-cord19-squad model fine-tuned on the CORD-19 QA dataset.

CORD-19 QA dataset

The CORD-19 QA dataset is a SQuAD 2.0 formatted list of question, context, answer combinations covering the CORD-19 dataset.

Building the model

python run_squad.py \
    --model_type bert \
    --model_name_or_path bert-small-cord19-squad \
    --do_train \
    --do_lower_case \
    --version_2_with_negative \
    --train_file cord19-qa.json \
    --per_gpu_train_batch_size 8 \
    --learning_rate 5e-5 \
    --num_train_epochs 10.0 \
    --max_seq_length 384 \
    --doc_stride 128 \
    --output_dir bert-small-cord19qa \
    --save_steps 0 \
    --threads 8 \
    --overwrite_cache \
    --overwrite_output_dir

Testing the model

Example usage below:

from transformers import pipeline

qa = pipeline(
    "question-answering",
    model="NeuML/bert-small-cord19qa",
    tokenizer="NeuML/bert-small-cord19qa"
)

qa({
    "question": "What is the median incubation period?",
    "context": "The incubation period is around 5 days (range: 4-7 days) with a maximum of 12-13 day"
})

qa({
    "question": "What is the incubation period range?",
    "context": "The incubation period is around 5 days (range: 4-7 days) with a maximum of 12-13 day"
})

qa({
    "question": "What type of surfaces does it persist?",
    "context": "The virus can survive on surfaces for up to 72 hours such as plastic and stainless steel ."
})
{"score": 0.5970273583242793, "start": 32, "end": 38, "answer": "5 days"}
{"score": 0.999555868193891, "start": 39, "end": 56, "answer": "(range: 4-7 days)"}
{"score": 0.9992726505196998, "start": 61, "end": 88, "answer": "plastic and stainless steel"}