Instructions to use commandeaw/DW-KhoTaeVL-OCR-Pro-26B-MLX-LoRA-v0.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use commandeaw/DW-KhoTaeVL-OCR-Pro-26B-MLX-LoRA-v0.1 with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("commandeaw/DW-KhoTaeVL-OCR-Pro-26B-MLX-LoRA-v0.1") config = load_config("commandeaw/DW-KhoTaeVL-OCR-Pro-26B-MLX-LoRA-v0.1") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
DW-KhoTaeVL-OCR-Pro-26B-MLX-LoRA-v0.1
A small LoRA adapter for Gemma 4 26B-A4B MLX 4-bit, focused on Thai OCR-style prompts.
The goal is simple: compare against the unmodified Gemma base and test whether a tiny LoRA can make Thai OCR output shorter and cleaner. This is not a claim against dedicated OCR systems.
What Changed
The adapter mainly improves output discipline. It reduces verbose preambles and makes the model answer OCR prompts more directly.
| Eval set | Metric | Gemma base | + this LoRA | Change |
|---|---|---|---|---|
| ThaiOCRBench subset, n=299 | CER | 3.130 | 1.792 | -43% |
| ThaiOCRBench subset, n=299 | DW-light score | 0.5215 | 0.5382 | +0.017 |
| openthaigpt/thai-ocr-evaluation, n=104 | CER | 2.350 | 1.730 | -26% |
| openthaigpt/thai-ocr-evaluation, n=104 | DW-light score | 0.9009 | 0.9079 | +0.007 |
The score changes are small and within noise. The useful change is CER: the adapter makes the base model less wordy on Thai OCR tasks.
Quickstart
from mlx_vlm import load, generate
from mlx_vlm.prompt_utils import apply_chat_template
from PIL import Image
model, processor = load(
"mlx-community/gemma-4-26b-a4b-it-4bit",
adapter_path="commandeaw/DW-KhoTaeVL-OCR-Pro-26B-MLX-LoRA-v0.1",
)
img = Image.open("doc.jpg").convert("RGB")
messages = [{"role": "user", "content": "ถอดข้อความในภาพ"}]
prompt = apply_chat_template(processor, model.config, messages, num_images=1)
out = generate(
model,
processor,
image=img,
prompt=prompt,
max_tokens=512,
temp=0.0,
verbose=False,
)
print(out.text)
Tested on Apple Silicon with 24 GB+ unified memory. The development run used an M4 Max 64 GB.
Method
This is a rank-4 LoRA trained for 800 iterations with mlx-vlm.
Key choices:
- Rank 4 LoRA: about 5M trainable parameters, roughly 0.077% of the base.
- Very low LR:
1e-6. Higher learning rates caused output collapse in smoke runs. - Retention prompts: 100 iAPP handwriting images with 4 Thai prompt variants each.
- Chunked training: eval every 200 iterations; selected the 800-iteration checkpoint.
- Auto-stop gates: stopped before the 1000-iteration checkpoint because document classification regressed.
- Contamination check: 1 text-overlap sample was excluded from the iAPP train pool.
Training data:
source: iAPP Thai Handwriting Dataset
license: Apache 2.0
train size: 400 records
recipe: 100 unique images x 4 prompt variants
Task Notes
Compared with the Gemma base on ThaiOCRBench:
| Area | Direction |
|---|---|
| Text recognition | improved |
| Table parsing | improved |
| Diagram VQA | improved |
| KIE / KIM / reasoning tasks | mostly preserved |
| Full-page OCR | regressed |
| Document classification | small regression from a base ceiling |
Use the base model instead if full-page OCR is the main task.
Evaluation Notes
ThaiOCRBench numbers use a 299-sample stratified subset with seed 42.
DW-light score is max(substring_match, ANLS). It is a lightweight local scoring protocol, not the full ThaiOCRBench paper protocol. Do not compare these numbers directly to paper leaderboard numbers.
The neutral set is openthaigpt/thai-ocr-evaluation with 104 samples. It was used only for evaluation.
Limitations
- Research preview, not production-certified OCR.
- The adapter improves CER, not broad accuracy.
- Full-page OCR regresses versus the base.
- Mac / MLX only. No GGUF build in this release.
- Not tested on a DW-collected private hold-out set yet.
- The adapter does not add new language ability; it sharpens Thai OCR-style behavior already present in the base.
Files
adapters.safetensors
adapter_config.json
train_manifest.jsonl
contamination_manifest_full.json
NOTICE
License And Credits
This LoRA adapter is Apache 2.0.
Built on:
- Gemma 4 26B-A4B
- mlx-community/gemma-4-26b-a4b-it-4bit
- iAPP Thai Handwriting Dataset
- ThaiOCRBench, evaluation only
- openthaigpt/thai-ocr-evaluation, evaluation only
- mlx-vlm
Citation
@misc{dw_khotaevl_ocr_2026,
title = {DW-KhoTaeVL-OCR-Pro-26B-MLX-LoRA v0.1},
author = {Deaw},
year = {2026},
url = {https://huggingface.co/commandeaw/DW-KhoTaeVL-OCR-Pro-26B-MLX-LoRA-v0.1}
}
Quantized
Model tree for commandeaw/DW-KhoTaeVL-OCR-Pro-26B-MLX-LoRA-v0.1
Base model
google/gemma-4-26B-A4B