File size: 1,755 Bytes
17815b0
91d53b2
 
 
 
 
 
 
 
 
 
 
17815b0
91d53b2
 
 
 
b31d237
22a4631
91d53b2
 
 
 
 
cb395b2
 
 
 
91d53b2
 
 
 
 
 
 
382afa7
91d53b2
 
 
 
 
382afa7
91d53b2
 
 
 
 
 
9d94298
 
7971361
1e4ab54
7971361
1e4ab54
 
 
 
7971361
1e4ab54
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
---
language:
- ru
tags:
- causal-lm
- text-generation
license:
- apache-2.0
inference: false
widget:
- text: "Как обрести просветление?<s>"
  example_title: "Википедия"
---
# RuGPT3Medium-tathagata
## Model description
This is the model for text generation for Russian based on [rugpt3medium_based_on_gpt2](https://huggingface.co/sberbank-ai/rugpt3medium_based_on_gpt2).
## Intended uses & limitations
Тhis model was trained and run to generate text on RTX 3080
#### How to use
```python
from transformers import GPT2LMHeadModel, GPT2Tokenizer
import torch
DEVICE = torch.device("cuda:0")

model_name_or_path = "radm/rugpt3medium-tathagata"
tokenizer = GPT2Tokenizer.from_pretrained("sberbank-ai/rugpt3medium_based_on_gpt2")
model = GPT2LMHeadModel.from_pretrained(model_name_or_path).to(DEVICE)

text = "В чем смысл жизни?\n"
input_ids = tokenizer.encode(text, return_tensors="pt").to(DEVICE)
model.eval()
with torch.no_grad():
    out = model.generate(input_ids, 
                        do_sample=True,
                        num_beams=4,
                        temperature=1.1,
                        top_p=0.9,
                        top_k=50,
                        max_length=250,
                        min_length=50,
                        early_stopping=True,
                        no_repeat_ngram_size=2
                        )

generated_text = list(map(tokenizer.decode, out))[0]
print()
print(generated_text)
```

## Dataset

Dataset based on summaries of major Buddhist, Hindu and Advaita texts such as:

- Diamond Sutra
- Lankavatara Sutra
- Sri Nisargadatta Maharaj quotes
- Quotes from the Bhagavad Gita

Dataset link: [tathagata](https://huggingface.co/datasets/radm/tathagata)