Registry / ai-ml / clip-benchmark

clip-benchmark

JSON →
library1.6.2pypypiunverified

CLIP-benchmark is a Python library designed to evaluate CLIP-like models on a standard set of datasets for various tasks, including zero-shot classification, zero-shot retrieval, linear probing, and captioning. It supports models like OpenCLIP, Japanese CLIP, and NLLB CLIP, and integrates with datasets from torchvision, TensorFlow datasets, and VTAB. The library is currently active, with version 1.6.2, and focuses on reproducible evaluation results.

pip install clip-benchmark
INSTALL
IMPORT
SIG · CLIP-BENCHMARK
C
clip-benchmark
ai-mlpythonv1.6.2
Install
87.7s avg
Import
Disk
5402MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.6.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✓ 97.73s
py 3.11
✕ build_error
✓ 90.17s
py 3.12
✕ build_error
✓ 85.83s
py 3.13
✕ build_error
✓ 77s
py 3.9
✕ build_error
✕ timeout
5402MB installed
● package 5402MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

run_benchmark
from clip_benchmark import run_benchmark
from clip_benchmark import run_benchmark

This command runs a zero-shot classification benchmark on the CIFAR-10 dataset using an OpenCLIP pre-trained model (ViT-B-32-quickgelu trained on LAION-400m) and saves the results to `result.json`.

clip_benchmark eval --dataset=cifar10 --task=zeroshot_classification --pretrained=laion400m_e32 --model=ViT-B-32-quickgelu --output=result.json --batch_size=64
clip-benchmark --version
Debug
Known issues
gotchaThe `--dataset_root` and `--output` arguments support templating (e.g., `wds_{dataset_cleaned}`). Ensure you understand the templating syntax when specifying paths to avoid unexpected file locations or dataset loading issues.
fix
Refer to the documentation for examples on using templated paths, especially for Hugging Face WebDatasets.
affects: >=1.0.0
gotchaWhen working with WebDatasets, the conversion process may require specific tools (e.g., `webdataset` utilities) and manual uploading to platforms like Hugging Face Hub, which is not fully automated by the library itself.
fix
Consult the `clip-benchmark` documentation on 'Evaluating on a webdataset' for instructions on preparing and using WebDatasets.
affects: >=1.0.0
gotchaSome dataset types (e.g., TensorFlow Datasets, VTAB) require additional installations beyond `clip-benchmark` itself. For instance, TensorFlow Datasets may need `tfds-nightly` and `timm`, while VTAB requires its dedicated package.
fix
Install necessary optional dependencies based on the datasets you plan to benchmark. Check the library's `README` or `datasets/builder.py` for specific requirements.
affects: >=1.0.0
gotchaWhen adding support for new custom CLIP models, you must define a specific model loading function and integrate it into `clip_benchmark/models/__init__.py`'s `TYPE2FUNC` mapping. This requires understanding the internal model loading mechanism.
fix
Refer to `clip_benchmark/models/open_clip.py` as an example for structuring your model loading function and ensure it returns the (model, transform, tokenizer) tuple as expected.
affects: >=1.0.0
Upgrade
Version history
1.6.2latest on PyPI · released Jul 25, 2025
Audit
Dependencies
open_clip_torchrequiredRequired for evaluating OpenCLIP models.
torchrequiredCore deep learning framework dependency.
torchvisionoptionalRequired for datasets from torchvision.
tensorflow-datasetsoptionalRequired for datasets from TensorFlow.
timmoptionalUsed by some models and for TensorFlow dataset support.
Agent activity
31 hits · last 30 days
node
26
OpenAI (training)
1
Resources
clip-benchmark — pip install clip-benchmark · libregistry