Yura Kuratov
commited on
Commit
•
b81d591
1
Parent(s):
d34c9b6
add tiny-5k model
Browse files- README.md +69 -0
- config.json +9 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +1 -0
- tokenizer_config.json +1 -0
- vocab.txt +0 -0
README.md
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- ru
|
4 |
+
---
|
5 |
+
# distilrubert-tiny-cased-conversational-5k
|
6 |
+
Conversational DistilRuBERT-tiny-5k \(Russian, cased, 3‑layers, 264‑hidden, 12‑heads, 3.6M parameters, 5k vocab\) 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)).
|
7 |
+
|
8 |
+
Our DistilRuBERT-tiny-5k is highly inspired by \[3\], \[4\] and architecture is very close to \[5\]. Namely, we use
|
9 |
+
* MLM loss (between token labels and student output distribution)
|
10 |
+
* KL loss (between averaged student and teacher hidden states)
|
11 |
+
|
12 |
+
The key feature is:
|
13 |
+
* reduced vocabulary size (5K vs 30K in *tiny* vs. 100K in *base* and *small*)
|
14 |
+
|
15 |
+
Here is comparison between teacher model (`Conversational RuBERT`) and other distilled models.
|
16 |
+
|
17 |
+
| Model name | \# params, M | \# vocab, K | Mem., MB |
|
18 |
+
|---|---|---|---|
|
19 |
+
| `rubert-base-cased-conversational` | 177.9 | 120 | 679 |
|
20 |
+
| `distilrubert-base-cased-conversational` | 135.5 | 120 | 517 |
|
21 |
+
| `distilrubert-small-cased-conversational` | 107.1 | 120 | 409 |
|
22 |
+
| `cointegrated/rubert-tiny` | 11.8 | 30 | 46 |
|
23 |
+
| `cointegrated/rubert-tiny2` | 29.3 | 84 | 112 |
|
24 |
+
| `distilrubert-tiny-cased-conversational-v1` | 10.4 | 31 | 41 |
|
25 |
+
| `distilrubert-tiny-cased-conversational-5k` | **3.6** | 5 | **14** |
|
26 |
+
|
27 |
+
|
28 |
+
DistilRuBERT-tiny was trained for about 100 hrs. on 7 nVIDIA Tesla P100-SXM2.0 16Gb.
|
29 |
+
|
30 |
+
We used `PyTorchBenchmark` from `transformers` to evaluate model's performance and compare it with other pre-trained language models for Russian. All tests were performed on NVIDIA GeForce GTX 1080 Ti and Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
|
31 |
+
|
32 |
+
| Model name | Batch size | Seq len | Time, s || Mem, MB ||
|
33 |
+
|---|---|---|------||------||
|
34 |
+
| | | | CPU | GPU | CPU | GPU |
|
35 |
+
| `rubert-base-cased-conversational` | 16 | 512 | 5.283 | 0.1866 | 1550 | 1938 |
|
36 |
+
| `distilrubert-base-cased-conversational` | 16 | 512 | 2.335 | 0.0553 | 2177 | 2794 |
|
37 |
+
| `distilrubert-small-cased-conversational` | 16 | 512 | 0.802 | **0.0015** | 1541 | 1810 |
|
38 |
+
| `cointegrated/rubert-tiny` | 16 | 512 | 0.942 | 0.0022 | 1308 | 2088 |
|
39 |
+
| `cointegrated/rubert-tiny2` | 16 | 512 | 1.786 | 0.0023 | 3054 | 3848 |
|
40 |
+
| `distilrubert-tiny-cased-conversational-v1` | 16 | 512 | **0.374** | **0.002** | **714** | **1158** |
|
41 |
+
| `distilrubert-tiny-cased-conversational-5k` | 16 | 512 | **0.354** | **0.0018** | **664** | **1126** |
|
42 |
+
|
43 |
+
|
44 |
+
To evaluate model quality, we fine-tuned DistilRuBERT-tiny-5k on classification (RuSentiment, ParaPhraser), NER and question answering data sets for Russian. The results could be found in the [paper](https://arxiv.org/abs/2205.02340) Table 4 as well as performance benchmarks and training details.
|
45 |
+
|
46 |
+
# Citation
|
47 |
+
If you found the model useful for your research, we are kindly ask to cite [this](https://arxiv.org/abs/2205.02340) paper:
|
48 |
+
```
|
49 |
+
@misc{https://doi.org/10.48550/arxiv.2205.02340,
|
50 |
+
doi = {10.48550/ARXIV.2205.02340},
|
51 |
+
url = {https://arxiv.org/abs/2205.02340},
|
52 |
+
author = {Kolesnikova, Alina and Kuratov, Yuri and Konovalov, Vasily and Burtsev, Mikhail},
|
53 |
+
keywords = {Computation and Language (cs.CL), Machine Learning (cs.LG), FOS: Computer and information sciences, FOS: Computer and information sciences},
|
54 |
+
title = {Knowledge Distillation of Russian Language Models with Reduction of Vocabulary},
|
55 |
+
publisher = {arXiv},
|
56 |
+
year = {2022},
|
57 |
+
copyright = {arXiv.org perpetual, non-exclusive license}
|
58 |
+
}
|
59 |
+
```
|
60 |
+
|
61 |
+
\[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\)
|
62 |
+
|
63 |
+
\[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.
|
64 |
+
|
65 |
+
\[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.
|
66 |
+
|
67 |
+
\[4\]: <https://github.com/huggingface/transformers/tree/master/examples/research_projects/distillation>
|
68 |
+
|
69 |
+
\[5\]: <https://habr.com/ru/post/562064/>, <https://huggingface.co/cointegrated/rubert-tiny>
|
config.json
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"vocab_size": 5031,
|
3 |
+
"max_position_embeddings": 512,
|
4 |
+
"n_layers": 3,
|
5 |
+
"n_heads": 12,
|
6 |
+
"dim": 264,
|
7 |
+
"hidden_dim": 792,
|
8 |
+
"model_type": "distilbert"
|
9 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fdcbcb6366c72c390890f20d2b0b0434cb731cbe76941ec856255eddaef77df5
|
3 |
+
size 14581616
|
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, "do_basic_tokenize": true, "never_split": null, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": null}
|
vocab.txt
ADDED
Binary file (48.6 kB). View file
|
|