skillfed

clip-anytorch

# CLIP

clip-anytorch v2.6.0 131.9K downloads/30d#11,570 on PyPI38
License unclear DORMANT released

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

uv

uv add clip-anytorch

poetry

poetry add clip-anytorch

Installing 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

image text matchingzero-shot image classificationvision language modelclip model pytorchimage feature extractiontext image similaritymultimodal embedding
vision-languagezero-shot-learningmultimodal

More Artificial Intelligence packages

Further reading