File size: 9,455 Bytes
fef236a 0186562 fef236a 0186562 cf6188a 58dd4a0 d4f87a2 4451980 58dd4a0 d4f87a2 58dd4a0 d4f87a2 58dd4a0 d4f87a2 bc2dac0 4451980 cf6188a 58dd4a0 cf6188a 58dd4a0 cf6188a 58dd4a0 cf6188a fef236a cf6188a 0186562 e59c5eb 4451980 0186562 b53a90f 0186562 b53a90f 0186562 0faef48 0186562 ac1042c f1f37bb 0faef48 0186562 f1f37bb 0186562 f1f37bb 0186562 f1f37bb 0186562 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
---
language:
- ru
tags:
- spellchecking
- pytorch
- natural language generation
license: mit
metrics:
- precision
- recall
- f1
library_name: transformers
model-index:
- name: sage-fredt5-large
results:
- task:
type: text-generation
dataset:
type: spellcheck_benchmark
name: RUSpellRU (spell&punct)
metrics:
- name: F1 (spell)
type: f1_spell
value: 64.9
verified: false
- name: F1 (punct)
type: f1_punct
value: 61.9
verified: false
- name: F1 (case)
type: f1_case
value: 80.4
verified: false
- task:
type: text-generation
dataset:
type: spellcheck_benchmark
name: MultidomainGold (spell&punct)
metrics:
- name: F1 (spell)
type: f1_spell
value: x
verified: false
- name: F1 (punct)
type: f1_punct
value: x
verified: false
- name: F1 (case)
type: f1_case
value: x
verified: false
- task:
type: text-generation
dataset:
type: spellcheck_benchmark
name: MedSpellchecker (spell&punct)
metrics:
- name: F1 (spell)
type: f1_spell
value: x
verified: false
- name: F1 (punct)
type: f1_punct
value: x
verified: false
- name: F1 (case)
type: f1_case
value: x
verified: false
- task:
type: text-generation
dataset:
type: spellcheck_benchmark
name: GitHubTypoCorpusRu (spell&punct)
metrics:
- name: F1 (spell)
type: f1_spell
value: x
verified: false
- name: F1 (punct)
type: f1_punct
value: x
verified: false
- name: F1 (case)
type: f1_case
value: x
verified: false
---
# sage-fredt5-large
![banner](images/sage_banner.jpg)
### Summary
The model corrects spelling and punctuation errors and typos by bringing all the words in the text to the norm of the Russian language.
Corrector had been trained based on the model [FRED-T5-large](https://huggingface.co/ai-forever/FRED-T5-large).
An extensive dataset with “artificial” errors was taken as a training corpus: the corpus was assembled on the basis of the Russian-language Wikipedia and transcripts of Russian-language videos, then typos and spelling errors were automatically introduced into it using the library [SAGE](https://github.com/ai-forever/sage).
### Public references
- [SAGE library announcement](https://youtu.be/yFfkV0Qjuu0), DataFest 2023
- [Paper about synthetic error generation methods](https://www.dialog-21.ru/media/5914/martynovnplusetal056.pdf), Dialogue 2023
- [SAGE EACL 2024 paper](https://aclanthology.org/2024.findings-eacl.10/)
### Examples
| Input | Output |
| --- | --- |
| И не чсно прохожим в этот день непогожйи почему я веселый такйо | И не ясно прохожим в этот день непогожий, почему я веселый такой. |
| Каждй день воттак делой, и спена балеть нибудет. А вотак каждый день ниделай | Каждый день вот так делай и спина болеть не будет. А вот так каждый день не делай. |
| Основая цель мероприятия практическая отработка навыков по оказанию помощи гражданам, попавшим в ДТП а также повышение и совершенствование уровня профессиональной подготовки сотрудников МЧС при проведении аварийно-спасательных работ по ликвидации последствий дорожно-транспортных проишествий сокращение временных показателей реагирования. | Основная цель мероприятия — практическая отработка навыков по оказанию помощи гражданам, попавшим в ДТП, а также повышение и совершенствование уровня профессиональной подготовки сотрудников МЧС при проведении аварийно-спасательных работ по ликвидации последствий дорожно-транспортных происшествий, сокращение временных показателей реагирования |
| | |
## Metrics
### Quality
Below are automatic metrics for determining the correctness of the spell checkers.
We compare our solution with both open automatic spell checkers and the ChatGPT family of models on all four available datasets:
- **RUSpellRU**: texts collected from ([LiveJournal](https://www.livejournal.com/media)), with manually corrected typos and errors;
- **MultidomainGold**: examples from 7 text sources, including the open web, news, social media, reviews, subtitles, policy documents and literary works;
- **MedSpellChecker**: texts with errors from medical anamnesis;
- **GitHubTypoCorpusRu**: spelling errors and typos in commits from [GitHub](https://github.com);
**RUSpellRU**
| Model | Pr. (spell) | Rec. (spell) | F1 (spell) | Pr. (punc) | Rec. (punc) | F1 (punc) | Pr. (case) | Rec. (case) | F1 (case) |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| sage-fredt5-large | x | x | x | x | x | x | x | x | x |
| sage-fredt5-large (ft) | 88.4 | 80.9 | 84.5 | 88.2 | 85.3 | 86.8 | 95.5 | 94.0 | 94.7 |
| sage-ai-service | 90.3 | 86.3 | 88.2 | 90.3 | 86.6 | 88.4 | 95.2 | 95.9 | 95.6 |
| gpt-3.5-turbo | 33.6 | 58.5 | 42.7 | 85.9 | 64.6 | 73.7 | 84.9 | 73.9 | 79.0 |
| gpt-4 | 54.9 | 76.7 | 64.0 | 84.0 | 82.3 | 83.2 | 91.5 | 90.2 | 90.9 |
**MultidomainGold**
| Model | Pr. (spell) | Rec. (spell) | F1 (spell) | Pr. (punc) | Rec. (punc) | F1 (punc) | Pr. (case) | Rec. (case) | F1 (case) |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| sage-fredt5-large | x | x | x | x | x | x | x | x | x |
| sage-fredt5-large (ft) | 80.3 | 75.1 | 77.6 | 69.0 | 66.5 | 67.7 | 78.6 | 80.0 | 79.3 |
| sage-ai-service | 81.6 | 77.7 | 79.6 | 70.2 | 67.5 | 68.8 | 80.5 | 80.5 | 80.5 |
| gpt-3.5-turbo | 18.8 | 48.1 | 27.1 | 42.0 | 31.8 | 36.2 | 47.1 | 51.3 | 49.1 |
| gpt-4 | 25.4 | 68.0 | 37.0 | 57.8 | 54.3 | 56.0 | 54.0 | 67.5 | 60.0 |
**MedSpellChecker**
| Model | Pr. (spell) | Rec. (spell) | F1 (spell) | Pr. (punc) | Rec. (punc) | F1 (punc) | Pr. (case) | Rec. (case) | F1 (case) |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| sage-fredt5-large | x | x | x | x | x | x | x | x | x |
| sage-fredt5-large (ft) | 72.5 | 72.2 | 72.3 | 74.6 | 66.4 | 70.3 | 79.3 | 85.1 | 82.1 |
| sage-ai-service | 71.3 | 73.5 | 72.4 | 75.1 | 69.2 | 72.0 | 80.9 | 72.8 | 76.6|
| gpt-3.5-turbo | 14.7 | 45.9 | 22.3 | 69.9 | 52.3 | 59.8 | 26.4 | 41.8 | 32.3 |
| gpt-4 | 37.8 | 72.3 | 49.6 | 81.4 | 64.3 | 71.9 | 73.0 | 62.1 | 67.1 |
**GitHubTypoCorpusRu**
| Model | Pr. (spell) | Rec. (spell) | F1 (spell) | Pr. (punc) | Rec. (punc) | F1 (punc) | Pr. (case) | Rec. (case) | F1 (case) |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| sage-fredt5-large | x | x | x | x | x | x | x | x | x |
| sage-fredt5-large (ft) | 88.4 | 80.9 | 84.5 | 88.2 | 85.3 | 86.8 | 95.5 | 94.0 | 94.7 |
| sage-ai-service | 90.3 | 86.3 | 88.2 | 90.3 | 86.6 | 88.4 | 95.2 | 95.9 | 95.6 |
| gpt-3.5-turbo | 33.6 | 58.5 | 42.7 | 85.9 | 64.6 | 73.7 | 84.9 | 73.9 | 79.0 |
| gpt-4 | 54.9 | 76.7 | 64.0 | 84.0 | 82.3 | 83.2 | 91.5 | 90.2 | 90.9 |
& \textbf{70.8} & \textbf{56.3} & \textbf{62.7} & \textbf{48.9} & 35.8 & 41.4 & 32.9 & 45.3 & 38.1
## How to use
```python
from transformers import M2M100ForConditionalGeneration, M2M100Tokenizer
path_to_model = "ai-forever/RuM2M100-1.2B"
model = M2M100ForConditionalGeneration.from_pretrained(path_to_model)
tokenizer = M2M100Tokenizer.from_pretrained(path_to_model, src_lang="ru", tgt_lang="ru")
sentence = "прийдя в МГТУ я был удивлен никого необноружив там…"
encodings = tokenizer(sentence, return_tensors="pt")
generated_tokens = model.generate(
**encodings, forced_bos_token_id=tokenizer.get_lang_id("ru"))
answer = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
print(answer)
#["прийдя в МГТУ я был удивлен никого не обнаружив там..."]
```
## Resources
- [SAGE library](https://github.com/ai-forever/sage), GitHub
- [ruM2M100-1.2B](https://huggingface.co/ai-forever/RuM2M100-1.2B), HuggingFace
- [ruM2M100-418M](https://huggingface.co/ai-forever/RuM2M100-420M), HuggingFace
- [FredT5-large-spell](https://huggingface.co/ai-forever/FRED-T5-large-spell), HuggingFace
- [T5-large-spell](https://huggingface.co/ai-forever/T5-large-spell), HuggingFace
## License
Model [M2M100-1.2B](https://huggingface.co/facebook/m2m100_1.2B), on the basis of which our solution is made, and its source code are supplied under the MIT open license.
Our solution also comes with MIT license.
## Specifications
- File size: 5 Gb;
- Framework: pytorch
- Format: AI Service
- Version: v1.0
- Developer: SberDevices, AGI NLP
## Contacts
nikita.martynov.98@list.ru |