Train Anima Slider LoRA
Dial a concept, not a prompt
- model
- clip
- vae
- lora
- report_json
- lora_path
- report_path
You know those "concept sliders" people dropped on SDXL - a LoRA where cranking the strength from −1 to +1 moves one thing, like age or smile intensity, and nothing else? Train Anima Slider LoRA is that idea rebuilt for Anima, entirely inside ComfyUI: it synthesizes a slider LoRA from a YAML file of paired prompts. No dataset, no images, no sd-scripts, no ai-toolkit. You feed it a loaded Anima model and CLIP, it grinds out a .safetensors, and your LoRA strength slider becomes the dial.
That's genuinely useful: Anima's LoRA ecosystem is young, so you're often rolling your own, and editing a prompt is a lousy way to move one concept without disturbing the scene. A slider isolates the axis. The idea isn't new: it's the research lineage of rohitgandikota's sliders project (sliders.baulab.info), which people pined for the moment it hit Flux. This is a ComfyUI-native, text-only take for flow-matching models - per the author, a port of their own anima-slider-experiment trainer. Experimental, flagged as such in the code. Expect rough edges.
How it actually works
Anima is a 2B DiT on NVIDIA's Cosmos-Predict2 - a flow-matching model that predicts a velocity along a near-straight noise-to-image path. The trainer exploits that. Each YAML entry carries target, positive, unconditional, and neutral strings plus a guidance_scale and an action of enhance or erase. The node encodes them all with your CLIP, then builds a teacher signal of roughly target + eta × (positive − unconditional): the direction the prompt axis points, injected into the flow prediction being trained.
Training runs AdamW and MSE loss over a LoRA wrapper on the attention blocks (optionally plus MLP), then restores the original model - the wrapper is temporary. The LoRA's strength at inference then reproduces that directional bias; crank it and the concept moves. That's the "slider." No VAE encoding anywhere: the vae input is accepted purely for workflow parity, and the tooltip says so plainly.
The inputs that matter
There's a wall of knobs; most are flow-matching lore you can leave alone. The ones a beginner actually touches:
model,clip,vae- your loaded Anima model and text encoder.vaeis a pass-through; wire it or don't.prompt_yaml- a dropdown of ~44 bundled YAMLs (breast_size_slider,smile_intensity_slider,aura_intensity_slider,skirt_length_slider, …). The first six prompts train and the last two eval, so the defaultsprompt_indices=0,1,2,3,4,5andeval_prompt_indices=6,7just work. Pointcustom_prompt_yaml_pathat your own file to override.steps,lr,rank,alpha- defaults are 600 steps, lr 5e-6, rank 16, alpha 16. Sensible for Anima's "light touch" training culture.network_preset-attn_onlyvsattn_mlp. Keepattn_mlp; don't reach forattn_onlyto save VRAM until you've tried gradient checkpointing.width/height- 0 uses the resolution baked into the YAML, which is what you want.
Outputs are lora (a LORA_MODEL you can feed straight into a LoraLoaderModelOnly and on to the sampler) plus report_json, lora_path, and report_path. Everything lands in ComfyUI's output dir under loras/anima_slider... (the output_lora_prefix default).
Install
The real install is two commands, then restart:
cd ComfyUI/custom_nodes
git clone https://github.com/Shiba-2-shiba/Comfyui-anima-slider-node
Or in ComfyUI Manager, search "Train Anima Slider LoRA" and hit install. No model downloads, no heavy dependencies: the pack's pyproject.toml declares nothing beyond what ComfyUI already bundles (torch, yaml, safetensors). One catch: this is a new-API node built on comfy_api extensions, so it needs a recent ComfyUI. If it doesn't appear after restart, update ComfyUI first.
Troubleshooting and gotchas
- 16GB VRAM and 1024² is the target. The author's recipe: keep
attn_mlp, setmodel_residency=prefer_cuda,gradient_checkpointing=True,lora_weight_dtype=fp32. Only fall back todynamicresidency if CUDA promotion OOMs. skip_initial_eval/skip_final_evalare OOM-isolation switches, not quality knobs. Turn them on to isolate a crash phase; turn them back off for real runs.- Don't train sliders at 512². For vertical full-body, chibi, and skirt prompts, 512 ruins the composition. Use 0×0 (YAML resolution, often 896×1152) or set 896×1152 explicitly. If you set only one of width/height and the selected prompts disagree on resolution, it throws a clear error - set both.
fp32LoRA weights are the recommendation.base/bf16shave VRAM but round away small learning-rate updates; check quality if you use them.- Some bundled YAMLs contain age terms. You'll get a validation error until you set
allow_unsafe_age_terms=True. Safety gate, not a bug. - Smoke-test cheap:
steps=3at 512×512 with evals skipped, then scale up.
It's experimental, from an author with basically no community footprint, and it can quietly eat a GPU for an hour. But it's the only in-ComfyUI way to train a proper slider LoRA for Anima, and Anima takes a light LoRA touch, so it's worth the gamble. Start with steps=3 and a bundled YAML, confirm the eval images actually show the axis moving, then let it rip.
Inputs (38)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | Loaded diffusion model to train against. | |
| clip | CLIP | Loaded text encoder used to encode the prompt YAML. | |
| vae | VAE | Accepted for workflow parity with Anima pipelines; the current text-only trainer does not encode images. | |
| prompt_yaml | COMBO | prompts-anima-breast_size_slider.yaml | Prompt YAML bundled with this custom node. |
| custom_prompt_yaml_path | STRING | Optional absolute or ComfyUI-working-directory-relative YAML path. Overrides prompt_yaml when set. | |
| prompt_indices | STRING | 0,1,2,3,4,5 | Comma-separated prompt indices to cycle during training. |
| eval_prompt_indices | STRING | 6,7 | Comma-separated prompt indices for before/after eval. Empty uses prompt_indices. |
| steps | INT | 6001–100000 | Training optimizer steps. |
| lr | FLOAT | 00–1 | Fallback LoRA learning rate. |
| rank | INT | 161–256 | Fallback LoRA rank. |
| alpha | FLOAT | 16.00–1024 | LoRA alpha. |
| network_preset | COMBO | attn_mlp | LoRA target preset. |
| network_reg_dims | STRING | Optional YAML mapping of regex fullmatch patterns to LoRA ranks. | |
| network_reg_lrs | STRING | Optional YAML mapping of regex fullmatch patterns to learning rates. | |
| model_residency | COMBO | prefer_cuda | Best-effort base model residency after ComfyUI loading. Falls back to DynamicVRAM behavior if CUDA promotion fails. |
| lora_weight_dtype | COMBO | fp32 | Trainable LoRA weight dtype. fp32 is recommended; base/bf16 reduce VRAM but may lose small updates. |
| gradient_checkpointing | BOOLEAN | true | Checkpoint trainable diffusion blocks during LoRA training to reduce activation VRAM. |
| skip_initial_eval | BOOLEAN | true | Skip the pre-training eval pass for OOM isolation. Not a quality substitute. |
| skip_final_eval | BOOLEAN | false | Skip the post-training eval pass for OOM isolation. Not a quality substitute. |
| width | INT | 00–4096 | Training latent width in pixels. 0 uses the selected prompt YAML resolution. |
| height | INT | 00–4096 | Training latent height in pixels. 0 uses the selected prompt YAML resolution. |
| num_inference_steps | INT | 203–200 | Number of simple scheduler sigmas. |
| timestep_sampling | COMBO | shift | 6 options: uniform, mid, early_late, sigmoid, shift, flux_shift |
| sigmoid_scale | FLOAT | 1.000.01–20 | — |
| discrete_flow_shift | FLOAT | 3.000.01–20 | — |
| loss_weighting_scheme | COMBO | none | 3 options: none, sigma_sqrt, cosmap |
| direction_loss | COMBO | enhance_only | 2 options: enhance_only, bidirectional |
| teacher_guidance_scale | FLOAT | 1.000–20 | Global multiplier applied after each prompt YAML guidance_scale. |
| teacher_norm_reference | COMBO | positive | Output norm reference for the teacher signal. neutral usually makes stronger sliders less prone to scale blow-up. |
| min_step_index | INT | -1-1–10000 | -1 uses the default lower bound. |
| max_step_index | INT | -1-1–10000 | -1 uses the default upper bound. |
| eval_step_indices | STRING | Comma-separated eval step indices. Empty uses midpoint. | |
| eta | FLOAT | 1.000–20 | — |
| seed | INT | 9612183145239960–18446744073709550000 | — |
| eval_seed | INT | 9612183145239960–18446744073709550000 | — |
| vary_seed | BOOLEAN | true | — |
| allow_unsafe_age_terms | BOOLEAN | false | — |
| output_lora_prefix | STRING | loras/anima_slider | Output prefix under the ComfyUI output directory. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| lora | LORA_MODEL | — |
| report_json | STRING | — |
| lora_path | STRING | — |
| report_path | STRING | — |