Views
No views yet
google/mobilebert-uncased on SQuAD2.0.| Dataset | Split | # samples |
|---|---|---|
| SQuAD2.0 | train | 130k |
| SQuAD2.0 | eval | 12.3k |
3.7.5CPU: Intel(R) Core(TM) i7-6800K CPU @ 3.40GHzMemory: 32 GiBGPUs: 2 GeForce GTX 1070, each with 8GiB memoryGPU driver: 418.87.01, CUDA: 10.11# after install https://github.com/huggingface/transformers
2
3cd examples/question-answering
4mkdir -p data
5
6wget -O data/train-v2.0.json https://rajpurkar.github.io/SQuAD-explorer/dataset/train-v2.0.json
7
8wget -O data/dev-v2.0.json https://rajpurkar.github.io/SQuAD-explorer/dataset/dev-v2.0.json
9
10export SQUAD_DIR=`pwd`/data
11
12python run_squad.py \
13 --model_type mobilebert \
14 --model_name_or_path google/mobilebert-uncased \
15 --do_train \
16 --do_eval \
17 --do_lower_case \
18 --version_2_with_negative \
19 --train_file $SQUAD_DIR/train-v2.0.json \
20 --predict_file $SQUAD_DIR/dev-v2.0.json \
21 --per_gpu_train_batch_size 16 \
22 --per_gpu_eval_batch_size 16 \
23 --learning_rate 4e-5 \
24 --num_train_epochs 5.0 \
25 --max_seq_length 320 \
26 --doc_stride 128 \
27 --warmup_steps 1400 \
28 --save_steps 2000 \
29 --output_dir $SQUAD_DIR/mobilebert-uncased-warmup-squad_v2 2>&1 | tee train-mobilebert-warmup-squad_v2.log95M| Metric | # Value | # Original (Table 5) |
|---|---|---|
| EM | 75.2 | 76.2 |
| F1 | 78.8 | 79.2 |
1from transformers import pipeline
2
3qa_pipeline = pipeline(
4 "question-answering",
5 model="csarron/mobilebert-uncased-squad-v2",
6 tokenizer="csarron/mobilebert-uncased-squad-v2"
7)
8
9predictions = qa_pipeline({
10 'context': "The game was played on February 7, 2016 at Levi's Stadium in the San Francisco Bay Area at Santa Clara, California.",
11 'question': "What day was the game played on?"
12})
13
14print(predictions)
15# output:
16# {'score': 0.71434086561203, 'start': 23, 'end': 39, 'answer': 'February 7, 2016'}Made with ❤️ in New York.