clip-anytorch
# CLIP
What it is and what it does
clip-anytorch is a PyPI package wrapping OpenAI's CLIP (Contrastive Language-Image Pre-Training) model. CLIP is a neural network trained on image-text pairs that learns a shared embedding space, allowing it to match images to natural-language descriptions without being explicitly trained on any specific classification task. The package provides methods to load a pretrained model, encode images and text into feature vectors, and compute similarity scores between them.
The main use case is zero-shot image classification: given an image and a list of text labels, CLIP ranks the labels by how well they match the image without needing any labeled training data. It also enables image-text retrieval and similarity search. This fork removes the strict torch version dependency from the original repo and adds a truncate_text option for longer sequences, making it faster to install in environments like Google Colab.
Use it for:
- Zero-shot image classification: rank candidate labels for an image without task-specific training data.
- Image-text retrieval: find images matching a natural-language query or vice versa.
- Feature extraction for downstream tasks: encode images or text into fixed-size vectors for use in other models.
- Content moderation or tagging: classify or describe image content using natural-language prompts.
- Cross-modal search: build search systems that match images to text descriptions.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Loads and runs OpenAI's CLIP model to encode images and text into a shared feature space, enabling zero-shot image classification and image-text matching without task-specific training.
Yes, if you need zero-shot image classification or image-text matching and can accept dormant maintenance. The package is functional, has low install friction, and no known vulnerabilities. However, verify the unclear license before commercial use, and be aware that the last release was 2024-01-13—expect no active bug fixes or feature updates.
Install
clip-anytorch on PyPI
pip
pip install clip-anytorchuv
uv add clip-anytorchpoetry
poetry add clip-anytorchInstalling clip-anytorch
Before you install
Low install friction with a pure-Python wheel. Maintenance is dormant—last release was 2024-01-13 and last commit 2024-07-08—but the package remains functional. It relaxes the strict torch version constraint of the original repo, making it easier to install on modern environments.
License in practice
License treatment is unclear; no SPDX identifier or raw license text is available in the metadata. Verify the actual license before using in a commercial or restricted context.
Quickstart
pip install clip-anytorch
import torch
import clip
device = "cuda" if torch.cuda.is_available() else "cpu"
model, preprocess = clip.load("ViT-B/32", device=device, jit=False)
text = clip.tokenize(["a dog", "a cat"]).to(device)
with torch.no_grad():
text_features = model.encode_text(text)
Requires torch and torchvision installed; if using torch versions other than 1.7.1, must pass jit=False to clip.load() to avoid JIT compilation errors.
Verify before relying
- Whether the unclear license permits commercial or proprietary use without restriction.
- Current compatibility with recent PyTorch and torchvision versions beyond what the description explicitly covers.
- Whether PIL or other image-loading libraries are required as implicit dependencies for typical usage.
Package facts
| License | not declared (unclear) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — ftfy, regex, tqdm, torch, torchvision |
| Maintenance | dormant — 944 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 131,936/month — #11,570 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: clip_anytorch-2.6.0-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
open-clip-torchOpenCLIP provides open-source implementations…
permissive · top 5,000 on PyPI
clip-benchmarkEvaluates CLIP-like vision-language models on…
permissive · top 15,000 on PyPI
clip-interrogatorGenerates natural-language prompts from images…
permissive · top 15,000 on PyPI
pytorch-pretrained-bertProvides PyTorch implementations of BERT, GPT,…
permissive · top 15,000 on PyPI
torchtexttorchtext provides text datasets, preprocessing…
permissive · top 15,000 on PyPI
pytorchcvProvides a collection of pretrained computer…
unclear · top 15,000 on PyPI
mosaicml-streamingStreams large training datasets from cloud…
unclear · top 5,000 on PyPI
chatterbox-ttsChatterbox TTS converts text to speech using…
permissive · top 15,000 on PyPI
setfitSetFit fine-tunes Sentence Transformers for…
permissive · top 15,000 on PyPI
fastaifastai is a deep learning library that provides…
permissive · top 15,000 on PyPI