Views
No views yet
.tflite) conversion of
SigLIP 2 (Google 2025), a state-of-the-art CLIP-style image tower, converted
from timm/vit_base_patch16_siglip_224.v2_webli
(ViT-B/16, 93M params; the image tower of ViT-B-16-SigLIP2 / google/siglip2).CompiledModel GPU accelerator (ML Drift): all ops are
GPU-native (Replacing 809 out of 809 node(s) … LITERT_CL), no CPU fallback, no
Flex ops, and the GPU output matches PyTorch (corr ≈ 1.0).| File | Size | Description |
|---|---|---|
siglip2_base_224_fp16.tflite | 185 MB | FP16 single-graph model, GPU full-residency |
convert_siglip2.py | — | Reproducible conversion script (timm → tflite) |
[1, 3, 224, 224] float32, NCHW, RGB normalized to [-1, 1]
((pixel/255 - 0.5) / 0.5). Normalization is applied by the caller.[1, 768] float32, L2-normalized image embedding.open_clip ViT-B-16-SigLIP2, prompt "This is a photo of {label}.")
and take the dot product on device.1val model = CompiledModel.create(
2 context.assets, "siglip2_base_224_fp16.tflite",
3 CompiledModel.Options(Accelerator.GPU), null
4)
5val inputs = model.createInputBuffers()
6val outputs = model.createOutputBuffers()
7inputs[0].writeFloat(nchwFloatArray) // [1,3,224,224], RGB scaled to [-1,1]
8model.run(inputs, outputs)
9val embedding = outputs[0].readFloat() // [768], already L2-normalizedqkv reshape emits a 5-D
head-split the delegate rejects; decompose into separate q/k/v. Self-attention
uses scaled_dot_product_attention, whose lowering keeps the batch-matmul 3-D
with a materialized transpose (both required for residency).const @ non-const (rejected / mis-computed); express as (q·k).sum + softmax
(attn·v).sum.sum((x-mean)²) exceed the fp16 max (65504), corrupting normalization (output
correlation collapses with depth while still reporting full residency). Scaling
by 1/32 before squaring keeps the sum in range.timm checkpoint. Because the source data is web-scraped, it may
incidentally contain people, faces, text, and other PII; no PII was deliberately
collected, and this conversion adds none. Apply your own content/PII filtering as
appropriate. See the original SigLIP 2 model card
and paper for full dataset details.