Anima Soft Tokens Loader
Conditioning spliced straight into the DiT
- model
- MODEL
Soft tokens are the rare adapter that isn't a weight delta at all. Where a LoRA nudges model weights and ReFT edits residual streams, an Anima soft-token file is a bank of learned vectors spliced into the cross-attention embedding inside the first n_layers DiT blocks - a SoftREPA parameterization (Lee et al., arXiv:2503.08250). Think of it as conditioning knowledge you baked directly into the blocks' text-path input rather than into any weight. AnimaSoftTokensLoader is the node that plays them back.
How it works
The checkpoint carries tokens ((n_layers, K, D) - one vector per layer per token slot) plus t_offsets.weight for the timestep buckets. The node installs a forward_pre_hook on each of the first n_layers blocks that rewrites that block's crossattn_emb argument, splicing in its layer's bank; a diffusion_model pre-hook reads the current sigma, bucketizes it, and precomputes the per-step bank all the hooks index. Layer counts, token count, bucket count, and splice position (end_of_sequence by default, front_of_padding if trained that way) are all inferred from the checkpoint, so you don't configure any of them.
One implementation detail matters if you ever dig into it: ComfyUI hands the FLOW model timesteps as sigma × 1000, and the pre-hook divides back to the [0, 1] sigma the trainer's bucket index expects. It also applies to both CFG branches - soft tokens are part of the conditioning the trainer always saw, not a positive-only style edit.
This is the current home for what the pack's retired Postfix loader used to do (per-block cross-attention splicing). If you have an old workflow referencing AnimaPostfixLoader, this is the node that replaces that use case.
Inputs and output
model- an Anima-family MODEL.soft_tokens- the safetensors frommake exp-soft-tokens, chosen from theComfyUI/models/lorasdropdown.strength- default 1, range 0 to 2 (the one loader in this pack that won't go negative; 0 is a no-op). Dial it back when the tokens oversteer the output.
Output is a MODEL socket. The intended pattern is to chain it after an adapter loader when you want both - MODEL → AnimaAdapterLoader → AnimaSoftTokensLoader → sampler. The hook installs go through ComfyUI's object-patch machinery, so a prior adapter's pre-hook on the same dict is preserved rather than clobbered.
Install
Identical to the rest of the pack - ComfyUI Manager (search "Anima Adapter Loader") or:
cd ComfyUI/custom_nodes
git clone https://github.com/sorryhyun/ComfyUI-Anima_lora-Adapter
Restart and you're done. No extra pip dependencies (router and splice kernels are vendored under _vendor/). The main thing to keep straight is which file is which: soft-token files have tokens + t_offsets.weight keys and come from the trainer's make exp-soft-tokens, so don't feed it a Hydra or FeRA checkpoint and expect anything sensible.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| soft_tokens | COMBO | Soft-token file (tokens + t_offsets.weight keys, from `make exp-soft-tokens`). | |
| strength | FLOAT | 1.000–2 | Strength multiplier for the spliced soft tokens. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |