All models

CLIPImageProjection

IP-Adapter's linear-plus-LayerNorm projection that turns a CLIP image embedding into prompt tokens.

Diffusion and generative · 1 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (3 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
589.8K
Operations
1
Framework
PyTorch
Recurrent
No
Published
2023
Cited by
2,290 (as of 18 November 2026)
Authors
Hu Ye, Jun Zhang, Sibo Liu and others
License
Apache-2.0
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m298
Graph hash
ffc1ae7e52b5a78151d8a70aeb1b0ff3d060a0dfae849b56d3ba56e0519c071a
Skeleton hash
570961720a75667e0ead606c67000ead14c95edd9076d67fb6e8d287e64f9905
Architecture hash
222c0e4253439c04de01949100b895da321a8847b329391ed18ab54565dd8264
Diagram SHA-256
398fe4f52942fee3c3b6a17efd3bedc095d425f9b6e428872a9d31d042a27a92
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

About this model's family

ImageProjection is the small front door of IP-Adapter, a lightweight adapter that gives a pretrained text-to-image diffusion model the ability to take an image as a prompt. The adapter leans on a CLIP image encoder and uses its single global embedding, which the paper says is well aligned with captions and carries both the content and the style of the picture. That one vector is what the module traced here receives, and its job is to unfold it into a short sequence of four feature tokens whose width matches the text features the diffusion model already expects. Architecturally it is plain, a linear layer followed by Layer Normalization.

The projected tokens matter because of where they go next: IP-Adapter's key design is a decoupled cross-attention mechanism that keeps separate cross-attention layers for text features and image features. For every cross-attention layer in the UNet, the authors add a new one that attends only to the image features, and during training only these new layers are trained while the original UNet stays frozen. The reasoning is that merging image features and text features into the existing cross-attention layer only aligns the image features to the text features and can miss image-specific information. The whole adapter, projection network and new attention modules together, amounts to about 22M trainable parameters. The paper reports that this small adapter performs comparably or even better than a fully fine-tuned image prompt model.

Because the base diffusion model is never modified, the trained adapter transfers to custom models fine-tuned from the same base and works alongside structural control tools such as ControlNet. At inference a weight factor lets you dial the image branch up or down, and at zero the model becomes the original text-to-image diffusion model again. The paper's experiments use OpenCLIP ViT-H/14 as the image encoder. The repository notes that IP-Adapter is available in Diffusers thanks to the Diffusers team. It also flags a practical quirk: because CLIP's default image processor center crops, IP-Adapter works best for square images and will miss information outside the center of non-square ones.

Key idea. IP-Adapter adds image prompt capability to a pretrained text-to-image diffusion model through a decoupled cross-attention mechanism that separates cross-attention layers for text features and image features. The traced ImageProjection module is the adapter's projection network, which consists of a linear layer and a Layer Normalization.

  • IP-Adapter
  • ImageProjection
  • ImageProjModel
  • CLIPImageProjection
  • image prompt adapter
  • image projection
  • CLIP image embedding
  • decoupled cross-attention
  • diffusers
  • Stable Diffusion
  • GLIGEN

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{ye2023ipadaptertextcompatibleimage,
      title={IP-Adapter: Text Compatible Image Prompt Adapter for Text-to-Image Diffusion Models}, 
      author={Hu Ye and Jun Zhang and Sibo Liu and Xiao Han and Wei Yang},
      year={2023},
      eprint={2308.06721},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2308.06721}, 
}