Yura Kuratov commited on
Commit
e348066
1 Parent(s): 9774ce1

add distilrubert-small-cased-conversational model

Browse files
README.md ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - ru
4
+ ---
5
+ # distilrubert-small-cased-conversational
6
+ Conversational DistilRuBERT-small \(Russian, cased, 2‑layer, 768‑hidden, 12‑heads, 107M parameters\) was trained on OpenSubtitles\[1\], [Dirty](https://d3.ru/), [Pikabu](https://pikabu.ru/), and a Social Media segment of Taiga corpus\[2\] (as [Conversational RuBERT](https://huggingface.co/DeepPavlov/rubert-base-cased-conversational)). It can be considered as small copy of [Conversational DistilRuBERT-base](https://huggingface.co/DeepPavlov/distilrubert-base-cased-conversational).
7
+
8
+ Our DistilRuBERT-small was highly inspired by \[3\], \[4\]. Namely, we used
9
+ * KL loss (between teacher and student output logits)
10
+ * MLM loss (between tokens labels and student output logits)
11
+ * Cosine embedding loss (between averaged six consecutive hidden states from teacher's encoder and one hidden state of the student)
12
+ * MSE loss (between averaged six consecutive attention maps from teacher's encoder and one attention map of the student)
13
+
14
+ The model was trained for about 80 hrs. on 8 nVIDIA Tesla P100-SXM2.0 16Gb.
15
+
16
+ To evaluate improvements in the inference speed, we ran teacher and student models on random sequences with seq_len=512, batch_size = 16 (for throughput) and batch_size=1 (for latency).
17
+ All tests were performed on Intel(R) Xeon(R) CPU E5-2698 v4 @ 2.20GHz and nVIDIA Tesla P100-SXM2.0 16Gb.
18
+
19
+ | Model | Size, Mb. | CPU latency, sec.| GPU latency, sec. | CPU throughput, samples/sec. | GPU throughput, samples/sec. |
20
+ |-------------------------------------------------|------------|------------------|-------------------|------------------------------|------------------------------|
21
+ | Teacher (RuBERT-base-cased-conversational) | 679 | 0.655 | 0.031 | 0.3754 | 36.4902 |
22
+ | Student (DistilRuBERT-small-cased-conversational)| 409 | 0.1656 | 0.015 | 0.9692 | 71.3553 |
23
+
24
+
25
+ To evaluate model quality, we fine-tuned DistilRuBERT-small on classification, NER and question answering tasks. Scores and archives with fine-tuned models can be found in [DeepPavlov docs](http://docs.deeppavlov.ai/en/master/features/overview.html#models). Also, results could be found in the [paper](https://arxiv.org/abs/2205.02340) Tables 1&2 as well as performance benchmarks and training details.
26
+
27
+ # Citation
28
+ If you found the model useful for your research, we are kindly ask to cite [this](https://arxiv.org/abs/2205.02340) paper:
29
+ ```
30
+ @misc{https://doi.org/10.48550/arxiv.2205.02340,
31
+ doi = {10.48550/ARXIV.2205.02340},
32
+ url = {https://arxiv.org/abs/2205.02340},
33
+ author = {Kolesnikova, Alina and Kuratov, Yuri and Konovalov, Vasily and Burtsev, Mikhail},
34
+ keywords = {Computation and Language (cs.CL), Machine Learning (cs.LG), FOS: Computer and information sciences, FOS: Computer and information sciences},
35
+ title = {Knowledge Distillation of Russian Language Models with Reduction of Vocabulary},
36
+ publisher = {arXiv},
37
+ year = {2022},
38
+ copyright = {arXiv.org perpetual, non-exclusive license}
39
+ }
40
+ ```
41
+
42
+ \[1\]: P. Lison and J. Tiedemann, 2016, OpenSubtitles2016: Extracting Large Parallel Corpora from Movie and TV Subtitles. In Proceedings of the 10th International Conference on Language Resources and Evaluation \(LREC 2016\)
43
+
44
+ \[2\]: Shavrina T., Shapovalova O. \(2017\) TO THE METHODOLOGY OF CORPUS CONSTRUCTION FOR MACHINE LEARNING: «TAIGA» SYNTAX TREE CORPUS AND PARSER. in proc. of “CORPORA2017”, international conference , Saint-Petersbourg, 2017.
45
+
46
+ \[3\]: Sanh, V., Debut, L., Chaumond, J., & Wolf, T. \(2019\). DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter. arXiv preprint arXiv:1910.01108.
47
+
48
+ \[4\]: <https://github.com/huggingface/transformers/tree/master/examples/research_projects/distillation>
config.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "distilrubert-tiny-cased-conversational.pth",
3
+ "activation": "gelu",
4
+ "attention_dropout": 0.1,
5
+ "dim": 768,
6
+ "dropout": 0.1,
7
+ "hidden_dim": 3072,
8
+ "initializer_range": 0.02,
9
+ "max_position_embeddings": 512,
10
+ "model_type": "distilbert",
11
+ "n_heads": 12,
12
+ "n_layers": 2,
13
+ "output_attentions": true,
14
+ "output_hidden_states": true,
15
+ "output_past": true,
16
+ "pad_token_id": 0,
17
+ "qa_dropout": 0.1,
18
+ "seq_classif_dropout": 0.2,
19
+ "sinusoidal_pos_embds": false,
20
+ "tie_weights_": true,
21
+ "vocab_size": 119547
22
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a0c3ec312059f7aed902dc1b7440a0624399065ef0954ea10cf901e2306c5ff6
3
+ size 428392490
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": false}
vocab.txt ADDED
The diff for this file is too large to render. See raw diff