Instructions to use loay/English-Document-OCR-Qwen3.5-2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use loay/English-Document-OCR-Qwen3.5-2B with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="loay/English-Document-OCR-Qwen3.5-2B", filename="english-document-ocr-qwen3.5-2b-f16.gguf", )
llm.create_chat_completion( 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" } } ] } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use loay/English-Document-OCR-Qwen3.5-2B with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf loay/English-Document-OCR-Qwen3.5-2B:Q4_K_M # Run inference directly in the terminal: llama-cli -hf loay/English-Document-OCR-Qwen3.5-2B:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf loay/English-Document-OCR-Qwen3.5-2B:Q4_K_M # Run inference directly in the terminal: llama-cli -hf loay/English-Document-OCR-Qwen3.5-2B: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 loay/English-Document-OCR-Qwen3.5-2B:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf loay/English-Document-OCR-Qwen3.5-2B: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 loay/English-Document-OCR-Qwen3.5-2B:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf loay/English-Document-OCR-Qwen3.5-2B:Q4_K_M
Use Docker
docker model run hf.co/loay/English-Document-OCR-Qwen3.5-2B:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use loay/English-Document-OCR-Qwen3.5-2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "loay/English-Document-OCR-Qwen3.5-2B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "loay/English-Document-OCR-Qwen3.5-2B", "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/loay/English-Document-OCR-Qwen3.5-2B:Q4_K_M
- Ollama
How to use loay/English-Document-OCR-Qwen3.5-2B with Ollama:
ollama run hf.co/loay/English-Document-OCR-Qwen3.5-2B:Q4_K_M
- Unsloth Studio new
How to use loay/English-Document-OCR-Qwen3.5-2B 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 loay/English-Document-OCR-Qwen3.5-2B 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 loay/English-Document-OCR-Qwen3.5-2B to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for loay/English-Document-OCR-Qwen3.5-2B to start chatting
- Pi new
How to use loay/English-Document-OCR-Qwen3.5-2B with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf loay/English-Document-OCR-Qwen3.5-2B:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "loay/English-Document-OCR-Qwen3.5-2B:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use loay/English-Document-OCR-Qwen3.5-2B with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf loay/English-Document-OCR-Qwen3.5-2B: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 loay/English-Document-OCR-Qwen3.5-2B:Q4_K_M
Run Hermes
hermes
- Docker Model Runner
How to use loay/English-Document-OCR-Qwen3.5-2B with Docker Model Runner:
docker model run hf.co/loay/English-Document-OCR-Qwen3.5-2B:Q4_K_M
- Lemonade
How to use loay/English-Document-OCR-Qwen3.5-2B with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull loay/English-Document-OCR-Qwen3.5-2B:Q4_K_M
Run and chat with the model
lemonade run user.English-Document-OCR-Qwen3.5-2B-Q4_K_M
List all available models
lemonade list
English-Document-OCR-Qwen3.5-2B
I built this model as part of my ongoing work in document digitization and archival OCR. My goal was to create a small, locally-runnable model that punches above its weight class, and I'm happy to say it does: despite being only 2B parameters, it outperforms several larger frontier models on text extraction from complex document layouts, including dense multi-column newsprint, historical serif typefaces, and degraded archival scans.
This is the first release. I'll be sharing updated versions with broader language coverage and improved layout handling soon. If you try it on your documents, I'd love to hear how it performs, feel free to leave feedback in the Community tab.
License: This model is intended for personal and research use only. If you want to use this model in a product or service, or need to process documents commercially, contact ocr@loay.net.
Model Details
- Fine-tuned by: loay
- Base Model:
unsloth/Qwen3.5-2B - Task: Document OCR
- Training Data: 8,000 synthetic English document images with ground-truth Markdown transcriptions, featuring faded ink, bleed-through artifacts, skewed layouts, and historical serif typefaces
- Output Format: Markdown text preserving paragraph flow and layout structure
- Language Support: Optimized for English and other left-to-right (LTR) scripts. See my OCR finetuned models for right-to-left document OCR.
Usage
The model does not require a specific prompt. It will perform OCR on any document image by default. To achieve the best results and prevent conversational hallucinations, use the exact instruction the model was fine-tuned on:
Extract all text from this document image and output it in markdown format.
GGUF & Local Inference
Quantized GGUF files are available for use with llama.cpp, LM Studio, Ollama, and similar runtimes.
You must load
mmproj-english-document-ocr-qwen3.5-2b-f16.ggufalongside your chosen weight file. Without the multimodal projector, the model cannot process images.
| File | Use Case |
|---|---|
english-document-ocr-qwen3.5-2b-f16.gguf |
Full precision, maximum accuracy |
english-document-ocr-qwen3.5-2b-q8_0.gguf |
Best quality/size tradeoff for OCR precision |
english-document-ocr-qwen3.5-2b-q6_k.gguf |
High quality, lower VRAM |
english-document-ocr-qwen3.5-2b-q5_k_m.gguf |
Balanced quality and speed |
english-document-ocr-qwen3.5-2b-q4_k_m.gguf |
Fast, efficient local inference |
mmproj-english-document-ocr-qwen3.5-2b-f16.gguf |
Required multimodal projector (load with any weight above) |
Example with llama.cpp:
llama-cli \
--model english-document-ocr-qwen3.5-2b-q4_k_m.gguf \
--mmproj mmproj-english-document-ocr-qwen3.5-2b-f16.gguf \
--image your_document.jpg
Limitations
- Trained exclusively on synthetic data. May degrade on severe real-world scan artifacts outside the training distribution.
- No handwriting support, relies on base model zero-shot for cursive or marginalia.
- Does not extract mathematical formulas, charts, or scientific figures.
- Optimized for LTR latin scripts. For Arabic/RTL documents, see my OCR models.
- May hallucinate or break on very long context from dense pages. If your document is text-heavy, consider splitting it into sections before inference.
- Downloads last month
- 245
4-bit
5-bit
6-bit
8-bit
16-bit