ai-forever commited on
Commit
224e5f2
1 Parent(s): 26308c3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +107 -1
README.md CHANGED
@@ -2,4 +2,110 @@
2
  license: mit
3
  language:
4
  - ru
5
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: mit
3
  language:
4
  - ru
5
+ ---
6
+
7
+ # Card for ruM2M100-418M model
8
+
9
+ ### Summary
10
+ The model corrects spelling errors and typos by bringing all the words in the text to the norm of the Russian language.
11
+ The proofreader was trained based on the [M2M100-418M](https://huggingface.co/facebook/m2m100_418M) model.
12
+ 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 functionality of the [SAGE] library (https://github.com /orgs/ai-forever/sage).
13
+
14
+ ### Articles and speeches
15
+ - [Speech about the SAGE library](https://youtu.be/yFfkV0Qjuu0), DataFest 2023
16
+ - [Article about synthetic error generation methods](https://www.dialog-21.ru/media/5914/martynovnplusetal056.pdf), Dialogue 2023
17
+ - [Article about SAGE and our best solution](https://arxiv.org/abs/2308.09435), Review EACL 2024
18
+
19
+ ### Examples
20
+ | Input | Output |
21
+ | --- | --- |
22
+ | Думю ешцъа лет череа 10 ретроспективно просматривотьэ то будкетцц мне невероя тна ин те р но | Думаю, еш цъа лет через 10 ретроспективно просматривать, що буде ТЦ. Мне невероятна нтерно. |
23
+ | Основая цель мероприятия - практическая отработка навыков по оказанию помощи гражданам, попавшим в ДТП, а также повышение и совершенствование уровня профессиональной подготовки сотрудников МЧС при проведении аварийно-спасательных работ по ликвидации последствий дорожно-транспортных проишествий, сокращение временных показателей реагирования. | Основная цель мероприятия - практическая отработка навыков по оказанию помощи гражданам, попавшим в ДТП, а также повышение и совершенствование уровня профессиональной подготовки сотрудников МЧС при проведении аварийно-спасательных работ по ликвидации последствий дорожно-транспортных происшествий, сокращение временных показателей реагирования. |
24
+ | прийдя в МГТУ я был удивлен никого необноружив там… | прийдя в МГТУ я был удивлен никого не обнаружив там... |
25
+
26
+ ## Metrics
27
+ ### Quality
28
+ Below are automatic metrics for determining the correctness of the spell checkers.
29
+ We compare our solution with both open automatic spell checkers and the ChatGPT family of models on all four available datasets:
30
+ - **RUSpellRU**: texts collected from ([LiveJournal](https://www.livejournal.com/media)), with manually corrected typos and errors;
31
+ - **MultidomainGold**: examples from 7 text sources, including the open web, news, social media, reviews, subtitles, policy documents and literary works;
32
+ - **MedSpellChecker**: texts with errors from medical anamnesis;
33
+ - **GitHubTypoCorpusRu**: spelling errors and typos in commits from [GitHub](https://github.com);
34
+
35
+ **RUSpellRU**
36
+ | Model | Precision | Recall | F1 |
37
+ | --- | --- | --- | --- |
38
+ | M2M100-418M | 57.7 | 61.2 | 59.4 |
39
+ | ChatGPT gpt-3.5-turbo-0301 | 55.8 | 75.3 | 64.1 |
40
+ | ChatGPT gpt-4-0314 | 57.0 | 75.9 | 63.9 |
41
+ | ChatGPT text-davinci-003 | 55.9 | 75.3 | 64.2 |
42
+ | Yandex.Speller | 83.0 | 59.8 | 69.5 |
43
+ | JamSpell | 42.1 | 32.8 | 36.9 |
44
+ | HunSpell | 31.3 | 34.9 | 33.0 |
45
+
46
+ **MultidomainGold**
47
+ | Model | Precision | Recall | F1 |
48
+ | --- | --- | --- | --- |
49
+ | M2M100-418M | 32.8 | 56.3 | 41.5 |
50
+ | ChatGPT gpt-3.5-turbo-0301 | 33.8 | 72.1 | 46.0 |
51
+ | ChatGPT gpt-4-0314 | 34.0 | 73.2 | 46.4 |
52
+ | ChatGPT text-davinci-003 | 33.6 | 72.0 | 45.8 |
53
+ | Yandex.Speller | 52.9 | 51.4 | 52.2 |
54
+ | JamSpell | 25.7 | 30.6 | 28.0 |
55
+ | HunSpell | 16.2 | 40.1 | 23.0 |
56
+
57
+ **MedSpellChecker**
58
+ | Модель | Precision | Recall | F1 |
59
+ | --- | --- | --- | --- |
60
+ | M2M100-418M | 23.2 | 64.5 | 34.1 |
61
+ | ChatGPT gpt-3.5-turbo-0301 | 53.2 | 67.6 | 59.6 |
62
+ | ChatGPT gpt-4-0314 | 54.2 | 69.4 | 60.9 |
63
+ | ChatGPT text-davinci-003 | 47.8 | 68.4 | 56.3 |
64
+ | Yandex.Speller | 80.6 | 47.8 | 60.0 |
65
+ | JamSpell | 24.6 | 29.7 | 26.9 |
66
+ | HunSpell | 10.3 | 40.2 | 16.4 |
67
+
68
+ **GitHubTypoCorpusRu**
69
+ | Модель | Precision | Recall | F1 |
70
+ | --- | --- | --- | --- |
71
+ | M2M100-418M | 27.5 | 42.6 | 33.4 |
72
+ | ChatGPT gpt-3.5-turbo-0301 | 43.8 | 57.0 | 49.6 |
73
+ | ChatGPT gpt-4-0314 | 45.2 | 58.2 | 51.0 |
74
+ | ChatGPT text-davinci-003 | 46.5 | 58.1 | 51.7 |
75
+ | Yandex.Speller | 67.7 | 37.5 | 48.3 |
76
+ | JamSpell | 49.5 | 29.9 | 37.3 |
77
+ | HunSpell | 28.5 | 30.7 | 29.6 |
78
+
79
+ ## How to use
80
+ ```python
81
+ from transformers import M2M100ForConditionalGeneration, M2M100Tokenizer
82
+
83
+ path_to_model = "<path_to_model>"
84
+
85
+ model = M2M100ForConditionalGeneration.from_pretrained(path_to_model)
86
+ tokenizer = M2M100Tokenizer.from_pretrained(path_to_model)
87
+
88
+ sentence = "прийдя в МГТУ я был удивлен никого необноружив там…"
89
+
90
+ encodings = tokenizer(sentence, return_tensors="pt")
91
+ generated_tokens = model.generate(
92
+ **encodings, forced_bos_token_id=tokenizer.get_lang_id("ru"))
93
+ answer = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
94
+ print(answer)
95
+
96
+ # ["прийдя в МГТУ я был удивлен никого не обнаружив там..."]
97
+ ```
98
+
99
+ ## Resources
100
+ - [SAGE library code with augmentation methods, access to datasets and open models](https://github.com/orgs/ai-forever/sage), GitHub
101
+ - [ruM2M100-1.2B](https://huggingface.co/ai-forever/RuM2M100-1.2B), HuggingFace
102
+ - [ruM2M100-418M](https://huggingface.co/ai-forever/RuM2M100-420M), HuggingFace
103
+ - [FredT5-large-spell](https://huggingface.co/ai-forever/FRED-T5-large-spell), HuggingFace
104
+ - [T5-large-spell](https://huggingface.co/ai-forever/T5-large-spell), HuggingFace
105
+
106
+ ## Licensing
107
+ 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.
108
+ Our solution also comes with an MIT license.
109
+
110
+ ## Contacts
111
+ For questions related to the operation and application of the model, please contact the product manager: Pavel Lebedev PIgLebedev@sberbank.ru.