File size: 2,119 Bytes
7fd03df
 
7e38532
 
 
eb0e3e5
7fd03df
 
7e38532
7fd03df
7e38532
7fd03df
7e38532
7fd03df
81d5541
 
7fd03df
7e38532
7fd03df
 
7e38532
 
 
 
2182fb3
7e38532
7fd03df
2182fb3
7e38532
 
 
 
 
7fd03df
7e38532
 
 
 
 
7fd03df
 
7e38532
 
 
 
7fd03df
45f8be1
 
 
5db0bb9
 
 
 
 
 
 
 
 
 
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
---
library_name: transformers
language:
- ru
- en
license: apache-2.0
---

# Релиз вихря 0.5

Долили сильно больше данных в sft, теперь стабильнее работает json и multiturn, слегка подточили параметры претрена модели

Added a lot more data to sft, now json and multiturn work more stable on long context and hard prompts

 - [Google Colab](https://colab.research.google.com/drive/1-_BWsJycBm3rEyjpBx2_ejshpemQYHbe?usp=sharing)
 - [GGUF](https://huggingface.co/Vikhrmodels/it-5.2-fp16-cp-GGUF)

```python


from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model = AutoModelForCausalLM.from_pretrained("Vikhrmodels/it-5.2-fp16-cp",
                                             device_map="auto",
                                             attn_implementation="sdpa",
                                             torch_dtype=torch.bfloat16)

tokenizer = AutoTokenizer.from_pretrained("Vikhrmodels/it-5.2-fp16-cp")
from transformers import  AutoTokenizer, pipeline
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
prompts = [
    "В чем разница между фруктом и овощем?",
    "Годы жизни колмагорова?"]

def test_inference(prompt):
    prompt = pipe.tokenizer.apply_chat_template([{"role": "user", "content": prompt}], tokenize=False, add_generation_prompt=True)
    print(prompt)
    outputs = pipe(prompt, max_new_tokens=512, do_sample=True, num_beams=1, temperature=0.25, top_k=50, top_p=0.98, eos_token_id=79097)
    return outputs[0]['generated_text'][len(prompt):].strip()


for prompt in prompts:
    print(f"    prompt:\n{prompt}")
    print(f"    response:\n{test_inference(prompt)}")
    print("-"*50)

```


```

@article{nikolich2024vikhr,
  title={Vikhr: The Family of Open-Source Instruction-Tuned Large Language Models for Russian},
  author={Aleksandr Nikolich and Konstantin Korolev and Artem Shelmanov},
  journal={arXiv preprint arXiv:2405.13929},
  year={2024},
  url={https://arxiv.org/pdf/2405.13929}
}
```