Pengcheng He commited on
Commit
14809e4
1 Parent(s): 482677d

Add deberta xsmall model with 22M backbone parameters

Browse files
Files changed (5) hide show
  1. README.md +99 -0
  2. config.json +22 -0
  3. pytorch_model.bin +3 -0
  4. spm.model +3 -0
  5. tokenizer_config.json +4 -0
README.md ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ tags:
4
+ - deberta
5
+ - deberta-v3
6
+ thumbnail: https://huggingface.co/front/thumbnails/microsoft.png
7
+ license: mit
8
+ ---
9
+
10
+ ## DeBERTaV3: Improving DeBERTa using ELECTRA-Style Pre-Training with Gradient-Disentangled Embedding Sharing
11
+
12
+ [DeBERTa](https://arxiv.org/abs/2006.03654) improves the BERT and RoBERTa models using disentangled attention and enhanced mask decoder. With those two improvements, DeBERTa out perform RoBERTa on a majority of NLU tasks with 80GB training data.
13
+
14
+ In [DeBERTa V3](https://arxiv.org/abs/2111.09543), we further improved the efficiency of DeBERTa using ELECTRA-Style pre-training with Gradient Disentangled Embedding Sharing. Compared to DeBERTa, our V3 version significantly improves the model performance on downstream tasks. You can find more technique details about the new model from our [paper](https://arxiv.org/abs/2111.09543).
15
+
16
+ Please check the [official repository](https://github.com/microsoft/DeBERTa) for more implementation details and updates.
17
+
18
+ The DeBERTa V3 xsmall model comes with 12 layers and a hidden size of 384. Its backbone parameter number is 22M with a vocabulary containing 128K tokens which introduce 48M parameters in the Embedding layer. This model was trained using the 160GB data as DeBERTa V2.
19
+
20
+
21
+ #### Fine-tuning on NLU tasks
22
+
23
+ We present the dev results on SQuAD 2.0 and MNLI tasks.
24
+
25
+ | Model |Vocabulary(K)|Backbone #Params(M)| SQuAD 2.0(F1/EM) | MNLI-m/mm(ACC)|
26
+ |-------------------|----------|-------------------|-----------|----------|
27
+ | RoBERTa-base |50 |86 | 83.7/80.5 | 87.6/- |
28
+ | XLNet-base |32 |92 | -/80.2 | 86.8/- |
29
+ | ELECTRA-base |30 |86 | -/- | - |
30
+ | DeBERTa-base |50 |100 | 86.2/83.1| 88.8/- |
31
+ | DeBERTa-v3-large|128|304 | | - |
32
+ | DeBERTa-v3-base |128|86 | - | - |
33
+ | DeBERTa-v3-small |128|44 | -/- | 88.3/87.7|
34
+ | **DeBERTa-v3-xsmall** |128|**22** | 84.8/82.0 | 88.1/88.3|
35
+ | DeBERTa-v3-xsmall+SiFT|128|22 | -/- | 88.4/88.5|
36
+
37
+
38
+ [#| ELECTRA-small |30 |9.6 | - | - |]::
39
+
40
+ #### Fine-tuning with HF transformers
41
+
42
+ ```bash
43
+ #!/bin/bash
44
+
45
+ cd transformers/examples/pytorch/text-classification/
46
+
47
+ pip install datasets
48
+ export TASK_NAME=mnli
49
+
50
+ output_dir="ds_results"
51
+
52
+ num_gpus=8
53
+
54
+ batch_size=8
55
+
56
+ python -m torch.distributed.launch --nproc_per_node=${num_gpus} \
57
+ run_glue.py \
58
+ --model_name_or_path microsoft/deberta-v3-xsmall \
59
+ --task_name $TASK_NAME \
60
+ --do_train \
61
+ --do_eval \
62
+ --evaluation_strategy steps \
63
+ --max_seq_length 256 \
64
+ --warmup_steps 1000 \
65
+ --per_device_train_batch_size ${batch_size} \
66
+ --learning_rate 4.5e-5 \
67
+ --num_train_epochs 3 \
68
+ --output_dir $output_dir \
69
+ --overwrite_output_dir \
70
+ --logging_steps 1000 \
71
+ --logging_dir $output_dir
72
+
73
+ ```
74
+
75
+ ### Citation
76
+
77
+ If you find DeBERTa useful for your work, please cite the following papers:
78
+
79
+ ``` latex
80
+ @misc{he2021debertav3,
81
+ title={DeBERTaV3: Improving DeBERTa using ELECTRA-Style Pre-Training with Gradient-Disentangled Embedding Sharing},
82
+ author={Pengcheng He and Jianfeng Gao and Weizhu Chen},
83
+ year={2021},
84
+ eprint={2111.09543},
85
+ archivePrefix={arXiv},
86
+ primaryClass={cs.CL}
87
+ }
88
+ ```
89
+
90
+ ``` latex
91
+ @inproceedings{
92
+ he2021deberta,
93
+ title={DEBERTA: DECODING-ENHANCED BERT WITH DISENTANGLED ATTENTION},
94
+ author={Pengcheng He and Xiaodong Liu and Jianfeng Gao and Weizhu Chen},
95
+ booktitle={International Conference on Learning Representations},
96
+ year={2021},
97
+ url={https://openreview.net/forum?id=XPZIaotutsD}
98
+ }
99
+ ```
config.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "deberta-v2",
3
+ "attention_probs_dropout_prob": 0.1,
4
+ "hidden_act": "gelu",
5
+ "hidden_dropout_prob": 0.1,
6
+ "hidden_size": 384,
7
+ "initializer_range": 0.02,
8
+ "intermediate_size": 1536,
9
+ "max_position_embeddings": 512,
10
+ "relative_attention": true,
11
+ "position_buckets": 256,
12
+ "norm_rel_ebd": "layer_norm",
13
+ "share_att_key": true,
14
+ "pos_att_type": "p2c|c2p",
15
+ "layer_norm_eps": 1e-7,
16
+ "max_relative_positions": -1,
17
+ "position_biased_input": false,
18
+ "num_attention_heads": 6,
19
+ "num_hidden_layers": 12,
20
+ "type_vocab_size": 0,
21
+ "vocab_size": 128100
22
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e96369113d0ea430d5827a651182f3079438ef1191b608a312b893ce98052c0a
3
+ size 241453931
spm.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c679fbf93643d19aab7ee10c0b99e460bdbc02fedf34b92b05af343b4af586fd
3
+ size 2464616
tokenizer_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "do_lower_case": false,
3
+ "vocab_type": "spm"
4
+ }