Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- executorch
|
| 5 |
+
- xnnpack
|
| 6 |
+
- pte
|
| 7 |
+
- on-device
|
| 8 |
+
- zero-shot-image-classification
|
| 9 |
+
base_model:
|
| 10 |
+
- google/siglip2-base-patch16-224
|
| 11 |
+
---
|
| 12 |
+
# siglip2_base_p16_image — ExecuTorch
|
| 13 |
+
|
| 14 |
+
- **Source**: google/siglip2-base-patch16-224
|
| 15 |
+
- **License**: Apache-2.0
|
| 16 |
+
- **Input**: [[1, 3, 224, 224]] — RGB scaled to [-1, 1] (mean .5, std .5), 224x224
|
| 17 |
+
- **Output**: image embedding [1,768] from the attention pooler (unnormalized; L2-normalize before cosine)
|
| 18 |
+
|
| 19 |
+
## Variants
|
| 20 |
+
|
| 21 |
+
All variants take and return fp32 tensors — swap the `.pte` file, keep your app code.
|
| 22 |
+
|
| 23 |
+
| build | file | size (MB) | parity vs fp32 eager (worst corr) | Mac median (ms)* |
|
| 24 |
+
|-----------|------|-----------|------------------------------------|------------------|
|
| 25 |
+
| fp32 | `siglip2_base_p16_image_xnnpack_fp32.pte` | 371.7 | 0.999994 | 195.6 |
|
| 26 |
+
| fp16 | `siglip2_base_p16_image_xnnpack_fp16.pte` | 187.3 | 0.999986 | 227.8 |
|
| 27 |
+
| Core ML (fp16, iOS) | `siglip2_base_p16_image_coreml_all.pte` | 185.1 | 0.999806 | 4.4 |
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
The Core ML build is the same graph lowered to Apple's Neural Engine instead of
|
| 31 |
+
XNNPACK, which is CPU-only. Measured on an iPhone 17 Pro across seven models, it
|
| 32 |
+
runs **3.5x to 13.9x faster (median 12x)** at roughly half the file size — for
|
| 33 |
+
example Depth-Anything-V2-Small at 500.8 ms against 42.7 ms, and MODNet at 81.7 ms
|
| 34 |
+
against 5.9 ms. It computes in fp16 and is iOS-only; the XNNPACK files stay the
|
| 35 |
+
portable option and are what runs on Android.
|
| 36 |
+
|
| 37 |
+
\*Mac arm64, single process, median of 10 — a reference point for relative cost
|
| 38 |
+
only, not a device number (torch eager fp32 on the same machine: 34.4 ms).
|
| 39 |
+
|
| 40 |
+
## Verification (executorch 1.4.0, torch 2.13.0)
|
| 41 |
+
|
| 42 |
+
Parity is measured against the fp32 eager model on real image input; `corr` is
|
| 43 |
+
the correlation over all elements of each output tensor.
|
| 44 |
+
|
| 45 |
+
| output | shape | max_abs_diff | corr |
|
| 46 |
+
|--------|-------|--------------|------|
|
| 47 |
+
| 0 | [1, 768] | 1.195e-02 | 0.999994 |
|
| 48 |
+
|
| 49 |
+
XNNPACK delegate coverage (fp32): 68.6% (395/576 ops); ops left on the portable kernels: `aten.expand_copy.default` x48, `aten.native_layer_norm.default` x26, `aten.mul.Scalar` x24, `aten.logical_not.default` x24, `aten.eq.Scalar` x12, `aten.full_like.default` x12, `aten.any.dim` x12, `aten.where.self` x12, `aten.select_copy.int` x3, `aten.split_with_sizes_copy.default` x2, `aten.addmm.default` x2, `aten.repeat.default` x1, `aten.embedding.default` x1, `aten.unsqueeze_copy.default` x1, `aten.squeeze_copy.dims` x1
|
| 50 |
+
|
| 51 |
+
## Conversion
|
| 52 |
+
|
| 53 |
+
torch.export -> to_edge_transform_and_lower(partitioner) -> .pte
|
| 54 |
+
(conversion scripts: [executorch-models](https://github.com/john-rocky/executorch-models))
|