Nodes/comfyui-anima-slider-node/Train Anima Slider LoRA
ComfyUI Node

Train Anima Slider LoRA

Dial a concept, not a prompt

By Shiba-2-shiba·Created 4 months ago·Updated 3 days ago· 2
Train Anima Slider LoRA
  • model
  • clip
  • vae
  • lora
  • report_json
  • lora_path
  • report_path
prompt_yamlprompts-anima-breast_size_slider.yaml
custom_prompt_yaml_path
prompt_indices0,1,2,3,4,5
eval_prompt_indices6,7
steps600
lr0
rank16
alpha16.0
network_presetattn_mlp
network_reg_dims
network_reg_lrs
model_residencyprefer_cuda
lora_weight_dtypefp32
gradient_checkpointingtrue
skip_initial_evaltrue
skip_final_evalfalse
width0
height0
num_inference_steps20
timestep_samplingshift
sigmoid_scale1.00
discrete_flow_shift3.00
loss_weighting_schemenone
direction_lossenhance_only
teacher_guidance_scale1.00
teacher_norm_referencepositive
min_step_index-1
max_step_index-1
eval_step_indices
eta1.00
seed961218314523996
eval_seed961218314523996
vary_seedtrue
allow_unsafe_age_termsfalse
output_lora_prefixloras/anima_slider

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. vae is 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 defaults prompt_indices=0,1,2,3,4,5 and eval_prompt_indices=6,7 just work. Point custom_prompt_yaml_path at 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_only vs attn_mlp. Keep attn_mlp; don't reach for attn_only to 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, set model_residency=prefer_cuda, gradient_checkpointing=True, lora_weight_dtype=fp32. Only fall back to dynamic residency if CUDA promotion OOMs.
  • skip_initial_eval / skip_final_eval are 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.
  • fp32 LoRA weights are the recommendation. base/bf16 shave 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=3 at 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.

Categorytraining/anima slider

Inputs (38)

NameTypeDefaultDescription
modelMODELLoaded diffusion model to train against.
clipCLIPLoaded text encoder used to encode the prompt YAML.
vaeVAEAccepted for workflow parity with Anima pipelines; the current text-only trainer does not encode images.
prompt_yamlCOMBOprompts-anima-breast_size_slider.yamlPrompt YAML bundled with this custom node.
custom_prompt_yaml_pathSTRINGOptional absolute or ComfyUI-working-directory-relative YAML path. Overrides prompt_yaml when set.
prompt_indicesSTRING0,1,2,3,4,5Comma-separated prompt indices to cycle during training.
eval_prompt_indicesSTRING6,7Comma-separated prompt indices for before/after eval. Empty uses prompt_indices.
stepsINT6001–100000Training optimizer steps.
lrFLOAT00–1Fallback LoRA learning rate.
rankINT161–256Fallback LoRA rank.
alphaFLOAT16.00–1024LoRA alpha.
network_presetCOMBOattn_mlpLoRA target preset.
network_reg_dimsSTRINGOptional YAML mapping of regex fullmatch patterns to LoRA ranks.
network_reg_lrsSTRINGOptional YAML mapping of regex fullmatch patterns to learning rates.
model_residencyCOMBOprefer_cudaBest-effort base model residency after ComfyUI loading. Falls back to DynamicVRAM behavior if CUDA promotion fails.
lora_weight_dtypeCOMBOfp32Trainable LoRA weight dtype. fp32 is recommended; base/bf16 reduce VRAM but may lose small updates.
gradient_checkpointingBOOLEANtrueCheckpoint trainable diffusion blocks during LoRA training to reduce activation VRAM.
skip_initial_evalBOOLEANtrueSkip the pre-training eval pass for OOM isolation. Not a quality substitute.
skip_final_evalBOOLEANfalseSkip the post-training eval pass for OOM isolation. Not a quality substitute.
widthINT00–4096Training latent width in pixels. 0 uses the selected prompt YAML resolution.
heightINT00–4096Training latent height in pixels. 0 uses the selected prompt YAML resolution.
num_inference_stepsINT203–200Number of simple scheduler sigmas.
timestep_samplingCOMBOshift6 options: uniform, mid, early_late, sigmoid, shift, flux_shift
sigmoid_scaleFLOAT1.000.01–20
discrete_flow_shiftFLOAT3.000.01–20
loss_weighting_schemeCOMBOnone3 options: none, sigma_sqrt, cosmap
direction_lossCOMBOenhance_only2 options: enhance_only, bidirectional
teacher_guidance_scaleFLOAT1.000–20Global multiplier applied after each prompt YAML guidance_scale.
teacher_norm_referenceCOMBOpositiveOutput norm reference for the teacher signal. neutral usually makes stronger sliders less prone to scale blow-up.
min_step_indexINT-1-1–10000-1 uses the default lower bound.
max_step_indexINT-1-1–10000-1 uses the default upper bound.
eval_step_indicesSTRINGComma-separated eval step indices. Empty uses midpoint.
etaFLOAT1.000–20
seedINT9612183145239960–18446744073709550000
eval_seedINT9612183145239960–18446744073709550000
vary_seedBOOLEANtrue
allow_unsafe_age_termsBOOLEANfalse
output_lora_prefixSTRINGloras/anima_sliderOutput prefix under the ComfyUI output directory.

Outputs (4)

NameTypeDescription
loraLORA_MODEL
report_jsonSTRING
lora_pathSTRING
report_pathSTRING