Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- ru
|
| 5 |
+
- en
|
| 6 |
+
library_name: transformers
|
| 7 |
+
pipeline_tag: feature-extraction
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# DeBERTa-base
|
| 11 |
+
|
| 12 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
| 13 |
+
|
| 14 |
+
Pretrained bidirectional encoder for russian language.
|
| 15 |
+
The model was trained using standard MLM objective on large text corpora including open social data.
|
| 16 |
+
See `Training Details` section for more information.
|
| 17 |
+
|
| 18 |
+
⚠️ This model contains only the encoder part without any pretrained head.
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
- **Developed by:** [deepvk](https://vk.com/deepvk)
|
| 22 |
+
- **Model type:** DeBERTa
|
| 23 |
+
- **Languages:** Mostly russian and small fraction of other languages
|
| 24 |
+
- **License:** Apache 2.0
|
| 25 |
+
|
| 26 |
+
## How to Get Started with the Model
|
| 27 |
+
|
| 28 |
+
```python
|
| 29 |
+
from transformers import AutoTokenizer, AutoModel
|
| 30 |
+
|
| 31 |
+
tokenizer = AutoTokenizer.from_pretrained("deepvk/deberta-base")
|
| 32 |
+
model = AutoModel.from_pretrained("deepvk/deberta-base")
|
| 33 |
+
|
| 34 |
+
text = "Привет, мир!"
|
| 35 |
+
|
| 36 |
+
inputs = tokenizer(text, return_tensors='pt')
|
| 37 |
+
predictions = model(**inputs)
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
## Training Details
|
| 41 |
+
|
| 42 |
+
### Training Data
|
| 43 |
+
|
| 44 |
+
400 GB of filtered and deduplicated texts in total.
|
| 45 |
+
A mix of the following data: Wikipedia, Books, Twitter comments, Pikabu, Proza.ru, Film subtitles, News websites, and Social corpus.
|
| 46 |
+
|
| 47 |
+
#### Deduplication procedure
|
| 48 |
+
|
| 49 |
+
1. Calculate shingles with size of 5
|
| 50 |
+
2. Calculate MinHash with 100 seeds → for every sample (text) have a hash of size 100
|
| 51 |
+
3. Split every hash into 10 buckets → every bucket, which contains (100 / 10) = 10 numbers, get hashed into 1 hash → we have 10 hashes for every sample
|
| 52 |
+
4. For each bucket find duplicates: find samples which have the same hash → calculate pair-wise jaccard distance of similarity → if the similarity is >0.7 than it's a duplicate
|
| 53 |
+
5. Gather duplicates from all the buckets and filter
|
| 54 |
+
|
| 55 |
+
### Training Hyperparameters
|
| 56 |
+
|
| 57 |
+
| Argument | Value |
|
| 58 |
+
|--------------------|----------------------|
|
| 59 |
+
| Training regime | fp16 mixed precision |
|
| 60 |
+
| Optimizer | AdamW |
|
| 61 |
+
| Adam betas | 0.9,0.98 |
|
| 62 |
+
| Adam eps | 1e-6 |
|
| 63 |
+
| Weight decay | 1e-2 |
|
| 64 |
+
| Batch size | 2240 |
|
| 65 |
+
| Num training steps | 1kk |
|
| 66 |
+
| Num warm-up steps | 10k |
|
| 67 |
+
| LR scheduler | Linear |
|
| 68 |
+
| LR | 2e-5 |
|
| 69 |
+
| Gradient norm | 1.0 |
|
| 70 |
+
|
| 71 |
+
The model was trained on a machine with 8xA100 for approximately 30 days.
|
| 72 |
+
|
| 73 |
+
### Architecture details
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
| Argument | Value |
|
| 77 |
+
|-------------------------|----------------|
|
| 78 |
+
|Encoder layers | 12 |
|
| 79 |
+
|Encoder attention heads | 12 |
|
| 80 |
+
|Encoder embed dim | 768 |
|
| 81 |
+
|Encoder ffn embed dim | 3,072 |
|
| 82 |
+
|Activation function | GeLU |
|
| 83 |
+
|Attention dropout | 0.1 |
|
| 84 |
+
|Dropout | 0.1 |
|
| 85 |
+
|Max positions | 512 |
|
| 86 |
+
|Vocab size | 50266 |
|
| 87 |
+
|Tokenizer type | Byte-level BPE |
|
| 88 |
+
|
| 89 |
+
## Evaluation
|
| 90 |
+
|
| 91 |
+
We evaluated the model on [Russian Super Glue](https://russiansuperglue.com/) dev set.
|
| 92 |
+
The best result in each task is marked in bold.
|
| 93 |
+
All models have the same size except the distilled version of DeBERTa.
|
| 94 |
+
|
| 95 |
+
| Model | RCB | PARus | MuSeRC | TERRa | RUSSE | RWSD | DaNetQA | Score |
|
| 96 |
+
|------------------------------------------------------------------------|-----------|--------|---------|-------|---------|---------|---------|-----------|
|
| 97 |
+
| [vk-deberta-distill](https://huggingface.co/deepvk/deberta-v1-distill) | 0.433 | 0.56 | 0.625 | 0.59 | 0.943 | 0.569 | 0.726 | 0.635 |
|
| 98 |
+
| [vk-roberta-base](https://huggingface.co/deepvk/roberta-base) | 0.46 | 0.56 | 0.679 | 0.769 | 0.960 | 0.569 | 0.658 | 0.665 |
|
| 99 |
+
| [vk-deberta-base](https://huggingface.co/deepvk/deberta-v1-base) | 0.450 |**0.61**|**0.722**| 0.704 | 0.948 | 0.578 |**0.76** |**0.682** |
|
| 100 |
+
| [vk-bert-base](https://huggingface.co/deepvk/bert-base-uncased) | 0.467 | 0.57 | 0.587 | 0.704 | 0.953 |**0.583**| 0.737 | 0.657 |
|
| 101 |
+
| [sber-bert-base](https://huggingface.co/ai-forever/ruBert-base) | **0.491** |**0.61**| 0.663 | 0.769 |**0.962**| 0.574 | 0.678 | 0.678 |
|