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..

PyPI Python Docs License: MIT

Documentation source: https://github.com/gia-uh/siglip2-toolkit/tree/main/docs (build the static site with the commands in Development; the included GitHub Actions workflow can publish it to GitHub Pages).

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.

Examples and documentation

  • Documentation — installation, quickstart, models, library guide, CLI, REST, export format, recipes, troubleshooting and the API reference.
  • examples/ — runnable scripts for embeddings, export/inspect, search, classification and the REST client.

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.4, 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.4

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.4
File Size Uploaded Provenance
siglip2_toolkit-0.0.4.tar.gz 402.0 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 443.4 kB

Release files / siglip2_toolkit-0.0.4.tar.gz

Download URL siglip2_toolkit-0.0.4.tar.gz
Size 402.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c955fbeacc8b63cfe2332bb19ed400ee4af4503b5de5bf4c4704adf078e0464f
BLAKE2b-256 checksum
How to use checksums
f3b58e0eb2bbff609dcd4f593b6b2a2f305f6c4e2d59e50171855ee6ac76679b
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.4-py3-none-any.whl

Download URL siglip2_toolkit-0.0.4-py3-none-any.whl
Size 41.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34a466be2082dc34b096d27add33bafa7a3f9834af8166427d38dc33aab48a75
BLAKE2b-256 checksum
How to use checksums
d70c46a0a3452d63124ff9409ab871d2ab1843d62bf48c26f56c1ba03774f81e
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.4

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