SigLIP 2 So400m/16 (384 px), converted to ONNX

ONNX files of the SigLIP 2 image encoder and text encoder, converted for the desktop app Ohanami (a local screenshot search app; the source code and the conversion script are in the Ohanami repository). The app downloads these files only when the user presses a "Download" button.

This is a format conversion of Google's SigLIP 2 weights. It is not an official release by the authors of SigLIP 2, and it does not mean they endorse or recommend this repository or Ohanami.

Source

Original model SigLIP 2 So400m, patch size 16, 384 px, multilingual (ViT-SO400M-16-SigLIP2-384)
Original authors Google (SigLIP 2 / big_vision)
Weights converted from timm/ViT-SO400M-16-SigLIP2-384, commit fec784dabb3081a5f101fc74eefaf9d1ed08237b
Original license Apache License 2.0 (see LICENSE and NOTICE)
Papers Tschannen et al., SigLIP 2: Multilingual Vision-Language Encoders with Improved Semantic Understanding, Localization, and Dense Features, 2025. Zhai et al., Sigmoid Loss for Language Image Pre-Training, 2023.
Original code google-research/big_vision

The weights of timm/ViT-SO400M-16-SigLIP2-384 are themselves converted from the original Big Vision (JAX) checkpoints. The model was trained on WebLI. See the original model card for the training data, the intended use, and the limitations. The limitations and biases described there apply to these files too.

What was changed

The weights are not retrained, quantized, or edited. They are exported to ONNX (the tensor values stay float32), as two separate graphs. The export is done by the script tools/convert-siglip2 in the Ohanami repository. The exact environment is recorded in CONVERSION.json (the hash of the script, the pinned package versions, and the properties of the exported graphs).

  • Export: PyTorch 2.6.0 (CPU), TorchScript exporter (dynamo=False), ONNX opset 19, IR version 9.
  • The batch size is fixed to 1.
  • The output embedding of each graph is L2-normalized (norm 1) inside the graph.
  • The image preprocessing (resize and normalization) is not in the graph. It has to be done by the caller (see below).
  • Parameters: 428,256,704 in the image encoder; 707,782,898 in the text encoder and the text projection.

Files

Path What it is
visual/model.onnx Image encoder
textual/model.onnx Text encoder (the graph)
textual/model.onnx_data Text encoder (the weights, ONNX external data; must be in the same folder as textual/model.onnx)
textual/tokenizer.json Tokenizer (BPE). The same file as in the source model
textual/tokenizer_config.json, textual/special_tokens_map.json Tokenizer settings
visual/preprocess_cfg.json, config.json Model configuration (written from open_clip_config.json of the source model)
CONVERSION.json How the files were made
LICENSE, NOTICE License and attribution

SHA-256 (the files the app verifies):

Path Size (bytes) SHA-256
visual/model.onnx 1713350137 c801892ee1737a913b729ac19f4b1ed69bbcc80755b568e7cd8266e9c8f32b6e
textual/model.onnx 560482 785486a7ed6c5a0209e31740ed35e9fc806ef4a5aa1ac37bc0f3a5d7137f07df
textual/model.onnx_data 2831131584 b04effd92d0ea4dd30063018b29b9811e46367e119f9fc5b51879e27f32290bc
textual/tokenizer.json 34362885 220c63d496e0c14e63eb656c91e0215e926202e4c74b1f089e09f1920d779b04

Inputs and outputs

Graph Input Output
visual/model.onnx image: float32 [1, 3, 384, 384] embedding: float32 [1, 1152] (L2-normalized)
textual/model.onnx text: int32 [1, 64] (token ids, padded to 64) embedding: float32 [1, 1152] (L2-normalized)

The similarity of an image and a text is the dot product of the two embeddings (cosine similarity, because both are normalized).

Preprocessing (the original model's own definition; visual/preprocess_cfg.json and config.json are authoritative):

  • Image: convert to RGB, resize the whole image to 384 x 384 without keeping the aspect ratio (resize_mode: squash, bicubic), scale to 0..1, then normalize each channel with mean 0.5 and standard deviation 0.5.
  • Text: the original model cleans the text with open_clip's canonicalize (tokenizer_kwargs.clean: lowercase, punctuation removed, whitespace collapsed), tokenizes it with textual/tokenizer.json, appends <eos>, truncates to 64 tokens, and pads with <pad>.

Use

The files are meant to be used from Ohanami. To use them in your own program, load them with any ONNX Runtime (the files were tested with ONNX Runtime 1.31 on a CUDA execution provider).

import onnxruntime as ort

image_session = ort.InferenceSession("visual/model.onnx")
text_session = ort.InferenceSession("textual/model.onnx")
# image: float32 [1, 3, 384, 384] (preprocessed as above), text: int32 [1, 64]
image_embedding = image_session.run(["embedding"], {"image": image})[0]
text_embedding = text_session.run(["embedding"], {"text": text})[0]

Other conversions

Another ONNX conversion of SigLIP 2 models is published by the Immich project. We ran it side by side with these files during development: the outputs of the two image encoders matched, and the image-side .onnx file of this repository is byte-identical to the one we compared with. Please see the Immich project's own model cards for their files.

License

These files are distributed under the Apache License, Version 2.0 (LICENSE), and the attribution of CC BY 4.0 is given as well (NOTICE): the authors' SigLIP 2 documentation licenses the software under Apache 2.0 and the other materials under CC BY 4.0, and it does not say which applies to the weights. The conversion is a modification of the original model; the changes are described above.

Downloads last month
37
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for ohanami-app/siglip2-so400m-patch16-384-onnx

Quantized
(1)
this model

Papers for ohanami-app/siglip2-so400m-patch16-384-onnx