compel
A prompting enhancement library for transformers-type text embedding systems.
Decision gist · record as of 2026-08-14
Yes. Compel is actively maintained, has no security vulnerabilities, uses a permissive license, and requires only standard dependencies. It solves a real problem—fine-grained prompt control—for anyone using diffusers-based image generation. Install it if you need to adjust the relative importance of different parts of your prompts; skip it if you're happy with flat prompt strings.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python >=3.10 and transformers >=5,<6.
- Needs a compatible diffusers-based pipeline (StableDiffusionPipeline, SDXL, or Flux) already instantiated.
- Low install friction: pure Python wheel with no compiled dependencies.
License · maintenance · safety
permissive license (permissive) — Permissive license (MIT) means you can use, modify, and distribute Compel with minimal restrictions in commercial or open-source projects.
last release 2026-05-30 (76 days) · last repo commit 2026-05-30 · 606 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 131,251 downloads/mo, #11,596 on PyPI
Alternatives
Verify before relying
pip install compel
from diffusers import StableDiffusionPipeline
from compel import CompelForSD
pipeline = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")
compel = CompelForSD(pipeline)
prompt = "a cat playing with a ball++ in the forest"
conditioning = compel(prompt)
images = pipeline(prompt_embeds=conditioning.embeds, num_inference_steps=20).images- Whether memory/VRAM leak workarounds (torch.no_grad blocks, explicit tensor dereferencing) are still necessary in current versions
- Performance overhead of Compel's prompt parsing and reweighting relative to raw embeddings
What it is and what it does
Compel is a prompt weighting library for diffusion models that lets you control how much influence different parts of a text prompt have on the final image generation. Instead of treating a prompt as a flat string, you can use syntax like `word++` to upweight a concept or `word--` to downweight it, and these weights are applied to the embedding tensor before being passed to the diffusion pipeline. It works with Hugging Face's diffusers library and supports Stable Diffusion, SDXL, and Flux models, as well as negative prompts, style prompts, and batched generation.
The library handles the tokenization and embedding transformation internally, so you just pass your weighted prompt string and get back conditioning tensors ready for the pipeline. It also supports textual inversion embeddings and provides tokenization info for debugging. The main dependencies are torch, transformers, and diffusers—all standard for generative AI work—and it has no compiled dependencies, making installation straightforward.
Use it for
- Emphasize specific objects or attributes in Stable Diffusion prompts by using ++ or -- syntax to control their visual weight in the generated image
- Generate batches of images with different prompt weights applied consistently across multiple prompts and negative prompts
- Combine style prompts with content prompts in SDXL or Flux, with independent weighting for each component
- Integrate textual inversion embeddings into weighted prompts for fine-grained control over custom concepts
- Debug tokenization and embedding behavior by accessing tokenization_info from the conditioning output
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Compel is actively maintained, has no security vulnerabilities, uses a permissive license, and requires only standard dependencies. It solves a real problem—fine-grained prompt control—for anyone using diffusers-based image generation. Install it if you need to adjust the relative importance of different parts of your prompts; skip it if you're happy with flat prompt strings.
Install
compel on PyPI
Before you install
Low install friction: pure Python wheel with no compiled dependencies. Active maintenance as of 2026-05-30 with 606 repository stars. Requires Python >=3.10 and transformers >=5,<6, both standard in modern environments.
Requires Python >=3.10 and transformers >=5,<6. Needs a compatible diffusers-based pipeline (StableDiffusionPipeline, SDXL, or Flux) already instantiated.
License in practice
Permissive license (MIT) means you can use, modify, and distribute Compel with minimal restrictions in commercial or open-source projects.
Quickstart
pip install compel
from diffusers import StableDiffusionPipeline
from compel import CompelForSD
pipeline = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")
compel = CompelForSD(pipeline)
prompt = "a cat playing with a ball++ in the forest"
conditioning = compel(prompt)
images = pipeline(prompt_embeds=conditioning.embeds, num_inference_steps=20).images
Verify before relying
- Whether memory/VRAM leak workarounds (torch.no_grad blocks, explicit tensor dereferencing) are still necessary in current versions
- Performance overhead of Compel's prompt parsing and reweighting relative to raw embeddings
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 5 packagesdiffusersnotebookpyparsingtorchtransformers |
| Maintenance | Actively maintained 76 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 131,251 / month, #11,596 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13 |
Evidence: compel-2.4.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “prompt weighting for diffusion models”
- compelCompel lets you re-weight different parts of text prompts to control…
- dynamicpromptsGenerates varied text prompts for image generators like Stable…
- clip-interrogatorGenerates natural-language prompts from images by combining CLIP and…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also diffusers · tomesd · clip-interrogator · cache-dit · axial-positional-embedding · CoLT5-attention · setfit · segtok · tensorflow-text · sentence-transformers