Downloads · 30 days
6
11% of all-time downloads
Reza2kn/Bina-0.1-Koochik-CoreML
Bina-0.1-Koochik-CoreML is a image-to-text model from Reza2kn. Use it when you need a caption or text from an image. It is set up for coreml. The card lists the license as openrail.
This is the fixed-512 CoreML runtime for Reza2kn/Bina-0.1-Koochik, the merged BF16 Persian OCR baseline.
Downloads · 30 days
6
11% of all-time downloads
All-time downloads
56
Public
Repo size
2.9 GB
Likes
0
Public
Click a slice to open those files.
.bin2.9 GB · 100%
From the Hugging Face model README
This is the fixed-512 CoreML runtime for
Reza2kn/Bina-0.1-Koochik,
the merged BF16 Persian OCR baseline.
This is not labeled as a literal BF16 CoreML model. Core ML Tools 9.0 does not expose BF16 as an ML Program compute precision. The parity-qualified build uses:
An all-FP16 attempt was rejected because FP16 vision changed the first greedy token. Keeping vision in FP32 restored exact greedy transcripts while retaining FP16 for the two large language graphs.
All comparisons use deterministic greedy decoding, EOS token 2, the same
BF16 source checkpoint, and the exact Bina transcription prompt:
OCR this image. Return only the exact text visible in the image, preserving Persian, numbers, line breaks, and punctuation. Do not explain.
| Gate | Result |
|---|---|
| Synthetic compiled CoreML canary | 22/22 tokens exact through EOS |
| Two real Persian pages | 128/128 checked tokens exact (64-token cap per page) |
| Real Persian line crop, Python-hosted CoreML | 25/25 tokens and text exact through EOS |
| Same Persian crop, native Swift host | 25/25 tokens and text exact through EOS |
The native crop transcript is exactly:
گزارش سالانه دیتاک -۱۴۰۲
Receipts are under validation/. The Swift receipt exercises
the actual CoreML packages, FP32 host assets, cache updates, baked M-RoPE tables,
Fuse tokenizer decoding, and EOS stopping without loading the PyTorch model.
This release intentionally has one static shape:
512 × 512 RGB canvas;pixel_values: [1024, 1536], Float32;-240 (baked into the native decode tables);The qualified preprocessing path is PIL RGB + LANCZOS aspect-fit into the
centered white canvas, followed by the checked-in processor. The Swift
generate(pixelValues:) path is parity-qualified. The convenience Swift
generate(image:) path uses CoreGraphics and is not claimed to be
pixel-identical to PIL.
This is not yet the six-aspect-bucket Bina/Flax runtime and is not a drop-in replacement for every dynamic Surya page shape. Use this release only for the fixed-512 contract above.
surya_vision_fp32.mlpackage — Bina-specific vision encoder.surya_prefill_fp16_seq416_cache1024.mlpackage — language prefill and initial cache.surya_decode_step_fp16_cache1024.mlpackage — one autoregressive decode step.native_assets/ — FP32 token embedding, prompt embeddings, M-RoPE tables,
tokenizer vocabulary, constants, and a synthetic canary tensor.native/SuryaCoreMLRuntime/ — Swift Package for macOS 14+ / iOS 17+.processor/ — exact tokenizer and processor configuration.scripts/ — conversion, fixture preparation, and parity validators.The internal Surya names reflect the upstream architecture; all three graphs
contain the Bina 0.1 fine-tuned weights.
Clone with Git LFS, then run the release build from the repository root:
git lfs install
git lfs pull
cd native/SuryaCoreMLRuntime
swift run -c release surya-coreml-smoke \
--model-dir ../.. \
--pixel-values-fp32 ../../native_assets/canary_pixel_values_fp32.bin \
--max-tokens 64
Expected token IDs:
2009 2046 2054 2047 2041 2035 2037 1979 136 1072 2020 2047 2052 2033 2044 1979 1982 55 1992 13 13 2
Expected text:
Invoice 123<br/>Total $42.00
To prepare an exact fixed-512 tensor for another image:
python scripts/prepare_bina_coreml_fixtures.py \
--runtime-script scripts/export_surya_coreml_runtime.py \
--image /path/to/image.png \
--output-dir prepared
Then pass prepared/<stem>.pixel_values_fp32.bin to the Swift executable.
Reza2kn/Bina-0.1-Koochik;9b5812be94e3e015142da22a4b61b34aad5d2c02;model.safetensors SHA-256:
2193be4ef3d2366438121a15b7a1dea2bb85b24f83145e5a39bfa1f387891ada;config.json SHA-256:
e0de22be177070f206106c184d062176fcda591d9114068c42489ffc550488de;Qwen3_5ForConditionalGeneration;Package and native-asset hashes are recorded in
coreml_runtime_manifest.json.
این مخزن نسخهٔ CoreML مدل بینا ۰.۱ است. وزن مبدأ BF16 است، اما چون CoreML خروجی محاسباتی BF16 ارائه نمیکند، انکودر تصویر با FP32 و بخش زبانی با FP16 تبدیل شده است. در آزمون واقعی فارسی، خروجی CoreML و مدل اصلی BF16 تا توکن EOS کاملاً یکسان بود؛ همین آزمون با میزبان Swift نیز ۲۵ از ۲۵ توکن و متن دقیقاً یکسان داد. این نسخه فعلاً فقط قرارداد ثابت ۵۱۲×۵۱۲ را پشتیبانی میکند.
This derivative follows the source model's OpenRAIL license. Review the source and upstream Surya OCR 2 terms before redistribution or deployment.