Skip to content

Add SigLIP 2 base-256 Core ML conversion - #109

Merged
Alex-Wengg merged 4 commits into
mainfrom
feat/siglip2-coreml
Sep 26, 2026
Merged

Alex-Wengg merged 4 commits into
mainfrom
feat/siglip2-coreml

Conversation

@Alex-Wengg

Copy link
Copy Markdown
Member

Converts google/siglip2-base-patch16-256 to fp16 Core ML image and text encoders (L2-normalized 768-d outputs) for zero-shot image classification. Published: FluidInference/siglip2-base-patch16-256-coreml.

  • ImageNet-1k zero-shot, all 50,000 test images, CPU + Neural Engine: Core ML 76.76% vs PyTorch fp32 76.79%, 99.32% identical top-1.
  • Oxford-IIIT Pets (3,669): 94.77% vs 94.74%.
  • Image encoder 100% on the ANE, 5.2 ms (M5 Pro) vs 19.1 ms PyTorch MPS.
  • End to end on 7,349 Pets photos vs transformers fp32 MPS batch 32: 36.3 s vs 102.2 s, 262 MB vs 4.24 GB peak memory.

Scripts: convert-coreml.py, compare-models.py, score-pets.py, bench-pytorch-pets.py; reports in reports/. Swift runtime and demo: FluidInference/FluidUse#18.

🤖 Generated with Claude Code

Converts google/siglip2-base-patch16-256 to two fp16 Core ML packages
(image and text encoders, L2-normalized outputs) so labels can be given
as text at runtime.

ImageNet-1k zero-shot on all 50,000 test images, CPU + Neural Engine:
76.76% vs 76.79% for fp32 PyTorch under the same single-prompt protocol,
99.32% identical top-1. Image encoder runs 100% on the ANE at 5.2 ms
(3.5 ms GPU) vs 19.1 ms PyTorch MPS on an M5 Pro.
Core ML fp16 on CPU + Neural Engine 94.77% vs PyTorch fp32 94.74% on all 3,669 test images, 99.89% identical top-1, 5.6 ms per image.
Same photos, prompts, and scoring as FluidUse ImageSortCheck. M5 Pro: Core ML 36.3 s (202 photos/s, 94.26%, 262 MB peak) vs transformers fp32 MPS batch 32 102.2 s (72 photos/s, 94.11%, 4.24 GB peak).
@Alex-Wengg
Alex-Wengg merged commit 5beb340 into main Sep 26, 2026
@Alex-Wengg
Alex-Wengg deleted the feat/siglip2-coreml branch September 26, 2026 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant