ekurtic commited on
Commit
a767c24
1 Parent(s): 1c8d33b

Initial commit

Browse files
README.md ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BERT-mini model finetuned with M-FAC
2
+
3
+ This model is finetuned on QNLI dataset with state-of-the-art second-order optimizer M-FAC.
4
+ Check NeurIPS 2021 paper for more details on M-FAC: [https://arxiv.org/pdf/2107.03356.pdf](https://arxiv.org/pdf/2107.03356.pdf).
5
+
6
+ ## Finetuning setup
7
+
8
+ For fair comparison against default Adam baseline, we finetune the model in the same framework as described here [https://github.com/huggingface/transformers/tree/master/examples/pytorch/text-classification](https://github.com/huggingface/transformers/tree/master/examples/pytorch/text-classification) and just swap Adam optimizer with M-FAC.
9
+ Hyperparameters used by M-FAC optimizer:
10
+
11
+ ```bash
12
+ learning rate = 1e-4
13
+ number of gradients = 1024
14
+ dampening = 1e-6
15
+ ```
16
+
17
+ ## Results
18
+
19
+ We share the best model out of 5 runs with the following score on QNLI validation set:
20
+
21
+ ```bash
22
+ accuracy = 83.90
23
+ ```
24
+
25
+ Mean and standard deviation for 5 runs on QNLI validation set:
26
+
27
+ | | Accuracy |
28
+ |:----:|:-----------:|
29
+ | Adam | 83.85 ± 0.10 |
30
+ | M-FAC | 83.70 ± 0.13 |
31
+
32
+ Results can be reproduced by adding M-FAC optimizer code in [https://github.com/huggingface/transformers/blob/master/examples/pytorch/text-classification/run_glue.py](https://github.com/huggingface/transformers/blob/master/examples/pytorch/text-classification/run_glue.py) and running the following bash script:
33
+
34
+ ```bash
35
+ CUDA_VISIBLE_DEVICES=0 python run_glue.py \
36
+ --seed 8276 \
37
+ --model_name_or_path prajjwal1/bert-mini \
38
+ --task_name qnli \
39
+ --do_train \
40
+ --do_eval \
41
+ --max_seq_length 128 \
42
+ --per_device_train_batch_size 32 \
43
+ --learning_rate 1e-4 \
44
+ --num_train_epochs 5 \
45
+ --output_dir out_dir/ \
46
+ --optim MFAC \
47
+ --optim_args '{"lr": 1e-4, "num_grads": 1024, "damp": 1e-6}'
48
+ ```
49
+
50
+ We believe these results could be improved with modest tuning of hyperparameters: `per_device_train_batch_size`, `learning_rate`, `num_train_epochs`, `num_grads` and `damp`. For the sake of fair comparison and a robust default setup we use the same hyperparameters across all models (`bert-tiny`, `bert-mini`) and all datasets (SQuAD version 2 and GLUE).
51
+
52
+ ## BibTeX entry and citation info
53
+
54
+ ```bibtex
55
+ @article{DBLP:journals/corr/abs-2107-03356,
56
+ author = {Elias Frantar and
57
+ Eldar Kurtic and
58
+ Dan Alistarh},
59
+ title = {Efficient Matrix-Free Approximations of Second-Order Information,
60
+ with Applications to Pruning and Optimization},
61
+ journal = {CoRR},
62
+ volume = {abs/2107.03356},
63
+ year = {2021},
64
+ url = {https://arxiv.org/abs/2107.03356},
65
+ eprinttype = {arXiv},
66
+ eprint = {2107.03356},
67
+ timestamp = {Tue, 20 Jul 2021 15:08:33 +0200},
68
+ biburl = {https://dblp.org/rec/journals/corr/abs-2107-03356.bib},
69
+ bibsource = {dblp computer science bibliography, https://dblp.org}
70
+ }
71
+
72
+ ```
config.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "prajjwal1/bert-mini",
3
+ "architectures": [
4
+ "BertForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "classifier_dropout": null,
8
+ "finetuning_task": "qnli",
9
+ "gradient_checkpointing": false,
10
+ "hidden_act": "gelu",
11
+ "hidden_dropout_prob": 0.1,
12
+ "hidden_size": 256,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 1024,
15
+ "layer_norm_eps": 1e-12,
16
+ "max_position_embeddings": 512,
17
+ "model_type": "bert",
18
+ "num_attention_heads": 4,
19
+ "num_hidden_layers": 4,
20
+ "pad_token_id": 0,
21
+ "position_embedding_type": "absolute",
22
+ "problem_type": "single_label_classification",
23
+ "torch_dtype": "float32",
24
+ "transformers_version": "4.10.0.dev0",
25
+ "type_vocab_size": 2,
26
+ "use_cache": true,
27
+ "vocab_size": 30522
28
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bcdcf4e71fb836081b630fab764f159c479ae0f2d94a6efe5d6314bafd17b4e2
3
+ size 44717063
special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"do_lower_case": true, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": null, "special_tokens_map_file": null, "name_or_path": "prajjwal1/bert-mini", "do_basic_tokenize": true, "never_split": null, "tokenizer_class": "BertTokenizer"}
vocab.txt ADDED
The diff for this file is too large to render. See raw diff