Nodes/ComfyUI_JinaCLIP_SDXL_Adapter/Jina Adapter Loader (Advanced)
ComfyUI Node

Jina Adapter Loader (Advanced)

Jina Adapter Loader (Advanced) — the version you'll actually use for the current adapter

By lRemixl·Created 5 months ago·Updated 3 months ago· 0
Jina Adapter Loader (Advanced)
    • jina_adapter
    • info
    adapter_name
    deviceauto
    max_seq_length539
    force_reloadfalse
    attn_poolingtrue
    use_positional_embeddingstrue

    Here's a funny thing about this pack: the "basic" Jina Adapter Loader is not the one the author wants you to use. The README is explicit that the initial release of the adapter needs to be loaded through the Advanced node - and the Advanced node's defaults happen to be exactly the settings the README recommends. So for most people, this is the loader. The basic one is the edge case, not this one.

    What makes it "advanced" is three toggles the basic node hardcodes: max_seq_length, attn_pooling, and use_positional_embeddings. Those aren't decoration. The adapter's positional-embedding table and attention pooler change the geometry of the conditioning it produces, and if the settings you load with don't match how the adapter was trained, you get a prompt that follows your words loosely - think "red car" producing a blue truck. The advanced node exists so the load settings can line up with the release, and the README's recipe is baked into the defaults.

    How it works

    Same machinery as the basic loader (jina_to_sdxl_adapter_v2.py): it instantiates the adapter with a 1024-dim input, 2048-dim sequence projection, 1280-dim pooled projection, four attention blocks, 16 heads, and then load_state_dict(strict=True) from the safetensors in your models/llm_adapters folder. The differences:

    • max_seq_length (539 default, or 1078) - the length of the positional embedding table. Longer lets the adapter attend to longer prompts; shorter is tighter and cheaper. 539 is the README's pick for the current release.
    • attn_pooling (true default) - whether the pooled 1280-dim vector comes from a learned attention pooler (a query token attending over your prompt) rather than a plain projection.
    • use_positional_embeddings (true default) - whether token positions get embedded at all. The README says the current adapter was trained with this on, so leave it.

    The node also reloads the adapter whenever any of these settings change, not just when the file path changes - the should_reload check compares all three. That's a thoughtful touch: you can flip attn_pooling on and off for experiments without restarting ComfyUI.

    The inputs that matter

    • adapter_name - picker over models/llm_adapters/ (subfolders shown as Folder/file.safetensors). Drop TheRemixer's jina-clip-v2-adapter.safetensors (~0.9GB) in there and it appears.
    • device (auto) - auto, cuda:0/1, cpu. Leave it.
    • force_reload - force a reload from disk even if nothing changed.

    Outputs: jina_adapter (into Jina Text Encode (SDXL) or the Advanced encoder) and info (a STRING reporting the adapter path, device, and which settings were used).

    The one knob that matters

    Keep the encoder's Padding_Mode in step with the loader's max_seq_length. Load at 539, and pad to 539 (or Nearest-77) in the encoder; load at 1078, pad to 1078. Mismatched padding doesn't hard-crash - the mask and zero-fill absorb it - but you're handing the adapter sequence lengths its positional embedding table wasn't sized for, and "subtly worse" is the kind of bug you don't notice until you've regenerated twenty times.

    Install

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

    Restart, confirm the adapter file is in models/llm_adapters/ and the base model in models/llm/. The pack carries no requirements.txt; it needs transformers, safetensors, and einops, which a stock ComfyUI already has. If you've ever been told "use the advanced node" by a workflow's README, this is that node - and unlike most "advanced" variants, it's the one the author actually runs.

    Categoryllm_sdxl/jina/advanced

    Inputs (6)

    NameTypeDefaultDescription
    adapter_nameCOMBO0 options:
    deviceoptCOMBOauto4 options: auto, cuda:0, cuda:1, cpu
    max_seq_lengthoptCOMBO5392 options: 539, 1078
    force_reloadoptBOOLEANfalse
    attn_poolingoptBOOLEANtrue
    use_positional_embeddingsoptBOOLEANtrue

    Outputs (2)

    NameTypeDescription
    jina_adapterJINA_ADAPTER
    infoSTRING