Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: google/siglip2-base-patch16-224
|
| 4 |
+
tags:
|
| 5 |
+
- onnx
|
| 6 |
+
- vision
|
| 7 |
+
- image-text-matching
|
| 8 |
+
- nebula
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# siglip2-base-patch16-224 (ONNX)
|
| 12 |
+
|
| 13 |
+
This is [Google's SigLIP 2 base/224](https://huggingface.co/google/siglip2-base-patch16-224) exported to ONNX format for CPU inference, used by [Nebula](https://github.com/diegohh0411/nebula) for local, offline image search.
|
| 14 |
+
|
| 15 |
+
## What's inside
|
| 16 |
+
|
| 17 |
+
| File | Description |
|
| 18 |
+
|---|---|
|
| 19 |
+
| `model.onnx` | Combined vision + text encoder (~110 MB) |
|
| 20 |
+
| `tokenizer.json` | SigLIP tokenizer |
|
| 21 |
+
|
| 22 |
+
## Model inputs & outputs
|
| 23 |
+
|
| 24 |
+
The single `model.onnx` file contains both encoders. You can run either independently by passing a dummy tensor for the unused branch.
|
| 25 |
+
|
| 26 |
+
**Inputs**
|
| 27 |
+
|
| 28 |
+
| Name | Shape | dtype |
|
| 29 |
+
|---|---|---|
|
| 30 |
+
| `pixel_values` | `[image_batch, 3, 224, 224]` | float32 |
|
| 31 |
+
| `input_ids` | `[text_batch, seq_len]` | int64 |
|
| 32 |
+
|
| 33 |
+
**Outputs**
|
| 34 |
+
|
| 35 |
+
| Name | Shape | dtype | Description |
|
| 36 |
+
|---|---|---|---|
|
| 37 |
+
| `image_embeds` | `[image_batch, 768]` | float32 | L2-normalizable image embedding |
|
| 38 |
+
| `text_embeds` | `[text_batch, 768]` | float32 | L2-normalizable text embedding |
|
| 39 |
+
| `logits_per_image` | `[image_batch, text_batch]` | float32 | Cosine similarity scores |
|
| 40 |
+
| `logits_per_text` | `[text_batch, image_batch]` | float32 | Cosine similarity scores (transposed) |
|
| 41 |
+
|
| 42 |
+
## How it was exported
|
| 43 |
+
|
| 44 |
+
```bash
|
| 45 |
+
optimum-cli export onnx \
|
| 46 |
+
--model google/siglip2-base-patch16-224 \
|
| 47 |
+
--task zero-shot-image-classification \
|
| 48 |
+
--opset 18 \
|
| 49 |
+
./models/
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
Requires `optimum[onnxruntime]` and `transformers`.
|
| 53 |
+
|
| 54 |
+
## License
|
| 55 |
+
|
| 56 |
+
Inherits [Apache 2.0](https://huggingface.co/google/siglip2-base-patch16-224) from the original Google SigLIP 2 model.
|