Skip to main content

siglip2-toolkit

Local-first toolkit around Google's SigLIP 2 models: text/image embeddings, zero-shot and fine-tuned classification, incremental corpus export, and retrieval math.

It is not a vector database: it produces embeddings and portable exports, and stays agnostic about where you store or search your vectors.

Co-developed by GIA-UH and Syalia S.R.L..

Installation

pip install siglip2-toolkit             # library + CLI
pip install "siglip2-toolkit[server]"   # + REST server (FastAPI)

Model management (the toolkit's own cache)

Models live in the toolkit's own cache, independent from HuggingFace's cache. The only command that uses the network is models download; everything else works with what you already have locally.

siglip2 models                       # your cache (★ model in use, origin, size)
siglip2 models --hf                  # SigLIP-2 catalog on HuggingFace: ✓ have it / ☁ downloadable
siglip2 models current               # the model in use (+ path, origin; --json)
siglip2 models use <id>              # set the model in use (persistent)
siglip2 models download <org/name> [--revision REV]   # into the toolkit cache (network)
siglip2 models import <path> [--name ALIAS]           # copy a local model into the cache
siglip2 models delete <id>           # delete from the cache (refuses the model in use)

Configuration lives in <home>/config.json (default home ~/.local/share/siglip2-toolkit/, created on first use):

{
  "cache_dir": "~/.local/share/siglip2-toolkit/models",
  "current": "google/siglip2-base-patch16-naflex",
  "device": "auto"
}
  • cache_dir: where the cache lives; change it to relocate it (e.g. another disk).
  • current: the model in use.
  • device: auto (CUDA → MPS → CPU), or cuda, cpu, mps, cuda:1, … Any command's --device overrides it for that run.

There are no environment variables; for non-default installations pass --home DIR (global option, before the command).

--model accepts either an identifier from your cache or a path to a local model directory. The implicit default is google/siglip2-base-patch16-naflex: on a machine that does not have it yet, the first command tells you the exact models download to run. The toolkit never picks a model for you.

Incremental exports refuse to run when the existing export was produced by a different model: mixing embedding spaces would silently corrupt the vectors.

Three ways to use it

1. As a library (primary interface)

from siglip2_toolkit import Embedder, models

# Resolve from your cache (download/import first) or pass a local path.
resolved = models.resolve_model("google/siglip2-base-patch16-naflex")
embedder = Embedder(model=resolved.path, model_id=resolved.identifier, device="auto")

vectors = embedder.embed_texts(["a wedding at sunset"])
results = embedder.classify(["photo.jpg"], labels=["beach", "mountain", "wedding"])

from siglip2_toolkit.filters import field, matches

matches({"width": 2400}, field("width") >= 2000)  # -> True

2. As a CLI

siglip2 models download google/siglip2-base-patch16-naflex
siglip2 models use google/siglip2-base-patch16-naflex
siglip2 export -i /path/to/photos -o embeddings.jsonl --incremental
siglip2 classify --image photo.jpg --labels "beach,mountain,wedding"

3. As a REST service (optional extra)

pip install "siglip2-toolkit[server]"
siglip2 serve --host 0.0.0.0 --port 8000

Endpoints: /v1/embed/text, /v1/embed/image, /v1/classify, /v1/health, /v1/info.

Highlights

  • Library-first design: the CLI and the REST server are thin adapters over the same public API.
  • Zero-shot classification: prompt-based labels using the model's calibrated SigLIP logits, plus fine-tuned classification heads (ImageClassifier).
  • Own model cache: downloads and imports live in the toolkit cache (independent from HuggingFace's); only models download uses the network.
  • GPU-ready: device: "auto" picks CUDA when available (FP16; FP32 on CPU); override per command with --device.
  • Incremental export: new, modified and deleted files are detected (modification detection requires metadata).
  • Resumable runs: interrupted exports continue where they left off.
  • Optional metadata: rich file metadata (EXIF, dimensions, timestamps, thumbnails) — or ids and vectors only, your choice.
  • Versioned export format (jsonl / pkl) with an embedding-space manifest.
  • Retrieval math: top-k scoring, RRF fusion, similarity-drop filtering and serializable metadata filters, composable with any store.

Status: first preview (0.0.3, October 2026). The public API and the export format may still change before 1.0; pin the version you depend on.

Development

Managed with uv:

uv sync --all-extras     # dev + server extras
uv run pytest
uv run siglip2 --help
uv lock                   # refresh uv.lock
uv build                  # wheel + sdist

CPU-only development (avoids the CUDA torch wheels):

uv venv --python 3.12
uv pip install --torch-backend cpu -e ".[dev,server]"

License

MIT — see LICENSE.

Metadata

Release files for siglip2-toolkit 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for siglip2-toolkit 0.0.3
File Size Uploaded Provenance
siglip2_toolkit-0.0.3.tar.gz 310.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for siglip2-toolkit 0.0.3
File Interpreter ABI Platform
siglip2_toolkit-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 350.8 kB

Release files / siglip2_toolkit-0.0.3.tar.gz

Download URL siglip2_toolkit-0.0.3.tar.gz
Size 310.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e19a9c9b62ab6a65537d432916ce545ff1ad58374f56afba766352fd82096d69
BLAKE2b-256 checksum
How to use checksums
37f047a7f39a4bc3cc12b900fa5fa8c4214e54cea56747862daf4f0dc7d1430e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Release files / siglip2_toolkit-0.0.3-py3-none-any.whl

Download URL siglip2_toolkit-0.0.3-py3-none-any.whl
Size 40.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
901e2900f73e25b11a9c5f3807d7176c9b3614ea533a9e40db9c89835ef13d82
BLAKE2b-256 checksum
How to use checksums
65c3e078d236d8b422a080dc8b70c9588292e11ef070e13584db08d83950a66e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Security for siglip2-toolkit 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page