SigLIP 2 NaFlex Base image encoder

Use this checkpoint to index images, find similar photos, or compare a new image with stored Google SigLIP 2 NaFlex Base embeddings. Its weights are 185.9 MB, an 87.6% smaller download than Google’s 1,501.0 MB joint checkpoint. It produces one 768-dimensional pooled vector per image with the standard Transformers loader. Google source checkpoint

The package contains Google’s image encoder and original image-processor settings. Strange Lab removed the text encoder and rounded the vision weights from FP32 to FP16. The image processor preserves aspect ratio and uses up to 256 patches by default. Text queries require compatible text embeddings from the original model. SigLIP 2 paper · Transformers documentation

Use

Load the Hub ID directly with AutoImageProcessor and Siglip2VisionModel for image embeddings. The tested FiftyOne SigLIP plugin only accepts registered zoo model names, so use the Transformers path below to produce embeddings for an external index. Tested FiftyOne plugin

python -m pip install "transformers==5.23.0" torch torchvision pillow
hf download strangelab/siglip2-base-patch16-naflex-vision-fp16 --local-dir siglip2-vision
python siglip2-vision/example.py

The example compares a dog photograph with a second dog photograph and a photograph of pottery. A fresh CPU install scored the second dog 0.819 and the pottery 0.431 by cosine similarity. To search your own three images, pass --photos query.jpg first.jpg second.jpg. Example images

from PIL import Image
import torch
from transformers import AutoImageProcessor, Siglip2VisionModel

model_id = "strangelab/siglip2-base-patch16-naflex-vision-fp16"
processor = AutoImageProcessor.from_pretrained(model_id)
model = Siglip2VisionModel.from_pretrained(model_id, dtype=torch.float32).eval()
image = Image.open("photo.jpg").convert("RGB")
with torch.inference_mode():
    inputs = processor(images=image, return_tensors="pt")
    embedding = torch.nn.functional.normalize(model(**inputs).pooler_output, dim=-1)

FP32 arithmetic gave the closest pooled vectors to Google’s original FP32 model. Loading in FP32 preserves the smaller model download and expands the parameters in memory. The standalone model and processor also loaded with Transformers 4.57.6.

Retrieval results

We compared all 1,000 Flickr8k test images against their 5,000 captions. The images had 234 distinct dimensions. Both searches used the same caption vectors from Google’s original text encoder. Each direction used cosine similarity over the entire test set. Recall measures whether a matching image or caption occurred in the first one or five results. Pinned evaluation split

Weights and arithmetic Image to text R@1 Image to text R@5 Text to image R@1 Text to image R@5
Google FP32, FP32 arithmetic 87.4% 98.3% 74.56% 93.68%
This model, FP32 arithmetic 87.4% 98.3% 74.56% 93.68%
This model, FP16 arithmetic 87.1% 98.3% 74.56% 93.68%

On Apple MPS, the lowest cosine similarity between corresponding pooled image vectors was 0.99996 with FP32 arithmetic and 0.99981 with FP16 arithmetic. Individual ranks can change. With FP32 arithmetic, one fewer caption retrieved its image in the first ten results. Our retrieval check covers pooled vectors at the default patch budget. Individual valid patch vectors differed more, with observed cosine as low as 0.939 in FP32 and 0.584 in FP16. Evaluate patch-dependent tasks separately.

Other formats

The timm vision-only checkpoint uses 371.7 MB of FP32 weights. The ONNX Community export includes an FP16 vision graph of about 186 MB and a 4-bit variant of about 53 MB. This release serves the native PyTorch Transformers image-feature workflow. The download comparison excludes configuration files and uses decimal megabytes. timm vision model · ONNX vision graphs

Google DeepMind developed and trained SigLIP 2. Strange Lab changed the packaging and storage precision. The model is distributed under Apache License 2.0. License · Attribution

Downloads last month
59
Safetensors
Model size
92.9M params
Tensor type
F16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for strangelab/siglip2-base-patch16-naflex-vision-fp16

Quantized
(4)
this model

Paper for strangelab/siglip2-base-patch16-naflex-vision-fp16