Instructions to use Dibachain/Diba-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Dibachain/Diba-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Dibachain/Diba-Base", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Dibachain/Diba-Base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Dibachain/Diba-Base with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf Dibachain/Diba-Base:Q4_K_M # Run inference directly in the terminal: llama cli -hf Dibachain/Diba-Base:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Dibachain/Diba-Base:Q4_K_M # Run inference directly in the terminal: llama cli -hf Dibachain/Diba-Base:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf Dibachain/Diba-Base:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf Dibachain/Diba-Base:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf Dibachain/Diba-Base:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf Dibachain/Diba-Base:Q4_K_M
Use Docker
docker model run hf.co/Dibachain/Diba-Base:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use Dibachain/Diba-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Dibachain/Diba-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Dibachain/Diba-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Dibachain/Diba-Base:Q4_K_M
- SGLang
How to use Dibachain/Diba-Base 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 "Dibachain/Diba-Base" \ --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": "Dibachain/Diba-Base", "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 "Dibachain/Diba-Base" \ --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": "Dibachain/Diba-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use Dibachain/Diba-Base with Ollama:
ollama run hf.co/Dibachain/Diba-Base:Q4_K_M
- Unsloth Desktop
- Pi
How to use Dibachain/Diba-Base with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Dibachain/Diba-Base:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Dibachain/Diba-Base:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use Dibachain/Diba-Base with Docker Model Runner:
docker model run hf.co/Dibachain/Diba-Base:Q4_K_M
- Lemonade
How to use Dibachain/Diba-Base with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Dibachain/Diba-Base:Q4_K_M
Run and chat with the model
lemonade run user.Diba-Base-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use Dibachain/Diba-Base with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Dibachain/Diba-Base:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default Dibachain/Diba-Base:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use Dibachain/Diba-Base with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Dibachain/Diba-Base:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "Dibachain/Diba-Base:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Diba-Base · دیبا
A Persian-first chat & code model that runs on a CPU مدل گفتگو و کدنویسی فارسیمحور که روی CPU اجرا میشود
🌐 dibachain.ir · Chat (GPU) · Chat (CPU) · Diba-Embed · Diba-Vision · Diba-STT
English
Diba-Base is a ~4B‑parameter model from Dibachain, built to be excellent at Persian, to know Iran — including its contemporary history — and to write code from Persian or English prompts. It runs offline on a CPU via GGUF, replies in the language you write in, and supports tool calling.
How it compares
Measured against same‑size open models on identical prompts and tests (greedy decoding): 20 Python and 20 JavaScript tasks with real unit tests, 40 Iran‑history questions, and whether the model replies in the user's language.
| Model | Python | JavaScript | Iran history (fa) | Replies in Persian |
|---|---|---|---|---|
| Diba-Base | 13/20 | 13/20 | 29/40 | 10/10 |
| Gemma 3 4B | 11/20 | 12/20 | 15/40 | 10/10 |
| Granite 4.0 Micro 3B | 14/20 | 11/20 | 11/40 | 10/10 |
| Phi‑4‑mini 3.8B | 11/20 | 10/20 | 5/40 | 10/10 |
| SmolLM3 3B | 11/20 | 10/20 | 4/40 | 9/10 |
For a 4B‑class model, Diba‑Base leads on code, matches the best on replying in the right language, and is far ahead on Persian knowledge of Iran — where general models are weak.
What it can do
- Persian, done right — fluent, written‑register Persian with correct spelling and ZWNJ; replies in the language of your message (Persian in → Persian out, English in → English out).
- Knows Iran — geography, culture and contemporary history.
- Code — Python, JavaScript, TypeScript, and many other languages, from Persian or English prompts.
- Tool calling — give it function definitions and it decides which to call, with arguments.
- Runs offline — a single ~2.8 GB GGUF file on a CPU; no cloud, no GPU.
Quick start
Transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
tok = AutoTokenizer.from_pretrained("Dibachain/Diba-Base", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("Dibachain/Diba-Base", dtype=torch.bfloat16, device_map="auto", trust_remote_code=True)
messages = [
{"role": "system", "content": "تو «دیبا» هستی، دستیار هوش مصنوعی دیباچین. به همان زبانی پاسخ بده که کاربر نوشته است."},
{"role": "user", "content": "یک تابع پایتون بنویس که تشخیص دهد یک رشته پالیندروم است."},
]
ids = tok.apply_chat_template(messages, add_generation_prompt=True, enable_thinking=False, return_tensors="pt").to(model.device)
out = model.generate(ids, max_new_tokens=512, temperature=0)
print(tok.decode(out[0, ids.shape[1]:], skip_special_tokens=True))
Diba-Base ships with the Diba model definition, so pass
trust_remote_code=Truewhen loading with Transformers. For llama.cpp, Ollama and LM Studio just use the GGUF file below — no extra flag needed.
llama.cpp (CPU, GGUF)
llama-server -hf Dibachain/Diba-Base:diba-q4_k_m.gguf -c 8192 --jinja \
--chat-template-kwargs '{"enable_thinking": false}'
Ollama
ollama run hf.co/Dibachain/Diba-Base:diba-q4_k_m.gguf
Recommended settings
- System prompt:
تو «دیبا» هستی، دستیار هوش مصنوعی دیباچین. به همان زبانی پاسخ بده که کاربر نوشته است؛ به فارسی نوشتاری، روشن و مؤدبانه. - Thinking: off (
enable_thinking=false) for direct answers. - Temperature:
0for code and precise answers;0.3for casual chat.
Notes
Diba‑Base is a compact 4B model built for on‑device Persian use. As with any model this size, verify important facts and generated code before relying on them. It reflects the perspectives present in its training data. For images use Diba-Vision, for semantic search Diba-Embed, and for speech‑to‑text Diba-STT.
فارسی
دیبا (Diba-Base) یک مدل حدود ۴ میلیارد پارامتری ساختهی دیباچین است که برای عالی بودن در فارسی، شناخت ایران (از جمله تاریخ معاصر) و کدنویسی از روی دستور فارسی یا انگلیسی ساخته شده. آفلاین روی CPU با GGUF اجرا میشود، به همان زبانی که مینویسید پاسخ میدهد و از فراخوانی ابزار (Tool Calling) پشتیبانی میکند.
مقایسه
روی مدلهای متنباز هماندازه، با پرسشها و تستهای یکسان سنجیده شد: ۲۰ تست پایتون و ۲۰ تست جاوااسکریپت با اجرای واقعی، ۴۰ پرسش تاریخ ایران، و اینکه آیا مدل به زبان کاربر پاسخ میدهد.
| مدل | پایتون | جاوااسکریپت | تاریخ ایران | پاسخ به فارسی |
|---|---|---|---|---|
| دیبا | ۱۳/۲۰ | ۱۳/۲۰ | ۲۹/۴۰ | ۱۰/۱۰ |
| Gemma 3 4B | ۱۱/۲۰ | ۱۲/۲۰ | ۱۵/۴۰ | ۱۰/۱۰ |
| Granite 4.0 Micro 3B | ۱۴/۲۰ | ۱۱/۲۰ | ۱۱/۴۰ | ۱۰/۱۰ |
| Phi‑4‑mini 3.8B | ۱۱/۲۰ | ۱۰/۲۰ | ۵/۴۰ | ۱۰/۱۰ |
| SmolLM3 3B | ۱۱/۲۰ | ۱۰/۲۰ | ۴/۴۰ | ۹/۱۰ |
با توجه به اندازهی ۴ میلیاردی، دیبا در کدنویسی پیشتاز است، در پاسخ به زبان درست همتراز بهترینهاست، و در دانش فارسی دربارهی ایران با اختلاف زیاد جلوتر است؛ جایی که مدلهای عمومی ضعیفاند.
چه کارهایی انجام میدهد
- فارسیِ درست: فارسی نوشتاری روان با رسمالخط و نیمفاصلهی درست؛ پاسخ به همان زبان پیام شما (فارسی ← فارسی، انگلیسی ← انگلیسی).
- شناخت ایران: جغرافیا، فرهنگ و تاریخ معاصر.
- کدنویسی: پایتون، جاوااسکریپت، تایپاسکریپت و زبانهای دیگر، از روی دستور فارسی یا انگلیسی.
- فراخوانی ابزار: تعریف توابع را میدهید و مدل تصمیم میگیرد کدام را با چه ورودیهایی صدا بزند.
- اجرای آفلاین: یک فایل GGUF حدود ۲٫۸ گیگابایتی روی CPU؛ بدون ابر و بدون GPU.
شروع سریع
از همان نمونههای بخش انگلیسی استفاده کنید (Transformers، llama.cpp، Ollama). حالت فکر را خاموش نگه دارید (enable_thinking=false) و برای کد دما را روی ۰ بگذارید.
تنظیمات پیشنهادی
- پرامپت سیستمی:
تو «دیبا» هستی، دستیار هوش مصنوعی دیباچین. به همان زبانی پاسخ بده که کاربر نوشته است؛ به فارسی نوشتاری، روشن و مؤدبانه. - دما:
۰برای کد و پاسخ دقیق،۰٫۳برای گفتگوی راحت.
نکته
دیبا یک مدل جمعوجور ۴ میلیاردی برای اجرای فارسی روی دستگاه است. مانند هر مدل هماندازه، اطلاعات مهم و کدِ تولیدشده را پیش از اتکا بررسی کنید. برای تصویر از Diba-Vision، برای جستوجوی معنایی از Diba-Embed و برای گفتار به متن از Diba-STT استفاده کنید.
- Downloads last month
- -
