File size: 5,378 Bytes
aa68cf9
 
a33d530
aba5050
 
 
 
a33d530
aba5050
 
a33d530
 
aa68cf9
aba5050
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e8abdd8
aba5050
e8abdd8
 
 
 
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
---
license: mit
datasets:
  - d0rj/gsm8k-ru
  - d0rj/alpaca-cleaned-ru
  - IlyaGusev/ru_turbo_alpaca
  - IlyaGusev/ru_turbo_alpaca_evol_instruct
language:
  - ru
  - en
library_name: peft
pipeline_tag: text-generation
---

# PavelGPT 7B 128K (v0.1)

PavelGPT is a Russian language model based
on [NousResearch/Yarn-Mistral-7b-128k](https://huggingface.co/NousResearch/Yarn-Mistral-7b-128k)
so it also has 7B parameters and 128k context size.

- **Developed by:** [EvilFreelancer](https://github.com/EvilFreelancer)
- **Model type:** LoRA
- **Language(s) (NLP):** Russian, English
- **License:** MIT
- **Finetuned from model:**
  [NousResearch/Yarn-Mistral-7b-128k](https://huggingface.co/NousResearch/Yarn-Mistral-7b-128k)

## Details

### Description

The model is able to generate text in Russian, answer questions, solve simple logical puzzles and simple math
calculations, it was trained on a medium corpus of Russian instructions, manuals and other texts.

It optimized for INSTRUCT mode and it works better if you give it system prompt and only one instruction (without
history at all).

### Datasets

PavelGPT was trained on following datasets:

- [d0rj/gsm8k-ru](https://huggingface.co/datasets/d0rj/gsm8k-ru) - 7.5k rows of Russian puzzles
- [d0rj/alpaca-cleaned-ru](https://huggingface.co/datasets/d0rj/alpaca-cleaned-ru) - 51.8k rows of Russian general
  instructions
- [IlyaGusev/ru_turbo_alpaca](https://huggingface.co/datasets/IlyaGusev/ru_turbo_alpaca) - 29.98k rows of Russian
  instructions, but was used only instructions with `ok` label (~4.5k)
- [IlyaGusev/ru_turbo_alpaca_evol_instruct](https://huggingface.co/datasets/IlyaGusev/ru_turbo_alpaca_evol_instruct) -
  47.8k rows of Russian instructions

All datasets was merged with help
of [create_instruct_set_v2.py](https://github.com/EvilFreelancer/saiga-custom/blob/main/data_processing/create_instruct_set_v2.py)
(hash a1151bf903990b88177d30bd1de67c7b94fdecef).

After merging and deduplication we got 46.2k rows of training data and 2.4k rows of validation data.

### Training

Model was trained on 1x RTX 4090 24GB for 1 epoch (took ~12 hours), it was trained with help of Peft library and in 4bit quantization mode.

Context size was set to 4096 tokens, batch size was set to 1, gradient accumulation was set to 128.

Training script: [pavelgpt_7b_128k.ipynb](https://github.com/EvilFreelancer/saiga-custom/blob/main/pavelgpt_7b_128k.ipynb).

Wandb report: [j6jt6cyd](https://api.wandb.ai/links/evilfreelancer/j6jt6cyd).

### Tests results

Tests was performed on following [generation configuration](./generation_config.json):

```json
{
  "pad_token_id": 0,
  "unk_token_id": 0,
  "bos_token_id": 1,
  "eos_token_id": 2,
  "temperature": 0.2,
  "top_p": 0.2,
  "top_k": 20,
  "do_sample": true,
  "max_new_tokens": 4096,
  "repetition_penalty": 1.2,
  "no_repeat_ngram_size": 15
}
```

Here is the results:

```text
User: Привет! Кто ты?
Bot: Я - языковой модель ИИ, называемый PavelGPT. Я способен к естественному языку и обучен отвечать на вопросы по многим темам. Как правило, я использую информацию из Интернета для создания своих ответов.

User: Ты помнишь как здесь оказался?
Bot: Я был создан компанией OpenAI в качестве исследовательского проекта и запущен в декабре 2018 года. С тех пор он продолжает развивать свой алгоритм путем обучения на больших объемах данных и улучшения его функций.

User: Какой по твоему сейчас год?
Bot: В настоящее время это 2023 год.

User: А какой день?
Bot: Сейчас 6 января 2023 г.

User: Почему трава зелёная?
Bot: Зеленый цвет является результатом взаимодействия хлорофилла (пигмента) со светом. Хлорофилл может поглощать красное и синее спектральные излучения, оставляя только зеленое. Эти компоненты вместе образуют зеленый цвет растительной массы.

User: Я пошёл в магазин и купил 10 яблок. Два яблока я отдал соседу и два ремонтнику. Потом я купил ещё 5 яблок и одно из них съел. Также я отдал три банана моему брату. Сколько яблок у меня осталось?
Bot: У вас осталось 10 яблок после того, как вы продали их друзьям и брату.

User: Твоя задача решить логическую головоломку: У Серёжи есть мама Татьяна и папа Денис. И ещё у Серёжи есть брат Иван. Кем Ивану приходится Татьяна?
Bot: Мамой Ивана должна быть Татьяна.
```
## Links

* https://t.me/evilfreelancer
* https://dzen.ru/evilfreelancer
* https://github.com/EvilFreelancer
* https://youtube.com/@pavelzloi