feat: restructure repo with fp16/w4a16 variants, benchmarks, and metadata
Browse files- .gitattributes +2 -2
- .metadata.yaml +20 -0
- README.md +105 -0
- fp16/.metadata.yaml +13 -0
- fp16/benchmarks/x5h_npu.yaml +41 -0
- siglip-runner-2.0.0-Linux.sh +0 -3
- siglip-w4a16-runner-2.1.0-Linux.sh +0 -3
- w4a16/.metadata.yaml +20 -0
- w4a16/benchmarks/x5h_npu.yaml +41 -0
.gitattributes
CHANGED
|
@@ -33,5 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
-
|
| 37 |
-
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.gguf filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
*.sh filter=lfs diff=lfs merge=lfs -text
|
.metadata.yaml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
model:
|
| 2 |
+
name: siglip-so400m-patch14-384
|
| 3 |
+
display_name: SigLIP-SO400M-patch14-384
|
| 4 |
+
upstream: google/siglip-so400m-patch14-384
|
| 5 |
+
|
| 6 |
+
architecture:
|
| 7 |
+
family: siglip
|
| 8 |
+
modality:
|
| 9 |
+
- vision
|
| 10 |
+
- language
|
| 11 |
+
parameters: 0.9B
|
| 12 |
+
type: dual-encoder
|
| 13 |
+
|
| 14 |
+
format:
|
| 15 |
+
type: gguf
|
| 16 |
+
version: 3
|
| 17 |
+
|
| 18 |
+
tasks:
|
| 19 |
+
- zero-shot-image-classification
|
| 20 |
+
- image-text-similarity
|
README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model:
|
| 4 |
+
- google/siglip-so400m-patch14-384
|
| 5 |
+
pipeline_tag: zero-shot-image-classification
|
| 6 |
+
tags:
|
| 7 |
+
- siglip
|
| 8 |
+
- vision-language
|
| 9 |
+
- dual-encoder
|
| 10 |
+
- renesas
|
| 11 |
+
- x5h
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# SigLIP-SO400M-patch14-384 - Renesas X5H
|
| 15 |
+
|
| 16 |
+
## Introduction
|
| 17 |
+
|
| 18 |
+
This repository contains the **SigLIP-SO400M-patch14-384** dual-encoder model, optimized for the **Renesas X5H** platform for **zero-shot image-text similarity** inference.
|
| 19 |
+
|
| 20 |
+
SigLIP is a dual-encoder model consisting of a vision encoder and a text encoder. It is **not** a generative model -- it does not produce text output. Instead, it computes similarity scores between images and text labels, enabling zero-shot image classification and image-text matching.
|
| 21 |
+
|
| 22 |
+
- **Model Architecture:** SigLIP uses a Vision Transformer (ViT) for image encoding and a Transformer for text encoding. Both encoders produce L2-normalized embeddings that are compared via dot-product similarity with a learned scale and bias, followed by sigmoid activation.
|
| 23 |
+
- **Model Summary:**
|
| 24 |
+
| Parameter | SigLIP-SO400M-patch14-384 |
|
| 25 |
+
|:---:|:---:|
|
| 26 |
+
| HIDDEN_SIZE | 1152 |
|
| 27 |
+
| INTERMEDIATE_SIZE | 4304 |
|
| 28 |
+
| NUM_HEADS | 16 |
|
| 29 |
+
| HEAD_DIM | 72 |
|
| 30 |
+
| NUM_LAYERS | 27 (both encoders) |
|
| 31 |
+
| PATCH_SIZE | 14 |
|
| 32 |
+
| IMAGE_SIZE | 384 |
|
| 33 |
+
| NUM_PATCHES | 729 |
|
| 34 |
+
| VOCAB_SIZE | 32000 |
|
| 35 |
+
| MAX_TEXT_SEQ_LEN | 64 |
|
| 36 |
+
- **Source Model:** [google/siglip-so400m-patch14-384](https://huggingface.co/google/siglip-so400m-patch14-384)
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
## Performance
|
| 41 |
+
The following performance metrics were measured on the Renesas X5H board.
|
| 42 |
+
| Precision | Device | VE Latency (ms) | TE Latency (ms) | NPU DDR (MB) |
|
| 43 |
+
|:---:|:---:|:---:|:---:|:---:|
|
| 44 |
+
| FP16 | NPX6 | 1236.5 | 46.3 | 1714.88 |
|
| 45 |
+
| W4A16 | NPX6 | 1008.9 | 79.1 | 1155.76 |
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
## Prerequisites
|
| 50 |
+
To run the model, you need:
|
| 51 |
+
|
| 52 |
+
1. **Renesas X5H Board with SDK v4.32.0**
|
| 53 |
+
2. **Hugging Face CLI**: For downloading the model and installer.
|
| 54 |
+
|
| 55 |
+
## Deployment
|
| 56 |
+
|
| 57 |
+
### SigLIP-SO400M-patch14-384 (FP16)
|
| 58 |
+
1. Download the installer **siglip-runner-2.1.0-Linux.sh** from **Files and versions** tab under **fp16/binaries/rcar-x5hv1/xOS-v4.32/** folder.
|
| 59 |
+
2. Copy the installer to the X5H board and run the installer.
|
| 60 |
+
```bash
|
| 61 |
+
bash ./siglip-runner-2.1.0-Linux.sh --prefix=./ --exclude-subdir --skip-license
|
| 62 |
+
```
|
| 63 |
+
3. Download GGUF **mmproj-siglip-f16.gguf** from **Files and versions** tab under **fp16** folder and copy to the installed directory on the X5H board.
|
| 64 |
+
4. Expected directory structure on the X5H board.
|
| 65 |
+
```bash
|
| 66 |
+
siglip-runner
|
| 67 |
+
├── mmproj-siglip-f16.gguf
|
| 68 |
+
├── firmwares
|
| 69 |
+
├── kernel_modules
|
| 70 |
+
├── scripts
|
| 71 |
+
├── siglip-runner
|
| 72 |
+
└── setup_npu.sh
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
### Inference - SigLIP-SO400M-patch14-384 (FP16)
|
| 76 |
+
```bash
|
| 77 |
+
bash ./setup_npu.sh npu0
|
| 78 |
+
./siglip-runner -m mmproj-siglip-f16.gguf -i image.ppm -t <comma_separated_token_ids> -s
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
### SigLIP-SO400M-patch14-384 (W4A16)
|
| 84 |
+
1. Download the installer **siglip-w4a16-runner-2.2.0-Linux.sh** from **Files and versions** tab under **w4a16/binaries/rcar-x5hv1/xOS-v4.32/** folder.
|
| 85 |
+
2. Copy the installer to the X5H board and run the installer.
|
| 86 |
+
```bash
|
| 87 |
+
bash ./siglip-w4a16-runner-2.2.0-Linux.sh --prefix=./ --exclude-subdir --skip-license
|
| 88 |
+
```
|
| 89 |
+
3. Download GGUF **mmproj-siglip-f16.gguf** from **Files and versions** tab under **fp16** folder and copy to the installed directory on the X5H board.
|
| 90 |
+
4. Expected directory structure on the X5H board.
|
| 91 |
+
```bash
|
| 92 |
+
siglip-w4a16-runner
|
| 93 |
+
├── mmproj-siglip-f16.gguf
|
| 94 |
+
├── firmwares
|
| 95 |
+
├── kernel_modules
|
| 96 |
+
├── scripts
|
| 97 |
+
├── siglip-w4a16-runner
|
| 98 |
+
└── setup_npu.sh
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
### Inference - SigLIP-SO400M-patch14-384 (W4A16)
|
| 102 |
+
```bash
|
| 103 |
+
bash ./setup_npu.sh npu0
|
| 104 |
+
./siglip-w4a16-runner -m mmproj-siglip-f16.gguf -i image.ppm -t <comma_separated_token_ids> -g . -s
|
| 105 |
+
```
|
fp16/.metadata.yaml
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
variant:
|
| 2 |
+
id: gguf_fp16
|
| 3 |
+
format: gguf
|
| 4 |
+
precision: fp16
|
| 5 |
+
method: null
|
| 6 |
+
|
| 7 |
+
quantization:
|
| 8 |
+
datatype: fp16
|
| 9 |
+
scope:
|
| 10 |
+
- weights
|
| 11 |
+
granularity: null
|
| 12 |
+
calibration: none
|
| 13 |
+
toolchain: custom
|
fp16/benchmarks/x5h_npu.yaml
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
hardware:
|
| 2 |
+
vendor: renesas
|
| 3 |
+
chip: rcar-x5h
|
| 4 |
+
cpu: arm-cortex-a720
|
| 5 |
+
npu: npx6-48k
|
| 6 |
+
npu_count: 2
|
| 7 |
+
npu_cores: 12
|
| 8 |
+
npu_default_freq_mhz: 1066
|
| 9 |
+
accelerator:
|
| 10 |
+
- npu
|
| 11 |
+
|
| 12 |
+
runtime:
|
| 13 |
+
engine: NPX_Toolkit
|
| 14 |
+
format: gguf
|
| 15 |
+
execution_provider: npu
|
| 16 |
+
|
| 17 |
+
configuration:
|
| 18 |
+
npu_instances: 1
|
| 19 |
+
npu_cores_per_instance: 12
|
| 20 |
+
npu_freq_mhz: 1066
|
| 21 |
+
|
| 22 |
+
benchmark:
|
| 23 |
+
type: hil
|
| 24 |
+
parameters:
|
| 25 |
+
batch_size: 1
|
| 26 |
+
|
| 27 |
+
performance:
|
| 28 |
+
ve_encode_ms: 1236.5
|
| 29 |
+
te_encode_ms: 46.3
|
| 30 |
+
total_ms: 3849.0
|
| 31 |
+
|
| 32 |
+
metrics:
|
| 33 |
+
accuracy: null
|
| 34 |
+
|
| 35 |
+
memory:
|
| 36 |
+
ve_npu_ddr_mb: 920.75
|
| 37 |
+
te_npu_ddr_mb: 794.12
|
| 38 |
+
total_npu_ddr_mb: 1714.88
|
| 39 |
+
|
| 40 |
+
power:
|
| 41 |
+
avg_w: null
|
siglip-runner-2.0.0-Linux.sh
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:0a9cd54e6630c44d6a67fe8933ee7aeb6ae1a66372d8d27f41552c13d4c30737
|
| 3 |
-
size 11071285
|
|
|
|
|
|
|
|
|
|
|
|
siglip-w4a16-runner-2.1.0-Linux.sh
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:b180a8db9f77c09952ef68708702754f8084ef1e733ce5896851a2a8a0e30e06
|
| 3 |
-
size 339097260
|
|
|
|
|
|
|
|
|
|
|
|
w4a16/.metadata.yaml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
variant:
|
| 2 |
+
id: gguf_w4a16
|
| 3 |
+
format: gguf
|
| 4 |
+
precision: w4a16
|
| 5 |
+
method: symmetric_int4_per_channel
|
| 6 |
+
|
| 7 |
+
quantization:
|
| 8 |
+
datatype: w4a16
|
| 9 |
+
scope:
|
| 10 |
+
- weights
|
| 11 |
+
granularity: per_output_channel
|
| 12 |
+
calibration:
|
| 13 |
+
method: per_tensor_max_abs
|
| 14 |
+
activation_bits: 16
|
| 15 |
+
vision_dataset: detection-datasets/coco[val]
|
| 16 |
+
vision_samples: 128
|
| 17 |
+
text_dataset: Salesforce/wikitext[wikitext-2-raw-v1][train]
|
| 18 |
+
text_samples: 128
|
| 19 |
+
seed: 42
|
| 20 |
+
toolchain: custom
|
w4a16/benchmarks/x5h_npu.yaml
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
hardware:
|
| 2 |
+
vendor: renesas
|
| 3 |
+
chip: rcar-x5h
|
| 4 |
+
cpu: arm-cortex-a720
|
| 5 |
+
npu: npx6-48k
|
| 6 |
+
npu_count: 2
|
| 7 |
+
npu_cores: 12
|
| 8 |
+
npu_default_freq_mhz: 1066
|
| 9 |
+
accelerator:
|
| 10 |
+
- npu
|
| 11 |
+
|
| 12 |
+
runtime:
|
| 13 |
+
engine: NPX_Toolkit
|
| 14 |
+
format: gguf
|
| 15 |
+
execution_provider: npu
|
| 16 |
+
|
| 17 |
+
configuration:
|
| 18 |
+
npu_instances: 1
|
| 19 |
+
npu_cores_per_instance: 12
|
| 20 |
+
npu_freq_mhz: 1066
|
| 21 |
+
|
| 22 |
+
benchmark:
|
| 23 |
+
type: hil
|
| 24 |
+
parameters:
|
| 25 |
+
batch_size: 1
|
| 26 |
+
|
| 27 |
+
performance:
|
| 28 |
+
ve_encode_ms: 1008.9
|
| 29 |
+
te_encode_ms: 79.1
|
| 30 |
+
total_ms: 6486.5
|
| 31 |
+
|
| 32 |
+
metrics:
|
| 33 |
+
accuracy: null
|
| 34 |
+
|
| 35 |
+
memory:
|
| 36 |
+
ve_npu_ddr_mb: 677.84
|
| 37 |
+
te_npu_ddr_mb: 477.91
|
| 38 |
+
total_npu_ddr_mb: 1155.76
|
| 39 |
+
|
| 40 |
+
power:
|
| 41 |
+
avg_w: null
|