Views
No views yet
| 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
10python run_squad.py \
11 --model_type bert \
12 --model_name_or_path bert-base-uncased \
13 --do_train \
14 --do_eval \
15 --do_lower_case \
16 --train_file train-v1.1.json \
17 --predict_file dev-v1.1.json \
18 --per_gpu_train_batch_size 12 \
19 --per_gpu_eval_batch_size=16 \
20 --learning_rate 3e-5 \
21 --num_train_epochs 2.0 \
22 --max_seq_length 320 \
23 --doc_stride 128 \
24 --data_dir data \
25 --output_dir data/bert-base-uncased-squad-v1 2>&1 | tee train-energy-bert-base-squad-v1.log418M| Metric | # Value | # Original (Table 2) |
|---|---|---|
| EM | 80.9 | 80.8 |
| F1 | 88.2 | 88.5 |
1from transformers import pipeline
2
3qa_pipeline = pipeline(
4 "question-answering",
5 model="csarron/bert-base-uncased-squad-v1",
6 tokenizer="csarron/bert-base-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.8730505704879761, 'start': 23, 'end': 39, 'answer': 'February 7, 2016'}Made with ❤️ in New York.