PaddleOCR-VL-1.6, MLX, bf16
This is PaddlePaddle/PaddleOCR-VL-1.6
converted to the MLX format so it runs on Apple Silicon with mlx-vlm.
It is a small vision-language model (about 0.9 billion parameters) that reads text in images.
What is in this repository
- The weights are full precision bf16. Nothing is quantized.
- No fine-tuning was done. The numbers are the upstream numbers, stored in the MLX layout.
- The tokenizer, processor files, chat template and the upstream
LICENSEare included unchanged. - The upstream Python files (
configuration_paddleocr_vl.py,modeling_paddleocr_vl.py,processing_paddleocr_vl.py,image_processing_paddleocr_vl.py) are included unchanged. They are referenced byauto_mapin the config.mlx-vlmruns the model with its own PaddleOCR-VL code, but it can load a tokenizer with remote code enabled, so the files must be trusted. Always download this repository at a fixed commit (arevision), never atmain, so the Python files you load are the ones you reviewed.
How it was converted
| Item | Value |
|---|---|
| Source | PaddlePaddle/PaddleOCR-VL-1.6 |
| Source revision | c5630abae1d940eafe0697512a0325494b02ab42 |
| Tool | mlx-vlm 0.7.2 (with mlx 0.32.2) |
| Precision | bf16, 500 tensors, 905,601,648 parameters |
model.safetensors size | 1,811,260,812 bytes (1.69 GiB) |
model.safetensors SHA-256 | f72e51bc81f035c3e50d1351cff78393f3906577c659e3bde6b653ede29f8af9 |
The command was:
mlx_vlm convert \
--hf-path <local snapshot of PaddlePaddle/PaddleOCR-VL-1.6 at c5630abae1d940eafe0697512a0325494b02ab42> \
--mlx-path <output folder> \
--dtype bfloat16
It was run without --trust-remote-code. Running it a second time on the same snapshot gives
byte-identical files.
How to use it
from huggingface_hub import snapshot_download
from mlx_vlm import generate, load
from mlx_vlm.prompt_utils import apply_chat_template
from mlx_vlm.utils import load_config
path = snapshot_download("<this repository's id>", revision="<a commit hash from this repository>")
model, processor = load(path)
config = load_config(path)
prompt = apply_chat_template(processor, config, "OCR:", num_images=1)
result = generate(model, processor, prompt, image="frame.jpg", max_tokens=512, temperature=0.0)
print(result.text)
OCR: is the plain text-reading prompt that the upstream model documents.
Why it exists
Astrocyte's encode worker reads burned-in text from video frames (slates, title cards, credits and bumpers) so it can find ad-break cards. PaddleOCR-VL 1.6 read that text better than 1.5 in our tests, and no MLX build of 1.6 existed, so we converted it ourselves and publish it here. The bf16 build was chosen over a 4-bit build because it read text more accurately.
Licence
Apache License 2.0, the same as the upstream model. The upstream LICENSE file is copied into this
repository unchanged. The only change to the upstream model is the conversion to the MLX format and
bf16 storage described above. All credit for the model belongs to the PaddleOCR team. See the
upstream model card for its training,
benchmarks and citation.