File size: 1,349 Bytes
c98408d
2b91529
 
 
 
c98408d
2b91529
 
 
 
 
c98408d
2b91529
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
language:
- en
tags:
- question-answering
license: apache-2.0
datasets:
- trivia_qa
metrics:
- f1
- exact_match
---

# BERT Base Uncased Finetuned on TriviaQA

The BERT (Base) model is finetuned on the TriviaQA dataset using a modified version of the `run_squad.py` legacy script in Transformers.

```bash
$ cd ~/projects/transformers/examples/legacy/question-answering
$ mkdir bert_base_uncased_finetuned_triviaqa
python run_triviaqa.py \
        --model_type bert \
        --model_name_or_path "bert-base-uncased" \
        --do_train \
        --do_eval \
        --do_lower_case \
        --num_train_epochs 2 \
        --per_gpu_train_batch_size 8 \
        --per_gpu_eval_batch_size 32 \
        --max_seq_length 384 \
        --max_grad_norm inf\
        --doc_stride 128 \
        --train_file "~/projects/data/triviaqa/squad-triviaqa-wikipedia-train.json" \
        --predict_file "~/projects//data/triviaqa/squad-triviaqa-wikipedia-dev.json" \
        --output_dir "./bert_base_uncased_finetuned_triviaqa" \
        --save_steps 50000
```

Results:

```bash
{'exact': 55.57530864197531, 'f1': 61.37345358329793, 'total': 10125, 'HasAns_exact': 55.57530864197531, 'HasAns_f1': 61.37345358329793, 'HasAns_total': 10125, 'best_exact': 55.57530864197531, 'best_exact_thresh': 0.0, 'best_f1': 61.37345358329793, 'best_f1_thresh': 0.0}
```