Text Generation
Transformers
PyTorch
ONNX
Russian
transformer
feature-extraction
chat
russian
easyformer
custom_code
conversational
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 AutoModel model = AutoModel.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
Update configuration_easyformer.py
Browse files- configuration_easyformer.py +34 -5
configuration_easyformer.py
CHANGED
|
@@ -1,17 +1,17 @@
|
|
| 1 |
-
|
| 2 |
from transformers import PretrainedConfig
|
| 3 |
|
| 4 |
class EasyFormerConfig(PretrainedConfig):
|
| 5 |
-
model_type = "transformer"
|
| 6 |
|
| 7 |
def __init__(
|
| 8 |
self,
|
| 9 |
-
vocab_size=
|
| 10 |
d_model=192,
|
| 11 |
n_layer=5,
|
| 12 |
n_head=4,
|
| 13 |
ctx=128,
|
| 14 |
-
dropout=0.
|
| 15 |
**kwargs,
|
| 16 |
):
|
| 17 |
super().__init__(**kwargs)
|
|
@@ -20,4 +20,33 @@ class EasyFormerConfig(PretrainedConfig):
|
|
| 20 |
self.n_layer = n_layer
|
| 21 |
self.n_head = n_head
|
| 22 |
self.ctx = ctx
|
| 23 |
-
self.dropout = dropout
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# configuration_easyformer.py
|
| 2 |
from transformers import PretrainedConfig
|
| 3 |
|
| 4 |
class EasyFormerConfig(PretrainedConfig):
|
| 5 |
+
model_type = "transformer"
|
| 6 |
|
| 7 |
def __init__(
|
| 8 |
self,
|
| 9 |
+
vocab_size=8000,
|
| 10 |
d_model=192,
|
| 11 |
n_layer=5,
|
| 12 |
n_head=4,
|
| 13 |
ctx=128,
|
| 14 |
+
dropout=0.1,
|
| 15 |
**kwargs,
|
| 16 |
):
|
| 17 |
super().__init__(**kwargs)
|
|
|
|
| 20 |
self.n_layer = n_layer
|
| 21 |
self.n_head = n_head
|
| 22 |
self.ctx = ctx
|
| 23 |
+
self.dropout = dropout
|
| 24 |
+
|
| 25 |
+
# --- HF-совместимые property ---
|
| 26 |
+
@property
|
| 27 |
+
def num_hidden_layers(self):
|
| 28 |
+
return self.n_layer
|
| 29 |
+
|
| 30 |
+
@property
|
| 31 |
+
def hidden_size(self):
|
| 32 |
+
return self.d_model
|
| 33 |
+
|
| 34 |
+
@property
|
| 35 |
+
def num_attention_heads(self):
|
| 36 |
+
return self.n_head
|
| 37 |
+
|
| 38 |
+
@property
|
| 39 |
+
def intermediate_size(self):
|
| 40 |
+
return 2 * self.d_model
|
| 41 |
+
|
| 42 |
+
@property
|
| 43 |
+
def max_position_embeddings(self):
|
| 44 |
+
return self.ctx
|
| 45 |
+
|
| 46 |
+
@property
|
| 47 |
+
def num_key_value_heads(self):
|
| 48 |
+
return self.n_head
|
| 49 |
+
|
| 50 |
+
@property
|
| 51 |
+
def head_dim(self):
|
| 52 |
+
return self.d_model // max(1, self.n_head)
|