Views
No views yet
1python transformers/examples/question-answering/run_squad.py \
2 --model_type roberta \
3 --model_name_or_path 'nyu-mll/roberta-base-1B-1' \
4 --do_eval \
5 --do_train \
6 --do_lower_case \
7 --train_file /content/dataset/train-v2.0.json \
8 --predict_file /content/dataset/dev-v2.0.json \
9 --per_gpu_train_batch_size 16 \
10 --learning_rate 3e-5 \
11 --num_train_epochs 10 \
12 --max_seq_length 384 \
13 --doc_stride 128 \
14 --output_dir /content/output \
15 --overwrite_output_dir \
16 --save_steps 1000 \
17 --version_2_with_negative| Metric | # Value |
|---|---|
| EM | 64.86 |
| F1 | 68.99 |
1{
2'exact': 64.86145034953255,
3'f1': 68.9902640378272,
4'total': 11873,
5'HasAns_exact': 64.03508771929825,
6'HasAns_f1': 72.3045554860189,
7'HasAns_total': 5928,
8'NoAns_exact': 65.68544995794785,
9'NoAns_f1': 65.68544995794785,
10'NoAns_total': 5945,
11'best_exact': 64.86987282068559,
12'best_exact_thresh': 0.0,
13'best_f1': 68.99868650898054,
14'best_f1_thresh': 0.0
15}1from transformers import pipeline
2
3QnA_pipeline = pipeline('question-answering', model='mrm8488/roberta-base-1B-1-finetuned-squadv2')
4
5QnA_pipeline({
6 'context': 'A new strain of flu that has the potential to become a pandemic has been identified in China by scientists.',
7 'question': 'What has been discovered by scientists from China ?'
8})
9# Output:
10
11{'answer': 'A new strain of flu', 'end': 19, 'score': 0.7145650685380576,'start': 0}