Irbis
Collection
The first Kazakh large language model • 2 items • Updated • 1
How to use Gen2B/Irbis-7b-v0.1 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Gen2B/Irbis-7b-v0.1") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Gen2B/Irbis-7b-v0.1")
model = AutoModelForCausalLM.from_pretrained("Gen2B/Irbis-7b-v0.1")How to use Gen2B/Irbis-7b-v0.1 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Gen2B/Irbis-7b-v0.1"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Gen2B/Irbis-7b-v0.1",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/Gen2B/Irbis-7b-v0.1
How to use Gen2B/Irbis-7b-v0.1 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Gen2B/Irbis-7b-v0.1" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Gen2B/Irbis-7b-v0.1",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "Gen2B/Irbis-7b-v0.1" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Gen2B/Irbis-7b-v0.1",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use Gen2B/Irbis-7b-v0.1 with Docker Model Runner:
docker model run hf.co/Gen2B/Irbis-7b-v0.1
Irbis-7B - это языковая модель на основе архитектуры трансформеров, адаптированная для казахского языка.
В результате модель показывает значительно лучшее качество работы с казахским языком по сравнению с прочими моделями из открытых источников. За счет нового токенизатора увеличилась скорость генерации текста в 3-4 раза, также оптимизировалось заполнение контекстного окна.
Подробнее можно почитать в статье.
from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig
import torch
model_name = "Gen2B/Irbis-7b-v0.1"
model = AutoModelForCausalLM.from_pretrained(
model_name,
return_dict=True,
torch_dtype=torch.float16,
device_map="auto")
tokenizer = AutoTokenizer.from_pretrained(model_name)
prompt = "Сұрақ: Шөп неге жасыл?\nЖауап: "
input_ids = tokenizer([prompt], return_tensors = "pt")["input_ids"].to("cuda")
generation_config = GenerationConfig(
temperature=0.6,
repetition_penalty=1.15
)
print("Generating...")
generation_output = model.generate(
input_ids=input_ids,
generation_config=generation_config,
return_dict_in_generate=True,
output_scores=True,
max_new_tokens=2048,
pad_token_id=tokenizer.eos_token_id,
)
for s in generation_output.sequences:
print(tokenizer.decode(s)) # Өсімдіктер ауасыз өмір сүре алмайды, сондықтан олар жасыл түсті болады.