julien-c HF staff commited on
Commit
bf74161
1 Parent(s): e40a361

Migrate model card from transformers-repo

Browse files

Read announcement at https://discuss.huggingface.co/t/announcement-all-model-cards-will-be-migrated-to-hf-co-model-repos/2755
Original file history: https://github.com/huggingface/transformers/commits/master/model_cards/NeuML/bert-small-cord19qa/README.md

Files changed (1) hide show
  1. README.md +63 -0
README.md ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BERT-Small fine-tuned on CORD-19 QA dataset
2
+
3
+ [bert-small-cord19-squad model](https://huggingface.co/NeuML/bert-small-cord19-squad2) fine-tuned on the [CORD-19 QA dataset](https://www.kaggle.com/davidmezzetti/cord19-qa?select=cord19-qa.json).
4
+
5
+ ## CORD-19 QA dataset
6
+ The CORD-19 QA dataset is a SQuAD 2.0 formatted list of question, context, answer combinations covering the [CORD-19 dataset](https://www.semanticscholar.org/cord19).
7
+
8
+ ## Building the model
9
+
10
+ ```bash
11
+ python run_squad.py \
12
+ --model_type bert \
13
+ --model_name_or_path bert-small-cord19-squad \
14
+ --do_train \
15
+ --do_lower_case \
16
+ --version_2_with_negative \
17
+ --train_file cord19-qa.json \
18
+ --per_gpu_train_batch_size 8 \
19
+ --learning_rate 5e-5 \
20
+ --num_train_epochs 10.0 \
21
+ --max_seq_length 384 \
22
+ --doc_stride 128 \
23
+ --output_dir bert-small-cord19qa \
24
+ --save_steps 0 \
25
+ --threads 8 \
26
+ --overwrite_cache \
27
+ --overwrite_output_dir
28
+ ```
29
+
30
+ ## Testing the model
31
+
32
+ Example usage below:
33
+
34
+ ```python
35
+ from transformers import pipeline
36
+
37
+ qa = pipeline(
38
+ "question-answering",
39
+ model="NeuML/bert-small-cord19qa",
40
+ tokenizer="NeuML/bert-small-cord19qa"
41
+ )
42
+
43
+ qa({
44
+ "question": "What is the median incubation period?",
45
+ "context": "The incubation period is around 5 days (range: 4-7 days) with a maximum of 12-13 day"
46
+ })
47
+
48
+ qa({
49
+ "question": "What is the incubation period range?",
50
+ "context": "The incubation period is around 5 days (range: 4-7 days) with a maximum of 12-13 day"
51
+ })
52
+
53
+ qa({
54
+ "question": "What type of surfaces does it persist?",
55
+ "context": "The virus can survive on surfaces for up to 72 hours such as plastic and stainless steel ."
56
+ })
57
+ ```
58
+
59
+ ```json
60
+ {"score": 0.5970273583242793, "start": 32, "end": 38, "answer": "5 days"}
61
+ {"score": 0.999555868193891, "start": 39, "end": 56, "answer": "(range: 4-7 days)"}
62
+ {"score": 0.9992726505196998, "start": 61, "end": 88, "answer": "plastic and stainless steel"}
63
+ ```