Instructions to use NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/qwen2-vl-2b-instruct-unsloth-bnb-4bit") model = PeftModel.from_pretrained(base_model, "NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct") - Transformers
How to use NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct") 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 AutoModel model = AutoModel.from_pretrained("NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct", "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/NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct
- SGLang
How to use NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct 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 "NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct" \ --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": "NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct", "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 "NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct" \ --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": "NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct", "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" } } ] } ] }' - Unsloth Studio
How to use NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct", max_seq_length=2048, ) - Docker Model Runner
How to use NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct with Docker Model Runner:
docker model run hf.co/NAMAA-Space/Qari-OCR-0.1-VL-2B-Instruct
Add link to paper and Github repository, update library_name
Browse filesThis PR adds a link to the paper [QARI-OCR: High-Fidelity Arabic Text Recognition through Multimodal Large Language Model Adaptation](https://huggingface.co/papers/2506.02295) and a link to the Github repository. The `library_name` is also updated from `peft` to `transformers`.
README.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
| 1 |
---
|
| 2 |
base_model:
|
| 3 |
- unsloth/Qwen2-VL-2B-Instruct-unsloth-bnb-4bit
|
| 4 |
-
tags:
|
| 5 |
-
- transformers
|
| 6 |
-
- unsloth
|
| 7 |
-
- qwen2_vl
|
| 8 |
-
- trl
|
| 9 |
-
- ocr
|
| 10 |
-
license: apache-2.0
|
| 11 |
language:
|
| 12 |
- ar
|
|
|
|
|
|
|
| 13 |
metrics:
|
| 14 |
- bleu
|
| 15 |
- wer
|
| 16 |
- cer
|
| 17 |
pipeline_tag: image-text-to-text
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
---
|
| 20 |
|
| 21 |
# Qari-OCR-0.1-VL-2B-Instruct Model
|
|
@@ -24,6 +24,7 @@ library_name: peft
|
|
| 24 |
|
| 25 |
This model is a fine-tuned version of [unsloth/Qwen2-VL-2B-Instruct](https://huggingface.co/unsloth/Qwen2-VL-2B-Instruct-unsloth-bnb-4bit) on an Arabic OCR dataset. It is optimized to perform Arabic Optical Character Recognition (OCR) for full-page text.
|
| 26 |
|
|
|
|
| 27 |
|
| 28 |

|
| 29 |
|
|
@@ -92,7 +93,9 @@ While the Arabic OCR model demonstrates strong performance under specific condit
|
|
| 92 |
|
| 93 |
These limitations should be considered when deploying the model in real-world applications to ensure optimal performance.
|
| 94 |
|
|
|
|
| 95 |
|
|
|
|
| 96 |
|
| 97 |
## How to Use
|
| 98 |
|
|
|
|
| 1 |
---
|
| 2 |
base_model:
|
| 3 |
- unsloth/Qwen2-VL-2B-Instruct-unsloth-bnb-4bit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
language:
|
| 5 |
- ar
|
| 6 |
+
library_name: transformers
|
| 7 |
+
license: apache-2.0
|
| 8 |
metrics:
|
| 9 |
- bleu
|
| 10 |
- wer
|
| 11 |
- cer
|
| 12 |
pipeline_tag: image-text-to-text
|
| 13 |
+
tags:
|
| 14 |
+
- transformers
|
| 15 |
+
- unsloth
|
| 16 |
+
- qwen2_vl
|
| 17 |
+
- trl
|
| 18 |
+
- ocr
|
| 19 |
---
|
| 20 |
|
| 21 |
# Qari-OCR-0.1-VL-2B-Instruct Model
|
|
|
|
| 24 |
|
| 25 |
This model is a fine-tuned version of [unsloth/Qwen2-VL-2B-Instruct](https://huggingface.co/unsloth/Qwen2-VL-2B-Instruct-unsloth-bnb-4bit) on an Arabic OCR dataset. It is optimized to perform Arabic Optical Character Recognition (OCR) for full-page text.
|
| 26 |
|
| 27 |
+
The model is described in the paper [QARI-OCR: High-Fidelity Arabic Text Recognition through Multimodal Large Language Model Adaptation](https://huggingface.co/papers/2506.02295).
|
| 28 |
|
| 29 |

|
| 30 |
|
|
|
|
| 93 |
|
| 94 |
These limitations should be considered when deploying the model in real-world applications to ensure optimal performance.
|
| 95 |
|
| 96 |
+
## Code
|
| 97 |
|
| 98 |
+
https://github.com/NAMAA-ORG/QARI
|
| 99 |
|
| 100 |
## How to Use
|
| 101 |
|