Instructions to use Reza2kn/Bina-0.1-Koochik with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Reza2kn/Bina-0.1-Koochik with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Reza2kn/Bina-0.1-Koochik") 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 AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Reza2kn/Bina-0.1-Koochik") model = AutoModelForMultimodalLM.from_pretrained("Reza2kn/Bina-0.1-Koochik", device_map="auto") 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?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Reza2kn/Bina-0.1-Koochik with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Reza2kn/Bina-0.1-Koochik" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Reza2kn/Bina-0.1-Koochik", "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/Reza2kn/Bina-0.1-Koochik
- SGLang
How to use Reza2kn/Bina-0.1-Koochik 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 "Reza2kn/Bina-0.1-Koochik" \ --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": "Reza2kn/Bina-0.1-Koochik", "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 "Reza2kn/Bina-0.1-Koochik" \ --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": "Reza2kn/Bina-0.1-Koochik", "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 Reza2kn/Bina-0.1-Koochik with Docker Model Runner:
docker model run hf.co/Reza2kn/Bina-0.1-Koochik
Bina 0.1 Koochik — بینا ۰.۱ کوچک
The merged BF16 release of the Persian OCR LoRA checkpoint at step 8,000 from
Reza2kn/surya-ocr-2-persian-lora-7m,
based on datalab-to/surya-ocr-2.
This repository is the immutable BF16 transcription baseline for Bina 0.1 Koochik. Quantized/runtime-specific derivatives should be compared against this model before being described as parity-preserving.
Quick start (English)
Bina 0.1 Koochik is compatible with the Surya OCR 2 inference package. The easiest supported setup is Linux (or WSL2) with an NVIDIA GPU.
1. Install the prerequisites
- Python 3.10 or newer
- Docker
- NVIDIA Container Toolkit
Then install or upgrade Surya:
python -m pip install -U "surya-ocr>=0.20.0"
2. Run OCR
Replace document.pdf with an image, a PDF, or a folder containing images/PDFs:
export SURYA_MODEL_CHECKPOINT=Reza2kn/Bina-0.1-Koochik
export SURYA_INFERENCE_BACKEND=vllm
surya_ocr ./document.pdf --output_dir ./bina-output
On the first run, Surya downloads the model and starts a vLLM server in Docker,
so startup can take a few minutes. For the example above, the OCR result is
written to ./bina-output/document/results.json. Each page contains ordered
blocks with recognized HTML/text, labels, confidence scores, and bounding boxes.
Useful options:
# Process only pages 0 through 2
surya_ocr ./document.pdf --page_range 0-2 --output_dir ./bina-output
# Also save annotated page images
surya_ocr ./document.pdf --images --output_dir ./bina-output
Python example
Set the environment variables before importing surya:
import os
os.environ["SURYA_MODEL_CHECKPOINT"] = "Reza2kn/Bina-0.1-Koochik"
os.environ["SURYA_INFERENCE_BACKEND"] = "vllm"
from PIL import Image
from surya.inference import SuryaInferenceManager
from surya.recognition import RecognitionPredictor
image = Image.open("page.jpg").convert("RGB")
manager = SuryaInferenceManager()
predictor = RecognitionPredictor(manager)
result = predictor([image])[0]
for block in result.blocks:
print(block.html)
CPU and Apple Silicon: this repository contains BF16 weights, not a GGUF build. The automatic
llama.cpppath therefore cannot run Bina 0.1 Koochik directly; use the NVIDIA/vLLM setup above or a Bina-specific GGUF conversion.
راهاندازی سریع (فارسی)
بینا ۰.۱ کوچک با بستهٔ استنتاج Surya OCR 2 سازگار است. سادهترین روش پشتیبانیشده، استفاده از لینوکس (یا WSL2) و کارت گرافیک NVIDIA است.
۱. نصب پیشنیازها
- پایتون ۳.۱۰ یا جدیدتر
- Docker
- NVIDIA Container Toolkit
سپس Surya را نصب یا بهروز کنید:
python -m pip install -U "surya-ocr>=0.20.0"
۲. اجرای OCR
بهجای document.pdf میتوانید مسیر یک تصویر، فایل PDF یا پوشهای از
تصاویر/PDFها را قرار دهید:
export SURYA_MODEL_CHECKPOINT=Reza2kn/Bina-0.1-Koochik
export SURYA_INFERENCE_BACKEND=vllm
surya_ocr ./document.pdf --output_dir ./bina-output
در اجرای اول، Surya مدل را دانلود و سرور vLLM را در Docker راهاندازی میکند؛
بنابراین شروع کار ممکن است چند دقیقه طول بکشد. در مثال بالا، نتیجه در مسیر
./bina-output/document/results.json ذخیره میشود. خروجی هر صفحه شامل بلوکهای
مرتبشده، متن/HTML تشخیصدادهشده، نوع بلوک، میزان اطمینان و مختصات کادرها است.
چند گزینهٔ کاربردی:
# فقط پردازش صفحههای ۰ تا ۲
surya_ocr ./document.pdf --page_range 0-2 --output_dir ./bina-output
# ذخیرهٔ تصویر صفحهها همراه با کادرهای تشخیصدادهشده
surya_ocr ./document.pdf --images --output_dir ./bina-output
نمونهٔ پایتون
متغیرهای محیطی را پیش از import کردن surya تنظیم کنید:
import os
os.environ["SURYA_MODEL_CHECKPOINT"] = "Reza2kn/Bina-0.1-Koochik"
os.environ["SURYA_INFERENCE_BACKEND"] = "vllm"
from PIL import Image
from surya.inference import SuryaInferenceManager
from surya.recognition import RecognitionPredictor
image = Image.open("page.jpg").convert("RGB")
manager = SuryaInferenceManager()
predictor = RecognitionPredictor(manager)
result = predictor([image])[0]
for block in result.blocks:
print(block.html)
CPU و Apple Silicon: این مخزن شامل وزنهای BF16 است و فایل GGUF ندارد؛ بنابراین مسیر خودکار
llama.cppنمیتواند بینا ۰.۱ کوچک را مستقیماً اجرا کند. از روش NVIDIA/vLLM بالا یا یک تبدیل GGUF مخصوص بینا استفاده کنید.
Provenance
- LoRA checkpoint:
checkpoints/checkpoint-step-0008000 - Merged artifact path on the release host:
/home/rezo/triple-threat/hf-cache/surya-step8000-merged - Architecture:
Qwen3_5ForConditionalGeneration - Weight dtype: BF16
model.safetensorsSHA-256:2193be4ef3d2366438121a15b7a1dea2bb85b24f83145e5a39bfa1f387891adaconfig.jsonSHA-256:e0de22be177070f206106c184d062176fcda591d9114068c42489ffc550488de
Intended use
Persian document OCR. The model is currently served as بینا ۰.۱ کوچک on PersianVLM.com. Use deterministic decoding for baseline comparisons.
License
This release follows the upstream Surya OCR 2 OpenRAIL license. Review the upstream license before redistribution or deployment.
- Downloads last month
- 937