File size: 1,223 Bytes
2407a8b
 
 
 
d8abd23
 
 
709ce78
 
2407a8b
 
709ce78
c192f97
709ce78
c192f97
709ce78
 
 
c192f97
709ce78
 
 
 
dc19509
709ce78
 
 
 
 
 
 
 
 
 
 
 
 
97baff1
709ce78
 
 
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
---
tags:
- model_hub_mixin
- pytorch_model_hub_mixin
license: apache-2.0
language:
- ru
datasets:
- IgorVolochay/russian_jokes
---

This model was trained for russian jokes generation task as part of the "Advanced NLP" HSE University course.

You can try to generate some kind of joke by specifying some prefix for the model as an input.

Main features of the model: GQA, Alibi PE, BPE tokenizer, 79.4M params.

The quality of jokes is questionable but sometimes it can generate something funny.

For example: Купил мужик шляпу и говорит: — Вы сегодня моя бабушка

You can try to generate your own joke by running this code

```python
import torch
device = torch.device("cuda")
tokenizer = ByteLevelBPETokenizer.from_pretrained("just-ne-just/llm-course-hw1")
model = TransformerForCausalLM.from_pretrained("just-ne-just/llm-course-hw1")
model = model.to(device)
model = model.eval()

text = "Купил мужик шляпу"
input_ids = torch.tensor(tokenizer.encode(text), device=device)
model_output = model.generate(
    input_ids[None, :], max_new_tokens=50, eos_token_id=tokenizer.eos_token_id, do_sample=True, top_k=10
)
tokenizer.decode(model_output[0].tolist())
```