Run this model with HF Jobs
Run mlx-community/PaddleOCR-VL-1.8-8bit on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/mlx-community/PaddleOCR-VL-1.8-8bit. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/mlx-community/PaddleOCR-VL-1.8-8bit on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/mlx-community/PaddleOCR-VL-1.8-8bit. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Instructions to use mlx-community/PaddleOCR-VL-1.8-8bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/PaddleOCR-VL-1.8-8bit 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("mlx-community/PaddleOCR-VL-1.8-8bit") config = load_config("mlx-community/PaddleOCR-VL-1.8-8bit") # 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) - PaddleOCR
How to use mlx-community/PaddleOCR-VL-1.8-8bit with PaddleOCR:
# See https://www.paddleocr.ai/latest/version3.x/pipeline_usage/PaddleOCR-VL.html to installation from paddleocr import PaddleOCRVL pipeline = PaddleOCRVL(pipeline_version="mlx-community/PaddleOCR-VL-1.8-8bit") output = pipeline.predict("path/to/document_image.png") for res in output: res.print() res.save_to_json(save_path="output") res.save_to_markdown(save_path="output") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
mlx-community/PaddleOCR-VL-1.8-8bit
8-bit MLX quantization (affine, group size 64) of PaddlePaddle/PaddleOCR-VL-1.8, a 0.9B document-parsing vision-language model. It runs on Apple silicon with mlx-vlm.
Same outputs as bf16 on every test page, at 60% of the size and faster decode. Recommended default.
PaddleOCR-VL-1.8 uses the same architecture as 1.5 and 1.6, so current mlx-vlm releases load it as they are. Only the weights changed.
Use
pip install -U mlx-vlm
mlx_vlm.generate --model mlx-community/PaddleOCR-VL-1.8-8bit \
--image page.png --prompt "OCR:" --max-tokens 1024 --temperature 0
The model has one prompt per task:
| Task | Prompt |
|---|---|
| Text | OCR: |
| Table (OTSL tags) | Table Recognition: |
| Formula (LaTeX) | Formula Recognition: |
| Chart (to table) | Chart Recognition: |
| Text spotting (text + quadrilateral) | Spotting: |
| Seal | Seal Recognition: |
Text spotting
Spotting writes each text line followed by eight <|LOC_n|> tokens. These
are the x, y pairs of the line's four corners, normalized to 0-1000.
Multiply by width / 1000 and height / 1000 to get pixels.
The upstream recipe for this task does two things:
- It raises the pixel budget to
2048 * 28 * 28. - If both sides of the image are under 1500 px, it upscales the image 2x first.
mlx_vlm.generate --model mlx-community/PaddleOCR-VL-1.8-8bit \
--image photo_2x.png --prompt "Spotting:" \
--processor-kwargs '{"max_pixels": 1605632}' \
--max-tokens 1024 --temperature 0
Note: mlx-vlm releases before this fix ignore max_pixels for
PaddleOCR-VL. They still run spotting, but at the default budget of
1280 * 28 * 28, which gives slightly different boxes. Until the fix ships
in a release, install mlx-vlm from the fix branch:
pip install -U "git+https://github.com/cguldogan/mlx-vlm.git@paddleocr-vl-1.8".
Python
from mlx_vlm import load, generate
from mlx_vlm.prompt_utils import apply_chat_template
model, processor = load("mlx-community/PaddleOCR-VL-1.8-8bit")
prompt = apply_chat_template(processor, model.config, "Table Recognition:", num_images=1)
result = generate(model, processor, prompt, image=["table.png"],
max_tokens=1024, temperature=0.0)
print(result.text)
Measured fidelity
Every variant was run on the same 10 pages, covering all 6 tasks:
- the PaddleOCR-VL test images from transformers' synthetic test assets for OCR (3), table, formula, chart and spotting;
- three pages rendered for this check: a dense English/Chinese report (268 output tokens), a LaTeX formula and a seal.
Each output was compared with the
original checkpoint (rev ca6cbfe) running in transformers 5.25.0, PyTorch,
float32 and greedy decoding, using the model card's recipe. Speeds are
medians on an Apple M4 Pro (64 GB) with mlx 0.32.5 and mlx-vlm 0.8.2.
| Variant | Bits/weight | Weights | Token-exact vs fp32 reference | Char. error vs reference | Spotting box drift (max, /1000) | Decode tok/s | Peak RAM |
|---|---|---|---|---|---|---|---|
-bf16 |
16 | 1.81 GB | 9/10 | 0.5% | 0 | 241 | 2.8 GB |
-8bit |
9.618 | 1.09 GB | 9/10 | 0.5% | 0 | 385 | 2.2 GB |
-6bit |
7.916 | 0.90 GB | 7/10 | 1.3% | 1 | 423 | 2.0 GB |
-5bit |
7.065 | 0.80 GB | 6/10 | 2.7% | 1 | 482 | 2.0 GB |
-4bit |
6.214 | 0.70 GB | 5/10 | 4.7% | 2 | 500 | 1.9 GB |
- MLX in float32 reproduces the PyTorch fp32 reference token for token on all 10 pages, so the MLX implementation matches. The remaining differences come from bf16 and quantization rounding.
- Every miss in
-bf16/-8bitis on the chart page. It has no y-axis, so the bar values are estimates, and the model changes its estimates for the bars from 2019 onward (e.g. 2020 profit 25 → 20). That task is sensitive to precision. - On these pages, plain OCR, tables and seals match the reference exactly from bf16 down to 5-bit. At 4-bit the dense page's text is still identical, but two line breaks become paragraph breaks.
Files
- Weights converted with
mlx_vlm convertfrom the originalmodel.safetensors(sha256f81de9c1…21c66b61). The vision tower is quantized too in the quantized variants. - The tokenizer, chat template and preprocessor config are unchanged from
upstream. Upstream's
args.json(training arguments) and.eval_resultsare omitted.
License
Apache-2.0, the same as the original model; see LICENSE. PaddleOCR-VL is by the PaddlePaddle team, Baidu
(paper).
- Downloads last month
- -
8-bit
Model tree for mlx-community/PaddleOCR-VL-1.8-8bit
Base model
PaddlePaddle/PaddleOCR-VL-1.8