Commit
·
1f3af95
1
Parent(s):
8c34fef
Update README.md
Browse files
README.md
CHANGED
@@ -6,6 +6,8 @@ license: apache-2.0
|
|
6 |
|
7 |
# FRED-T5 1.7B (Full-scale Russian Enhanced Denoisers T5)
|
8 |
|
|
|
|
|
9 |
Architecture based on T5.
|
10 |
|
11 |
It has 24 layers and 1536 hidden size. More details in config.json.
|
@@ -23,7 +25,47 @@ RSG submit here https://russiansuperglue.com/login/submit_info/1936
|
|
23 |
|
24 |
Total training time was around 45 days on 112 A100 GPUs.
|
25 |
|
26 |
-
Training loss
|
27 |
-
![Screenshot 2023-01-21 at 11.36.52.png](https://s3.amazonaws.com/moonup/production/uploads/1674290304538-5f91b1208a61a359f44e1851.png)
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
# FRED-T5 1.7B (Full-scale Russian Enhanced Denoisers T5)
|
8 |
|
9 |
+
Model was trained by [SberDevices](https://sberdevices.ru/).
|
10 |
+
|
11 |
Architecture based on T5.
|
12 |
|
13 |
It has 24 layers and 1536 hidden size. More details in config.json.
|
|
|
25 |
|
26 |
Total training time was around 45 days on 112 A100 GPUs.
|
27 |
|
|
|
|
|
28 |
|
29 |
+
## Usage (HuggingFace Models Repository)
|
30 |
+
Example how to use model:
|
31 |
+
|
32 |
+
```python
|
33 |
+
import torch
|
34 |
+
from transformers import GPT2Tokenizer, T5ForConditionalGeneration
|
35 |
+
tokenizer = GPT2Tokenizer.from_pretrained('ai-forever/FRED-T5-1.7B',eos_token='</s>')
|
36 |
+
model = T5ForConditionalGeneration.from_pretrained(('ai-forever/FRED-T5-1.7B')
|
37 |
+
device='cuda'
|
38 |
+
model.to(device)
|
39 |
+
|
40 |
+
#Prefix <LM>
|
41 |
+
lm_text='Принялся Кутузов рассказывать свою историю как он сюда попал. Началось'
|
42 |
+
input_ids=torch.tensor([tokenizer.encode(prefix_LM+lm_text)]).to(device)
|
43 |
+
outputs=model.generate(input_ids,eos_token_id=tokenizer.eos_token_id,early_stopping=True)
|
44 |
+
print(tokenizer.decode(outputs[0][1:]))
|
45 |
+
|
46 |
+
# print result: с того, что он был в армии, служил в артиллерии.
|
47 |
+
|
48 |
+
#Prefix <SC1>
|
49 |
+
lm_text='<SC1>Принялся Кутузов рассказывать свою историю . Началось с того, что он был в армии, служил в артиллерии.'
|
50 |
+
input_ids=torch.tensor([tokenizer.encode(prefix_LM+lm_text)]).to(device)
|
51 |
+
outputs=model.generate(input_ids,eos_token_id=tokenizer.eos_token_id,early_stopping=True)
|
52 |
+
print(tokenizer.decode(outputs[0][1:]))
|
53 |
+
|
54 |
+
#print result: '<extra_id_0> с самого начала'
|
55 |
+
|
56 |
+
# Prefix <SC6>
|
57 |
+
lm_text='<SC6>Принялся Кутузов рассказывать свою историю . Началось с того, что он был в армии, служил в артиллерии.'
|
58 |
+
input_ids=torch.tensor([tokenizer.encode(prefix_LM+lm_text)]).to(device)
|
59 |
+
outputs=model.generate(input_ids,eos_token_id=tokenizer.eos_token_id,early_stopping=True,max_length=100)
|
60 |
+
print(tokenizer.decode(outputs[0][1:]))
|
61 |
+
|
62 |
+
#print result:'<extra_id_0>.\n— Я родился в 1745 году, — начал он. — Отец мой был крестьянин, а мать — дочь священника. Отец мой был очень беден, и я с детства был предоставлен самому себе.\n— А как вы стали офицером? — спросил я.\n— Это длинная история'
|
63 |
|
64 |
+
```
|
65 |
+
# Authors
|
66 |
+
+ NLP core team RnD [Telegram channel](https://t.me/nlpcoreteam):
|
67 |
+
+ Dmitry Zmitrovich
|
68 |
+
+ Andrei Kalmykov
|
69 |
+
+ Vitaly Kadulin
|
70 |
+
+ Mikhail Novikov
|
71 |
+
|