Text Generation
Transformers
Safetensors
Kazakh
Russian
English
qwen3
kazakh
multilingual
instruction-tuned
function-calling
conversational
text-generation-inference
Instructions to use nur-dev/farabi-1.7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nur-dev/farabi-1.7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nur-dev/farabi-1.7b") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("nur-dev/farabi-1.7b") model = AutoModelForCausalLM.from_pretrained("nur-dev/farabi-1.7b", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nur-dev/farabi-1.7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nur-dev/farabi-1.7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nur-dev/farabi-1.7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/nur-dev/farabi-1.7b
- SGLang
How to use nur-dev/farabi-1.7b 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 "nur-dev/farabi-1.7b" \ --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": "nur-dev/farabi-1.7b", "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 "nur-dev/farabi-1.7b" \ --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": "nur-dev/farabi-1.7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use nur-dev/farabi-1.7b with Docker Model Runner:
docker model run hf.co/nur-dev/farabi-1.7b
Farabi-1.7B
Multilingual instruction-tuned LLM for Kazakh / Russian / English. Supports function calling.
vLLM (server)
pip install "vllm>=0.9.0"
vllm serve nur-dev/farabi-1.7b \
--dtype bfloat16 \
--max-model-len 32768 \
--gpu-memory-utilization 0.85 \
--enable-auto-tool-choice \
--tool-call-parser hermes
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "nur-dev/farabi-1.7b",
"messages": [{"role": "user", "content": "Қазақстанның астанасы қай қала?"}],
"temperature": 0.4,
"top_p": 0.9,
"presence_penalty": 0.5,
"frequency_penalty": 0.2,
"max_tokens": 256
}'
vLLM (offline)
from vllm import LLM, SamplingParams
from transformers import AutoTokenizer
ckpt = "nur-dev/farabi-1.7b"
tok = AutoTokenizer.from_pretrained(ckpt)
llm = LLM(model=ckpt, dtype="bfloat16", max_model_len=32768)
sp = SamplingParams(
temperature=0.4, top_p=0.9, max_tokens=512,
presence_penalty=0.5, frequency_penalty=0.2,
stop_token_ids=[tok.encode("<|im_end|>", add_special_tokens=False)[0]],
)
text = tok.apply_chat_template(
[{"role": "user", "content": "17 қой × 3 қозы = ?"}],
tokenize=False, add_generation_prompt=True,
)
print(llm.generate([text], sp)[0].outputs[0].text)
transformers
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
ckpt = "nur-dev/farabi-1.7b"
tok = AutoTokenizer.from_pretrained(ckpt)
model = AutoModelForCausalLM.from_pretrained(ckpt, dtype=torch.bfloat16, device_map="cuda:0")
eos = tok.encode("<|im_end|>", add_special_tokens=False)[0]
messages = [{"role": "user", "content": "Расскажи кратко об экосистеме горного Алтая."}]
text = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
enc = tok(text, return_tensors="pt", add_special_tokens=False).to("cuda:0")
out = model.generate(
**enc, max_new_tokens=512,
do_sample=True, temperature=0.4, top_p=0.9,
repetition_penalty=1.1,
eos_token_id=eos, pad_token_id=tok.eos_token_id,
)
print(tok.decode(out[0, enc["input_ids"].shape[1]:], skip_special_tokens=True))
Tool calling
tools = [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Қаладағы ағымдағы ауа-райын алады.",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string", "description": "Қала атауы"}},
"required": ["city"],
},
},
}]
messages = [
{"role": "system", "content": "Сен қазақша көмекшісің. Қажет болса, ауа-райы құралын шақыр."},
{"role": "user", "content": "Бүгін Астанадағы ауа-райы қандай?"},
]
text = tok.apply_chat_template(messages, tools=tools, tokenize=False, add_generation_prompt=True)
Sampling
Recommended (anti-loop) defaults:
| param | value |
|---|---|
temperature |
0.4 |
top_p |
0.9 |
presence_penalty (vLLM) |
0.5 |
frequency_penalty (vLLM) |
0.2 |
repetition_penalty (transformers) |
1.1 |
stop |
`< |
On short-form KK reasoning prompts the model can loop with the temperature=0.6 / top_p=0.95 defaults. The settings above are tuned to suppress that mode. Greedy (temperature=0) is not recommended.
License
Apache 2.0.
- Downloads last month
- 4