ai-forever
commited on
Commit
•
88c1f44
1
Parent(s):
d925dc3
Update README.md
Browse files
README.md
CHANGED
@@ -21,6 +21,46 @@ First half of the time model trained on the small part of all dataset (1%,3GB) a
|
|
21 |
For RSG, we trained as described in the T5 paper. First, we trained multitask for all tasks. Then we took the best checkpoint for the task and trained it further.
|
22 |
RSG submit here https://russiansuperglue.com/login/submit_info/2060
|
23 |
|
24 |
-
Total training time was around 35 days on 160 V100 GPUs.
|
25 |
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
For RSG, we trained as described in the T5 paper. First, we trained multitask for all tasks. Then we took the best checkpoint for the task and trained it further.
|
22 |
RSG submit here https://russiansuperglue.com/login/submit_info/2060
|
23 |
|
24 |
+
Total training time was around 35 days on 160 V100 GPUs + 5 days on 80 A100.
|
25 |
|
26 |
+
## Usage (HuggingFace Models Repository)
|
27 |
+
|
28 |
+
```python
|
29 |
+
import torch
|
30 |
+
from transformers import GPT2Tokenizer, T5ForConditionalGeneration
|
31 |
+
tokenizer = GPT2Tokenizer.from_pretrained('ai-forever/FRED-T5-1.7B',eos_token='</s>')
|
32 |
+
model = T5ForConditionalGeneration.from_pretrained(('ai-forever/FRED-T5-1.7B')
|
33 |
+
device='cuda'
|
34 |
+
model.to(device)
|
35 |
+
|
36 |
+
#Prefix <LM>
|
37 |
+
lm_text='Принялся Кутузов рассказывать свою историю как он сюда попал. Началось'
|
38 |
+
input_ids=torch.tensor([tokenizer.encode(prefix_LM+lm_text)]).to(device)
|
39 |
+
outputs=model.generate(input_ids,eos_token_id=tokenizer.eos_token_id,early_stopping=True)
|
40 |
+
print(tokenizer.decode(outputs[0][1:]))
|
41 |
+
|
42 |
+
# print result: с того, что он был в армии, служил в артиллерии.
|
43 |
+
|
44 |
+
#Prefix <SC1>
|
45 |
+
lm_text='<SC1>Принялся Кутузов рассказывать свою историю . Началось с того, что он был в армии, служил в артиллерии.'
|
46 |
+
input_ids=torch.tensor([tokenizer.encode(prefix_LM+lm_text)]).to(device)
|
47 |
+
outputs=model.generate(input_ids,eos_token_id=tokenizer.eos_token_id,early_stopping=True)
|
48 |
+
print(tokenizer.decode(outputs[0][1:]))
|
49 |
+
|
50 |
+
#print result: '<extra_id_0> с самого начала'
|
51 |
+
|
52 |
+
# Prefix <SC6>
|
53 |
+
lm_text='<SC6>Принялся Кутузов рассказывать свою историю . Началось с того, что он был в армии, служил в артиллерии.'
|
54 |
+
input_ids=torch.tensor([tokenizer.encode(prefix_LM+lm_text)]).to(device)
|
55 |
+
outputs=model.generate(input_ids,eos_token_id=tokenizer.eos_token_id,early_stopping=True,max_length=100)
|
56 |
+
print(tokenizer.decode(outputs[0][1:]))
|
57 |
+
|
58 |
+
#print result:'<extra_id_0>.\n— Я родился в 1745 году, — начал он. — Отец мой был крестьянин, а мать — дочь священника. Отец мой был очень беден, и я с детства был предоставлен самому себе.\n— А как вы стали офицером? — спросил я.\n— Это длинная история'
|
59 |
+
|
60 |
+
```
|
61 |
+
# Authors
|
62 |
+
+ NLP core team RnD [Telegram channel](https://t.me/nlpcoreteam):
|
63 |
+
+ Dmitry Zmitrovich
|
64 |
+
+ Andrei Kalmykov
|
65 |
+
+ Vitaly Kadulin
|
66 |
+
+ Mikhail Novikov
|