Views
No views yet
google/mobilebert-uncased on SQuAD1.1.| Dataset | Split | # samples |
|---|---|---|
| SQuAD1.1 | train | 90.6K |
| SQuAD1.1 | eval | 11.1k |
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-v1.1.json https://rajpurkar.github.io/SQuAD-explorer/dataset/train-v1.1.json
7
8wget -O data/dev-v1.1.json https://rajpurkar.github.io/SQuAD-explorer/dataset/dev-v1.1.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 --train_file $SQUAD_DIR/train-v1.1.json \
19 --predict_file $SQUAD_DIR/dev-v1.1.json \
20 --per_gpu_train_batch_size 16 \
21 --per_gpu_eval_batch_size 16 \
22 --learning_rate 4e-5 \
23 --num_train_epochs 5.0 \
24 --max_seq_length 320 \
25 --doc_stride 128 \
26 --warmup_steps 1400 \
27 --output_dir $SQUAD_DIR/mobilebert-uncased-warmup-squad_v1 2>&1 | tee train-mobilebert-warmup-squad_v1.log95M| Metric | # Value | # Original (Table 5) |
|---|---|---|
| EM | 82.6 | 82.9 |
| F1 | 90.0 | 90.0 |
1from transformers import pipeline
2
3qa_pipeline = pipeline(
4 "question-answering",
5 model="csarron/mobilebert-uncased-squad-v1",
6 tokenizer="csarron/mobilebert-uncased-squad-v1"
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.7754058241844177, 'start': 23, 'end': 39, 'answer': 'February 7, 2016'}Made with ❤️ in New York.