Tarun Anand commited on
Commit
a6f1db9
1 Parent(s): dd45730
README.md ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Model
2
+ **[`albert-xlarge-v2`](https://huggingface.co/albert-xlarge-v2)** fine-tuned on **[`SQuAD V2`](https://rajpurkar.github.io/SQuAD-explorer/)** using **[`run_squad.py`](https://github.com/huggingface/transformers/blob/master/examples/question-answering/run_squad.py)**
3
+
4
+ ### Training Parameters
5
+ Trained on 4 NVIDIA GeForce RTX 2080 Ti 11Gb
6
+ ```bash
7
+ BASE_MODEL=albert-xlarge-v2
8
+ python run_squad.py \
9
+ --version_2_with_negative \
10
+ --model_type albert \
11
+ --model_name_or_path $BASE_MODEL \
12
+ --output_dir $OUTPUT_MODEL \
13
+ --do_eval \
14
+ --do_lower_case \
15
+ --train_file $SQUAD_DIR/train-v2.0.json \
16
+ --predict_file $SQUAD_DIR/dev-v2.0.json \
17
+ --per_gpu_train_batch_size 3 \
18
+ --per_gpu_eval_batch_size 64 \
19
+ --learning_rate 3e-5 \
20
+ --num_train_epochs 3.0 \
21
+ --max_seq_length 384 \
22
+ --doc_stride 128 \
23
+ --save_steps 2000 \
24
+ --threads 24 \
25
+ --warmup_steps 814 \
26
+ --gradient_accumulation_steps 4 \
27
+ --fp16 \
28
+ --do_train
29
+ ```
30
+
31
+ ### Evaluation
32
+
33
+ Evaluation on the dev set. I did not sweep for best threshold.
34
+
35
+ | | val |
36
+ |-------------------|-------------------|
37
+ | exact | 84.41842836688285 |
38
+ | f1 | 87.4628460501696 |
39
+ | total | 11873.0 |
40
+ | HasAns_exact | 80.68488529014844 |
41
+ | HasAns_f1 | 86.78245127423482 |
42
+ | HasAns_total | 5928.0 |
43
+ | NoAns_exact | 88.1412952060555 |
44
+ | NoAns_f1 | 88.1412952060555 |
45
+ | NoAns_total | 5945.0 |
46
+ | best_exact | 84.41842836688285 |
47
+ | best_exact_thresh | 0.0 |
48
+ | best_f1 | 87.46284605016956 |
49
+ | best_f1_thresh | 0.0 |
50
+
51
+
52
+ ### Usage
53
+
54
+ See [huggingface documentation](https://huggingface.co/transformers/model_doc/albert.html#albertforquestionanswering). Training on `SQuAD V2` allows the model to score if a paragraph contains an answer:
55
+ ```python
56
+ start_scores, end_scores = model(input_ids)
57
+ span_scores = start_scores.softmax(dim=1).log()[:,:,None] + end_scores.softmax(dim=1).log()[:,None,:]
58
+ ignore_score = span_scores[:,0,0] #no answer scores
59
+
60
+ ```
61
+
added_tokens.json ADDED
@@ -0,0 +1 @@
 
1
+ {}
config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "AlbertForQuestionAnswering"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "bos_token_id": 2,
7
+ "classifier_dropout_prob": 0.1,
8
+ "down_scale_factor": 1,
9
+ "embedding_size": 128,
10
+ "eos_token_id": 3,
11
+ "gap_size": 0,
12
+ "hidden_act": "gelu",
13
+ "hidden_dropout_prob": 0.1,
14
+ "hidden_size": 2048,
15
+ "initializer_range": 0.02,
16
+ "inner_group_num": 1,
17
+ "intermediate_size": 8192,
18
+ "layer_norm_eps": 1e-12,
19
+ "max_position_embeddings": 512,
20
+ "model_type": "albert",
21
+ "net_structure_type": 0,
22
+ "num_attention_heads": 16,
23
+ "num_hidden_groups": 1,
24
+ "num_hidden_layers": 24,
25
+ "num_memory_blocks": 0,
26
+ "output_past": true,
27
+ "pad_token_id": 0,
28
+ "type_vocab_size": 2,
29
+ "vocab_size": 30000
30
+ }
eval.csv ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ,val
2
+ exact,84.41842836688285
3
+ f1,87.4628460501696
4
+ total,11873.0
5
+ HasAns_exact,80.68488529014844
6
+ HasAns_f1,86.78245127423482
7
+ HasAns_total,5928.0
8
+ NoAns_exact,88.1412952060555
9
+ NoAns_f1,88.1412952060555
10
+ NoAns_total,5945.0
11
+ best_exact,84.41842836688285
12
+ best_exact_thresh,0.0
13
+ best_f1,87.46284605016956
14
+ best_f1_thresh,0.0
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b759731572f038d3f3d9cb1ef02fac448233dd3d3e4c1b9bfc59e49e87864e5
3
+ size 234922444
special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
1
+ {"bos_token": "[CLS]", "eos_token": "[SEP]", "unk_token": "<unk>", "sep_token": "[SEP]", "pad_token": "<pad>", "cls_token": "[CLS]", "mask_token": "[MASK]"}
spiece.model ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fefb02b667a6c5c2fe27602d28e5fb3428f66ab89c7d6f388e7c8d44a02d0336
3
+ size 760289
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
1
+ {"do_lower_case": true, "max_len": 512, "init_inputs": []}
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c32566fecd5fffd748f6ab2d71404c2a42d714391eaca4453d3e16c2da226284
3
+ size 1418