Instructions to use Dibachain/Diba-Vision with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Dibachain/Diba-Vision with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Dibachain/Diba-Vision", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoModelForImageTextToText model = AutoModelForImageTextToText.from_pretrained("Dibachain/Diba-Vision", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Dibachain/Diba-Vision with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Dibachain/Diba-Vision" # 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-Vision", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/Dibachain/Diba-Vision
- SGLang
How to use Dibachain/Diba-Vision 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-Vision" \ --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-Vision", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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-Vision" \ --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-Vision", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use Dibachain/Diba-Vision with Docker Model Runner:
docker model run hf.co/Dibachain/Diba-Vision
Diba-Vision · دیبا-ویژن
A Persian-first vision-language model by Dibachain مدل بینایی-زبانی فارسیمحور، ساختهی دیباچین
🌐 dibachain.ir · 🤖 Agent · Chat demo (GPU) · Diba-Base · Diba-Embed
English
Diba-Vision sees images and answers in Persian and English. It joins the vision understanding of a strong multimodal encoder with the Persian language ability of the Diba family, so it can look at a picture, a document, or a screenshot and talk about it fluently in Persian — where most open vision models are weak.
What it can do
- Describe images in natural Persian or English.
- Read text in images — Persian and English signs, documents, forms, and handwriting‑style print (OCR‑like understanding).
- Analyze screenshots — UI screens, charts, tables, and screenshots of code.
- Answer questions about a picture — "what is happening here?", "what does this sign say?", "what is wrong with this UI?".
- Reason across image + text in a single conversation.
Inputs and outputs
- Input: one or more images together with a text prompt (multi‑turn chat supported).
- Output: text, in the language of your question.
Specifications
| Type | Vision‑language model (image + text → text) |
| Parameters | ~4B |
| Languages | Persian‑first, plus English |
| License | Apache 2.0 |
Quick start
from transformers import AutoModelForImageTextToText, AutoProcessor
from PIL import Image
import torch
model = AutoModelForImageTextToText.from_pretrained(
"Dibachain/Diba-Vision", trust_remote_code=True, dtype=torch.bfloat16, device_map="auto")
processor = AutoProcessor.from_pretrained("Dibachain/Diba-Vision", trust_remote_code=True)
messages = [{"role": "user", "content": [
{"type": "image", "image": "path/or/url/to/image.jpg"},
{"type": "text", "text": "این تصویر را به فارسی توضیح بده."},
]}]
inputs = processor.apply_chat_template(messages, add_generation_prompt=True,
tokenize=True, return_dict=True, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=512)
print(processor.batch_decode(out[:, inputs["input_ids"].shape[1]:], skip_special_tokens=True)[0])
Diba-Vision ships with the Diba model definition, so pass
trust_remote_code=Truewhen loading.
Intended use and limitations
Diba-Vision is for understanding images and answering about them, not for generating images. Quality is strongest on everyday photos, documents, and screens; very small text, low‑quality scans, or highly specialized diagrams may be misread. It reflects biases present in its training data. For text‑only chat and code use Diba-Base; for semantic search use Diba-Embed.
فارسی
دیبا-ویژن عکس را میبیند و به فارسی و انگلیسی پاسخ میدهد. این مدل، درک تصویری یک رمزگذار چندحالتهی قوی را با توانایی زبان فارسیِ خانوادهی دیبا ترکیب میکند؛ پس میتواند به یک عکس، سند یا اسکرینشات نگاه کند و روان دربارهاش فارسی حرف بزند، جایی که بیشتر مدلهای بینایی متنباز ضعیفاند.
چه کارهایی انجام میدهد
- توصیف تصویر به فارسی یا انگلیسیِ روان.
- خواندن متن داخل تصویر: تابلوها، اسناد، فرمها و متنهای فارسی و انگلیسی (درک شبیه به OCR).
- تحلیل اسکرینشات: صفحههای رابط کاربری، نمودار، جدول و اسکرینشات کد.
- پاسخ به پرسش دربارهی عکس: «اینجا چه خبر است؟»، «این تابلو چه نوشته؟»، «مشکل این رابط کاربری چیست؟».
- استدلال همزمان روی تصویر و متن در یک گفتگو.
ورودی و خروجی
- ورودی: یک یا چند تصویر همراه با یک پرسش متنی (گفتگوی چندمرحلهای پشتیبانی میشود).
- خروجی: متن، به همان زبان پرسش شما.
مشخصات
| نوع | مدل بینایی-زبانی (تصویر + متن ← متن) |
| تعداد پارامتر | حدود ۴ میلیارد |
| زبانها | فارسیمحور، بههمراه انگلیسی |
| مجوز | Apache 2.0 |
شروع سریع
از همان کد بخش انگلیسی استفاده کنید. هنگام بارگذاری، trust_remote_code=True را بدهید و برای پرسشهای جستوجو تصویر و متن را با هم بفرستید.
کاربرد و محدودیتها
دیبا-ویژن برای درک تصویر و پاسخ دربارهی آن است، نه برای تولید تصویر. بهترین کیفیت روی عکسهای روزمره، اسناد و صفحههاست؛ متنهای بسیار ریز، اسکنهای بیکیفیت یا نمودارهای خیلی تخصصی ممکن است اشتباه خوانده شوند. مدل سوگیریهای دادهی خود را بازتاب میدهد. برای گفتگوی متنی و کد از Diba-Base و برای جستوجوی معنایی از Diba-Embed استفاده کنید.
- Downloads last month
- 57