Text Generation
Transformers
ONNX
Safetensors
PyTorch
Russian
transformer
fill-mask
chat
russian
easyformer
custom_code
conversational
Eval Results (legacy)
Instructions to use OpenRussianAI/andrey with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenRussianAI/andrey with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="OpenRussianAI/andrey", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelWithLMHead model = AutoModelWithLMHead.from_pretrained("OpenRussianAI/andrey", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OpenRussianAI/andrey with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenRussianAI/andrey" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenRussianAI/andrey", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/OpenRussianAI/andrey
- SGLang
How to use OpenRussianAI/andrey with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "OpenRussianAI/andrey" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenRussianAI/andrey", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "OpenRussianAI/andrey" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenRussianAI/andrey", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use OpenRussianAI/andrey with Docker Model Runner:
docker model run hf.co/OpenRussianAI/andrey
File size: 4,770 Bytes
dbcb7ce ae15ee7 dbcb7ce ae15ee7 6c4cad3 dbcb7ce a830a4e 7514816 ae15ee7 7514816 ae15ee7 7514816 ae15ee7 7514816 ae15ee7 7514816 ae15ee7 7514816 ae15ee7 7514816 ae15ee7 7514816 ae15ee7 7514816 ae15ee7 7514816 ae15ee7 7514816 ae15ee7 7514816 ae15ee7 7514816 ae15ee7 7514816 ae15ee7 7514816 ae15ee7 7514816 ae15ee7 7514816 ae15ee7 7514816 9b7644e ae15ee7 650ccc2 7514816 | 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 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | ---
language:
- ru
license: mit
library_name: transformers
pipeline_tag: text-generation
tags:
- text-generation
- chat
- russian
- transformer
- pytorch
- easyformer
- custom_code
- conversational
datasets:
- custom
model_type: transformer
base_model: OpenRussianAI/andrey
model-index:
- name: Andrey
results:
- task:
type: text-generation
name: Text Generation
dataset:
type: custom
name: Andrey-Dataset-v2
metrics:
- name: Train Loss
type: loss
value: 0.60
- name: Val Loss
type: loss
value: 0.98
- name: Perplexity
type: perplexity
value: 2.66
- name: IDK Accuracy
type: accuracy
value: 95.6
---
# Andrey — EasyFormer 3.65M
Лёгкий русскоязычный чат-бот на архитектуре EasyFormer.
Упрощённый decoder-only Transformer, ~3.65M параметров.
## О модели
Andrey — компактный русскоязычный чат-бот на собственной архитектуре EasyFormer.
Внутри — упрощения для скорости: RMSNorm, FFN×2, weight tying.
Обучен честно признаваться в незнании на вопросы, ответа на которые у него нет.
## Архитектура
| Параметр | Значение |
|---|---|
| Тип | decoder-only Transformer |
| Параметров | ~3.65M |
| Слоёв | 6 |
| d_model | 256 |
| Голов | 4 |
| FFN | ×2, ReLU |
| Нормализация | RMSNorm |
| Контекст | 512 токенов |
| Токенизатор | BPE, vocab 1412 |
| Weight tying | lm_head ↔ tok_emb |
## Быстрый старт
```bash
pip install transformers torch huggingface_hub tokenizers
```
```python
import torch
from transformers.dynamic_module_utils import get_class_from_dynamic_module
from tokenizers import Tokenizer
from huggingface_hub import hf_hub_download
REPO = "OpenRussianAI/andrey"
cfg_cls = get_class_from_dynamic_module("configuration_easyformer.EasyFormerConfig", REPO)
model_cls = get_class_from_dynamic_module("modeling_easyformer.EasyFormerLMHeadModel", REPO)
cfg = cfg_cls.from_pretrained(REPO)
model = model_cls.from_pretrained(REPO, config=cfg).eval()
tok = Tokenizer.from_file(hf_hub_download(REPO, "tokenizer.json"))
def ask(q, max_new=40, temp=0.6, top_k=20):
text = f"[USER] {q}[EOS][BOT] "
ids = tok.encode(text).ids
input_ids = torch.tensor([ids], dtype=torch.long)
with torch.no_grad():
out = model.generate(input_ids, max_new_tokens=max_new,
do_sample=True, temperature=temp, top_k=top_k)
result = tok.decode(out[0].tolist())
return result.split("[BOT]", 1)[-1].split("[USER]", 1)[0].strip()
print(ask("привет"))
```
## Примеры диалогов
```
User: привет
Bot: привет, рад тебя видеть
User: как дела
Bot: хорошо, готов помочь
User: кто ты
Bot: я лёгкий чат-бот на EasyFormer
User: пока
Bot: до встречи
User: какой пароль от моей почты?
Bot: не знаю, если честно.
User: что я ел вчера?
Bot: без понятия, извини.
User: который час?
Bot: не могу ответить точно — не знаю.
```
## Обучение
| Параметр | Значение |
|---|---|
| Диалогов | 3895 |
| Отказов | ~600 |
| Шагов | 8000 |
| Батч | 16 |
| Grad accum | 2 |
| Оптимизатор | AdamW, lr=3e-4 |
| Scheduler | cosine + warmup 300 |
| Устройство | CUDA |
| Loss | 0.60 |
Отказы в loss весят ×2.
## Структура репо
```
OpenRussianAI/andrey/
├── README.md
├── config.json
├── configuration_easyformer.py
├── modeling_easyformer.py
├── model.safetensors
└── tokenizer.json
```
## Ограничения
- С матешей плоховато: сложные примеры решает неуверенно
- Что вне датасета — мусор: модель знает только темы из обучения
- Нет истории диалога: каждый запрос независим
- Контекст 512 токенов, дальше обрезается
- Отказы работают на типовых ловушках, на необычные вопросы может ответить уверенно и неправильно
- Обучена на 3895 диалогах — словарный запас и круг тем ограничены
## Лицензия
MIT
## Сайт EasyFormer
https://sites.google.com/view/easyformer/home
|