Instructions to use nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF 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 nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF:Q4_0_ROCMFP # Run inference directly in the terminal: llama cli -hf nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF:Q4_0_ROCMFP
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF:Q4_0_ROCMFP # Run inference directly in the terminal: llama cli -hf nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF:Q4_0_ROCMFP
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 nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF:Q4_0_ROCMFP # Run inference directly in the terminal: ./llama-cli -hf nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF:Q4_0_ROCMFP
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 nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF:Q4_0_ROCMFP # Run inference directly in the terminal: ./build/bin/llama-cli -hf nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF:Q4_0_ROCMFP
Use Docker
docker model run hf.co/nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF:Q4_0_ROCMFP
- LM Studio
- Jan
- vLLM
How to use nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF", "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/nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF:Q4_0_ROCMFP
- Ollama
How to use nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF with Ollama:
ollama run hf.co/nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF:Q4_0_ROCMFP
- Unsloth Desktop
- Pi
How to use nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF:Q4_0_ROCMFP
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": "nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF:Q4_0_ROCMFP" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF with Docker Model Runner:
docker model run hf.co/nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF:Q4_0_ROCMFP
- Lemonade
How to use nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF:Q4_0_ROCMFP
Run and chat with the model
lemonade run user.typhoon-ocr1.5-2b-ROCMFP4-GGUF-Q4_0_ROCMFP
List all available models
lemonade list
- Hermes Agent
How to use nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF:Q4_0_ROCMFP
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 nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF:Q4_0_ROCMFP
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF:Q4_0_ROCMFP
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 "nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF:Q4_0_ROCMFP" \ --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"
Typhoon-OCR 1.5 2B โ ROCmFP4 GGUF (Thai iMatrix Calibrated)
This repository provides ROCmFP4 quantized GGUF weights for typhoon-ai/typhoon-ocr1.5-2b, calibrated specifically for high-fidelity Thai document OCR using Importance Matrix (iMatrix).
The text backbone is quantized to Q4_0_ROCMFP4 (UE4M3-scale experimental with Q6_K token embeddings), while the Vision Projector (mmproj-f16.gguf) remains unquantized in full FP16 to ensure zero loss in visual document resolution.
๐ Key Highlights
- 41% Smaller than Q8_0 (67% Smaller than FP16): Text backbone compressed down to 1.08 GB (from 3.28 GB FP16).
- High-Precision Thai Preservation: Calibrated on a custom Thai Calibration Mix (70% general Thai corpus + 30% complex Thai official & legal documents), preventing degradation of Thai vowels, tone marks (เธงเธฃเธฃเธเธขเธธเธเธเน), and specialized vocabulary.
- 99.61% Empirical Character Match: Verified against the
Q8_0baseline on multi-page official public sector and legal documents with zero missing tone marks. - Optimized for AMD RDNA3 / RDNA3.5: High inference speed (approx. 28.6 tokens/sec decode) and ultra-low VRAM footprint (approx. 2.1 GB at 16K context) on AMD Radeon 890M / 880M / 780M iGPUs (Strix Point / Strix Halo / Phoenix).
๐ Benchmark & Quality Verification
Empirical test on multi-page dense Thai technical documents:
| Metric | Full FP16 | Q8_0 Baseline | Q4_0_ROCMFP4 (This Model) |
|---|---|---|---|
| Model Size (LLM Backbone) | 3.28 GB | 1.83 GB | 1.08 GB (๐ -41% vs Q8) |
Vision Projector (mmproj) |
782 MB | 782 MB | 782 MB (FP16 unquantized) |
| Total VRAM (16K Context, 2 Slots) | ~5.2 GB | ~3.2 GB | ~2.1 GB (โก -34% VRAM) |
| Decode Speed (Radeon 890M) | ~18 tok/s | ~21โ25 tok/s | ~28.6 tok/s (๐ +20โ30%) |
| Avg Time per Full PDF Page | ~65s | ~45s | ~29.1s |
| Thai OCR Fidelity vs Q8_0 | 100% | 100% | 99.61% match* |
*Note: Thai characters and tone marks are 100% identical; the 0.39% difference is due to minor markdown bold formatting variations.
๐ Repository Files
| File | Size | Description |
|---|---|---|
typhoon-ocr1.5-2b-Q4_0_ROCMFP4-imatrix.gguf |
1.08 GB | Quantized text model backbone (Q4_0_ROCMFP4 with Q6_K token embeddings) |
typhoon-ocr1.5-2b.mmproj-f16.gguf |
781 MB | Full FP16 multimodal vision projector (Required for image/PDF input) |
๐ Quick Start Guide
1. Requirements
- llama.cpp with ROCmFP4 support (or standard Vulkan / HIP-enabled
llama.cppbuilds). - AMD Ryzen AI 300 series (Radeon 890M / 880M), Ryzen 7000/8000 (Radeon 780M), Strix Halo, or discrete AMD Radeon GPUs.
2. Launching llama-server
Run llama-server exposing an OpenAI-compatible vision endpoint:
llama-server \
-m typhoon-ocr1.5-2b-Q4_0_ROCMFP4-imatrix.gguf \
--mmproj typhoon-ocr1.5-2b.mmproj-f16.gguf \
-ngl 99 \
-c 16384 \
-np 2 \
--port 8080 \
--host 0.0.0.0 \
-fa on
Note on Context Window: Set context (
-c) to at least8192per slot (or16384for-np 2) because each high-resolution document image generates ~2,000โ2,500 visual tokens from the vision encoder.
3. Recommended Prompt & Best Practices (From Typhoon AI)
Typhoon-OCR 1.5 is a task-specific model fine-tuned to achieve optimal OCR and structural extraction when invoked with the official prompt structure and image preprocessing rules specified in the official model card.
A. The Official Standard Prompt
For high-fidelity markdown formatting, clean HTML tables, and figure descriptions, use the exact official prompt:
prompt = """Extract all text from the image.
Instructions:
- Only return the clean Markdown.
- Do not include any explanation or extra text.
- You must include all information on the page.
Formatting Rules:
- Tables: Render tables using <table>...</table> in clean HTML format.
- Equations: Render equations using LaTeX syntax with inline ($...$) and block ($$...$$).
- Images/Charts/Diagrams: Wrap any clearly defined visual areas (e.g. charts, diagrams, pictures) in:
<figure>
Describe the image's main elements (people, objects, text), note any contextual clues (place, event, culture), mention visible text and its meaning, provide deeper analysis when relevant (especially for financial charts, graphs, or documents), comment on style or architecture if relevant, then give a concise overall summary. Describe in Thai.
</figure>
- Page Numbers: Wrap page numbers in <page_number>...</page_number> (e.g., <page_number>14</page_number>).
- Checkboxes: Use โ for unchecked and โ for checked boxes."""
B. Fixed Image Dimension & Resizing Rule
Image Scaling: The model was trained with a target dimension of 1800 px. Resizing input images so that their longest dimension does not exceed 1800 px ensures optimal visual token allocation, prevents hallucination, and preserves OCR accuracy.
from PIL import Image
def resize_if_needed(img: Image.Image, max_size: int = 1800) -> Image.Image:
width, height = img.size
if width > max_size or height > max_size:
if width >= height:
scale = max_size / float(width)
new_size = (max_size, int(height * scale))
else:
scale = max_size / float(height)
new_size = (int(width * scale), max_size)
return img.resize(new_size, Image.Resampling.LANCZOS)
return img
C. Option 1: Using the Official typhoon-ocr Library
Because llama-server provides an OpenAI-compatible endpoint, you can use the official typhoon-ocr library directly with your local server:
pip install typhoon-ocr -U
from typhoon_ocr import ocr_document
# Connect directly to your local llama-server
markdown = ocr_document(
"document_page.png",
model="typhoon-ocr",
figure_language="Thai",
task_type="v1.5",
base_url="http://localhost:8080/v1",
api_key="no-key"
)
print(markdown)
D. Option 2: Direct Python Client (Requests / OpenAI API)
import base64
import io
import requests
from PIL import Image
def ocr_image(image_path: str, server_url: str = "http://localhost:8080/v1/chat/completions"):
# 1. Resize image according to official 1800px guideline
img = Image.open(image_path)
img = resize_if_needed(img, 1800)
buf = io.BytesIO()
img.save(buf, format="PNG")
img_b64 = base64.b64encode(buf.getvalue()).decode("utf-8")
# 2. Official prompt
prompt = """Extract all text from the image.
Instructions:
- Only return the clean Markdown.
- Do not include any explanation or extra text.
- You must include all information on the page.
Formatting Rules:
- Tables: Render tables using <table>...</table> in clean HTML format.
- Equations: Render equations using LaTeX syntax with inline ($...$) and block ($$...$$).
- Images/Charts/Diagrams: Wrap any clearly defined visual areas (e.g. charts, diagrams, pictures) in:
<figure>
Describe the image's main elements (people, objects, text), note any contextual clues (place, event, culture), mention visible text and its meaning, provide deeper analysis when relevant (especially for financial charts, graphs, or documents), comment on style or architecture if relevant, then give a concise overall summary. Describe in Thai.
</figure>
- Page Numbers: Wrap page numbers in <page_number>...</page_number> (e.g., <page_number>14</page_number>).
- Checkboxes: Use โ for unchecked and โ for checked boxes."""
payload = {
"model": "typhoon-ocr1.5-2b",
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": prompt},
{"type": "image_url", "image_url": {"url": f"data:image/png;base64,{img_b64}"}}
]
}
],
"temperature": 0.0,
"max_tokens": 8192
}
response = requests.post(server_url, json=payload, timeout=300)
return response.json()["choices"][0]["message"]["content"]
# Example usage:
# print(ocr_image("sample_page.png"))
4. Intended Uses & Limitations
- Task-Specific: This model is designed specifically for document OCR using the prescribed prompt format. It does not include conversational chat guardrails or general Visual Question Answering (VQA) capabilities.
- Hallucination Risk: Due to the nature of vision-language models, slight hallucinations may occur on degraded, low-resolution, or heavily blurred images. Always review critical extractions.
๐ Credits & Acknowledgements
We express our deep appreciation and credit to the original creators and open-source contributors:
- Original Model Creators:
- SCB 10X / Typhoon AI Team for creating the state-of-the-art Thai Vision-Language OCR model:
- Model:
typhoon-ai/typhoon-ocr1.5-2b - Organization: SCB 10X
- Model:
- SCB 10X / Typhoon AI Team for creating the state-of-the-art Thai Vision-Language OCR model:
- GGUF Conversion:
- mradermacher (Nico) for the initial GGUF conversion and hosting the base FP16 GGUF weights:
- Model Repository:
mradermacher/typhoon-ocr1.5-2b-GGUF
- Model Repository:
- mradermacher (Nico) for the initial GGUF conversion and hosting the base FP16 GGUF weights:
- ROCmFP4 Runtime & Engine:
- charlie12345 for the ROCmFP4 experimental implementation in
charlie12345/rocmfp4-llamaenabling native 4-bit float acceleration on AMD iGPUs and Vulkan/HIP. - Georgi Gerganov & the llama.cpp community for the foundational inference framework.
- charlie12345 for the ROCmFP4 experimental implementation in
- Calibration Dataset:
- eaddario for the
eaddario/imatrix-calibrationdataset used in the Thai token importance matrix calculation.
- eaddario for the
๐ License
This model inherits the Apache 2.0 license from the base scb10x/typhoon-ocr1.5-2b model.
- Downloads last month
- 41
4-bit
Model tree for nanash66/typhoon-ocr1.5-2b-ROCMFP4-GGUF
Base model
Qwen/Qwen3-VL-2B-Instruct