CLIP lets you match images and text without training a classifier first. You give it an image and a list of labels ("a dog", "a cat", "a sunset"), and it tells you which ones match using cosine similarity between embeddings. Works surprisingly well for semantic image search, content moderation, and zero-shot classification. Trained on 400M image-text pairs from the web. The ViT-B/32 model is the sweet spot for speed and quality. Main limitation is that it only understands whole images, not regions or fine-grained details, and vague text prompts give you vague results. If you need actual captions or chat, use BLIP-2 or LLaVA instead.

skills.sh installs
1K
GitHub stars
14.4K
last updated
Aug 21, 2026

Install

$ npx -y skills add orchestra-research/ai-research-skills --skill clip --agent claude-code

Installs into .claude/skills of the current project.

Files

CLIP - Contrastive Language-Image Pre-Training

OpenAI's model that understands images from natural language.

When to use CLIP

Use when:

  • Zero-shot image classification (no training data needed)
  • Image-text similarity/matching
  • Semantic image search
  • Content moderation (detect NSFW, violence)
  • Visual question answering
  • Cross-modal retrieval (image→text, text→image)

Metrics:

  • 25,300+ GitHub stars
  • Trained on 400M image-text pairs
  • Matches ResNet-50 on ImageNet (zero-shot)
  • MIT License

Use alternatives instead:

  • BLIP-2: Better captioning
  • LLaVA: Vision-language chat
  • Segment Anything: Image segmentation

Quick start

Installation

pip install git+https://github.com/openai/CLIP.git
pip install torch torchvision ftfy regex tqdm

Zero-shot classification

import torch
import clip
from PIL import Image

# Load model
device = "cuda" if torch.cuda.is_available() else "cpu"
model, preprocess = clip.load("ViT-B/32", device=device)

# Load image
image = preprocess(Image.open("photo.jpg")).unsqueeze(0).to(device)

# Define possible labels
text = clip.tokenize(["a dog", "a cat", "a bird", "a car"]).to(device)

Sponsors

Details

Repository
github.com/orchestra-research/ai-research-skills
Categories
AI & Agent Building, Data Science & ML
First seen
Jun 3, 2026

More from orchestra-research/ai-research-skills

All 95
1sbroenne avatarexcel-clisbroenne/mcp-server-excelExcel CLI automation skill for Windows workbooks. Use when a coding agent needs token-efficient, scriptable, or unattended Excel automation via excelcli command1Kskills.sh installs
2orchestra-research avatarawq-quantizationorchestra-research/ai-research-skillsActivation-aware weight quantization for 4-bit LLM compression with 3x speedup and minimal accuracy loss. Use when deploying large models (7B-70B) on limited GP1Kskills.sh installs
3orchestra-research avatarspeculative-decodingorchestra-research/ai-research-skillsAccelerate LLM inference using speculative decoding, Medusa multiple heads, and lookahead decoding techniques. Use when optimizing inference speed (1.5-3.6× spe1Kskills.sh installs
4orchestra-research avatarsimpo-trainingorchestra-research/ai-research-skillsSimple Preference Optimization for LLM alignment. Reference-free alternative to DPO with better performance (+6.4 points on AlpacaEval 2.0). No reference model 1Kskills.sh installs
5orchestra-research avatarguidanceorchestra-research/ai-research-skillsControl LLM output with regex and grammars, guarantee valid JSON/XML/code generation, enforce structured formats, and build multi-step workflows with Guidance -1Kskills.sh installs
6orchestra-research avatarmodel-pruningorchestra-research/ai-research-skillsReduce LLM size and accelerate inference using pruning techniques like Wanda and SparseGPT. Use when compressing models without retraining, achieving 50% sparsi1Kskills.sh installs