File size: 2,295 Bytes
3a59d60
 
 
 
 
 
 
 
8b26ca3
3a59d60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: mit
base_model:
- ai-sage/GigaChat-20B-A3B-instruct-v1.5
language:
- ru
- en
---
# GigaChat-20B-A3B-instruct-v1.5 int8

Диалоговая модель из семейства моделей GigaChat, основная на [ai-sage/GigaChat-20B-A3B-instruct-v1.5](https://huggingface.co/ai-sage/GigaChat-20B-A3B-instruct-v1.5). Поддерживает контекст в 131 тысячу токенов.

Представляем обновленную версию с улучшенным alignment, что привело к значительному росту метрик арен:
- Arena Hard RU: 20.8 → 29.6 (+8.8)
- Arena General: 41.1 → 49.1 (+9)
- остальные метрики на тех же значениях


Больше подробностей в [хабр статье](https://habr.com/en/companies/sberdevices/articles/865996/).

## Доступность

**Для данной модели также доступны веса в [bf16](https://huggingface.co/ai-sage/GigaChat-20B-A3B-instruct-v1.5-bf16) и [fp32](https://huggingface.co/ai-sage/GigaChat-20B-A3B-instruct-v1.5)**

А также:
- GGUF версии ([bf16, q8, q6, q5, q4](https://huggingface.co/ai-sage/GigaChat-20B-A3B-instruct-v1.5-GGUF))
- Ollama ([bf16, q8, q6, q5, q4](https://ollama.com/infidelis/GigaChat-20B-A3B-instruct-v1.5))



## Пример использования через transformers

```bash
pip install --upgrade transformers torch accelerate bitsandbytes
```


```python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig

model_name = "ai-sage/GigaChat-20B-A3B-instruct-int8"
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True, device_map="auto")
model.generation_config = GenerationConfig.from_pretrained(model_name)

messages = [
    {"role": "user", "content": "Докажи теорему о неподвижной точке"}
]
input_tensor = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
outputs = model.generate(input_tensor.to(model.device))

result = tokenizer.decode(outputs[0][input_tensor.shape[1]:], skip_special_tokens=False)
print(result)
```