LLM Adapter Loader Custom
Same adapter loader, but every knob is yours now
- llm_adapter
- info
LLMAdapterLoaderCustom is the version of the adapter loader for people who are training their own adapters, not just running the published RouWei-Gemma one. It does the same job - load a .safetensors from ComfyUI/models/llm_adapters/ and return an LLM_ADAPTER - but where the normal LLMAdapterLoader hides the architecture behind two presets, this node hands you all eight of the parameters that define the adapter network.
Read that as a warning as much as a feature. With the plain loader, the type preset guarantees the network shape matches the trained weights. Here, nothing is guaranteed: every one of these values must exactly match the architecture your weights were trained with, or load_state_dict fails with a shape mismatch. If you haven't trained anything, you want LLMAdapterLoader, not this node.
The knobs and what they mean
The defaults are the Gemma preset (llm_dim 1152, target_seq_len 308, 2 wide + 3 narrow blocks, 16 heads, dropout 0.1) - so leaving everything alone reproduces the standard path. The ones that matter:
llm_dim(default 1152) - hidden size of the LLM whose hidden states you're adapting. 1152 for Gemma-3-1b, 2304 for T5Gemma. Must match the encoder.sdxl_seq_dim(2048) andsdxl_pooled_dim(1280) - SDXL's prompt-embedding and vector-embedding dimensions. These are SDXL constants; change them and the conditioning won't be SDXL-shaped anymore.target_seq_len(308) - how many tokens the compression stage squeezes the LLM output down to. This is baked into the positional embeddings, so changing it changes the network's fixed output length.n_wide_blocks/n_narrow_blocks(2 / 3),num_heads(16),dropout(0.1) - the transformer stack structure. All frozen into the weight shapes.
There's also device and force_reload, behaving exactly as in the other loaders. Outputs: llm_adapter and info (STRING reporting the path and the dims you chose).
When this node is actually the right one
- You trained an adapter and need to load it with its true architecture. This is the only way in the pack.
- You're experimenting - different compression ratios, block counts, attention heads - before training. Get the config that works, then train to match.
- You're poking at how the network behaves with a different
target_seq_lenthan the shipped 308.
In every other case, LLMAdapterLoader is the correct tool, and it's less likely to eat an afternoon.
Install and prerequisites
Ships in the ComfyUI LLM SDXL Adapter pack: ComfyUI Manager → "ComfyUI LLM SDXL Adapter", or git clone https://github.com/NeuroSenko/ComfyUI_LLM_SDXL_Adapter.git into ComfyUI/custom_nodes/, then restart. Needs transformers, safetensors, einops, torch. Your .safetensors goes in ComfyUI/models/llm_adapters/.
Troubleshooting
- Shape mismatch on load - the classic. Write down your training config, because the checkpoint stores no metadata telling you what architecture made it. If you didn't train it, you set a knob wrong or grabbed the wrong node.
- Loaded fine but garbage output - the file loaded (it was a valid state dict) but the dims silently mismatched a different structure, or
target_seq_lendoesn't match what the encoder produced. Checkinfoagainst what you trained. - Forgetting
force_reloadwhen you changellm_dimmid-session - the cached adapter ignores the new values until you force it.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| adapter_name | COMBO | 0 options: | |
| llm_dimopt | INT | 1152512–4096 | — |
| sdxl_seq_dimopt | INT | 20481024–4096 | — |
| sdxl_pooled_dimopt | INT | 1280512–2048 | — |
| target_seq_lenopt | INT | 30864–1024 | — |
| n_wide_blocksopt | INT | 21–8 | — |
| n_narrow_blocksopt | INT | 31–8 | — |
| num_headsopt | INT | 164–32 | — |
| dropoutopt | FLOAT | 0.100–0.5 | — |
| deviceopt | COMBO | auto | 4 options: auto, cuda:0, cuda:1, cpu |
| force_reloadopt | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| llm_adapter | LLM_ADAPTER | — |
| info | STRING | — |