ComfyUI Node

Jina Adapter Loader

The Jina Adapter Loader — the translation layer that teaches SDXL to read Jina CLIP v2

By lRemixl·Created 5 months ago·Updated 3 months ago· 0
Jina Adapter Loader
    • jina_adapter
    • info
    adapter_name
    deviceauto
    force_reloadfalse

    The Jina Adapter Loader is the middle node in the Jina-for-SDXL chain, and it's also the one you might want to skip. Its job is simple on paper: load a small learned network that translates Jina CLIP v2's text features into the exact shape SDXL's UNet expects. In practice, this node exists mostly because a sibling node does its job better - more on that in the gotchas, because it will bite you.

    Why bother with any of this in the first place? SDXL ships with two CLIP text encoders that cap out at 77 tokens and get confused by anything outside their English-heavy training data. Jina CLIP v2 is a 0.9B multilingual embedding model (561M text tower + 304M vision tower, 89 languages) that understands long prompts and non-English text far better. This pack from lRemixl (a rework of NeuroSenko's ComfyUI_LLM_SDXL_Adapter) swaps the encoders out and keeps the SDXL checkpoint. The Adapter Loader is what loads the "interpreter."

    How it works

    Jina CLIP v2 outputs 1024-dimensional hidden states per token, plus a pooled text embedding. SDXL's UNet cross-attends to a 2048-dimensional sequence with a 1280-dimensional pooled vector. Those are different vocabularies, so between the model and the UNet sits the adapter: a stack of four attention blocks with two projection heads - seq_projection (1024 → 2048) and pooled_projection (2048 → 1280). You can see those exact dims hardcoded in the pack's jina_to_sdxl_adapter_v2.py. Nothing here calls an API and no key is involved; it's all local weights.

    The node reads your models/llm_adapters folder (subfolders included, shown as Folder/file.safetensors), loads the matching safetensors with load_state_dict(strict=True), and hands you a ready-to-run JINA_ADAPTER object.

    The inputs that matter

    • adapter_name - the picker. Drop jina-clip-v2-adapter.safetensors (from TheRemixer's jina-clip-v2-adapter repo) into ComfyUI/models/llm_adapters/ and it shows up here.
    • device (auto default) - auto, cuda:0, cuda:1, or cpu. Leave it on auto unless you're juggling multiple GPUs.
    • force_reload - re-reads the file from disk even if it's already loaded. Set it if you swap the adapter file without restarting.

    Outputs: jina_adapter (the loaded adapter, wire it into a Jina Text Encode (SDXL) node) and info (a STRING you can drop into any text/display node to confirm what loaded).

    The gotcha that matters

    Look at the README before you commit to this node. It says the initial release of the adapter has to be loaded with the Advanced loader using Positional embeddings: true, max_seq_length: 539, attn_pooling: true. This basic node hardcodes use_positional_embeddings=False and max_seq_len=1078 - you can't change them. If your adapter was trained with positional embeddings and you load it through the basic node, the conditioning will come out subtly wrong. If the picker gives you a "model not found" or the encode looks off, reach for Jina Adapter Loader (Advanced) instead. Treat this node as the version for adapters trained without positional embeddings, and the advanced one as the default for everything else.

    Install

    From ComfyUI Manager, search "ComfyUI_JinaCLIP_SDXL_Adapter" and install, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/lRemixl/ComfyUI_JinaCLIP_SDXL_Adapter
    

    Then restart ComfyUI. The pack has no requirements.txt (it needs transformers, safetensors, and einops, all of which a normal ComfyUI install already has), and the two model files come separately: the base model in models/llm/ and the adapter in models/llm_adapters/. First load of the adapter triggers the base model's first-ever download, so expect a delay and a couple of GB if you haven't run the chain before.

    Categoryllm_sdxl/jina

    Inputs (3)

    NameTypeDefaultDescription
    adapter_nameCOMBO0 options:
    deviceoptCOMBOauto4 options: auto, cuda:0, cuda:1, cpu
    force_reloadoptBOOLEANfalse

    Outputs (2)

    NameTypeDescription
    jina_adapterJINA_ADAPTER
    infoSTRING