indra-ocr-mlx / README.md
bigbigbei's picture
Add indra-ocr MLX conversion (.mlxonnx bundles + meta + card + license)
e41da84 verified
|
Raw History Blame Contribute Delete
2.44 kB
---
library_name: mlx
license: openrail
license_link: LICENSE
pipeline_tag: image-to-text
base_model: datalab-to/indra-ocr
tags:
- ocr
- mlx
- apple-silicon
- onnx
language:
- en
- fr
- de
- es
- it
- pt
- nl
- zh
- ja
- ko
- ar
---
# indra-ocr (MLX conversion)
An [MLX](https://github.com/ml-explore/mlx) conversion of
[`datalab-to/indra-ocr`](https://huggingface.co/datalab-to/indra-ocr), packaged
so the full detect → recognize → reading-order OCR pipeline runs natively on
Apple Silicon without `onnxruntime`.
Each upstream `*.onnx` graph is exported to a self-contained `*.mlxonnx/` bundle
(`graph.json` + `weights.safetensors`) by `tools/export_mlxonnx.py`, so the
whole model loads and runs through MLX on the GPU.
## What is in here
| Bundle | Role |
| --- | --- |
| `det.mlxonnx` | text-line detection |
| `orient.mlxonnx` | page/line orientation |
| `order.mlxonnx` | reading order |
| `script.mlxonnx` | script classification |
| `rec.mlxonnx` | Latin recognizer (base) |
| `rec_cjk.mlxonnx` | CJK recognizer |
| `rec_rtl.mlxonnx` | right-to-left recognizer |
| `rec_world.mlxonnx` | other-scripts recognizer |
| `math_enc` / `math_dec_init` / `math_dec_step` / `mathcls` | math OCR encoder/decoder/classifier |
| `meta.json` | vocab, geometry (`det_long_side`, `rec_height`, `rec_window`), script groups, LM params |
Geometry: `det_long_side=1024`, `rec_height=32`, `rec_window=3`.
Script groups: `base`, `cjk`, `rtl`, `world`.
The upstream `.npz` n-gram language models are intentionally not included: this
bundle targets the MLX-Swift decoder, which reads only the `*.mlxonnx` graphs
and `meta.json` (the LM gating params are recorded in `meta.json` under
`lm_params`).
## Intended use
Loaded as the `indra` tier of the
[MlxOCRKit](https://github.com/playstonex/MinerUKit) Swift library:
```
minerukit --tier indra --indra-model /path/to/indra-ocr-mlx input.pdf
```
## License
This is a **Derivative of the Model** under the upstream
**AI Pubs Open RAIL-M License (Modified)** — see `LICENSE` (copied verbatim from
`datalab-to/indra-ocr`). The OpenRAIL-M **use restrictions (Attachment A)** carry
over to this conversion and to anything you build from it. By using these weights
you agree to those terms. Code that loads the model is separate and is not
licensed under OpenRAIL-M.
Original model and credit: Datalab ([datalab.to](https://www.datalab.to)),
`datalab-to/indra-ocr`.