Nodes/ComfyUI-AnimaForge-Windows/Anima Batch Train Config
ComfyUI Node

Anima Batch Train Config

Every training knob in this pack, in one node

By AI-KSK·Created 3 months ago·Updated 3 months ago· 0
Anima Batch Train Config
    • ANIMA_TRAIN_CONFIG
    train_script_path/tmp/ComfyUI/custom_nodes/ComfyUI-AnimaForge-Windows/scripts/anima_train_network_wrapper.py
    python_executable/tmp/ComfyUI/custom_nodes/ComfyUI-AnimaForge-Windows/backend/sd-scripts/.venv/bin/python
    base_model_path/tmp/ComfyUI/models/diffusion_models/anima-base-v1.0.safetensors
    output_dir/tmp/ComfyUI/models/loras/anima_lora
    resolution1024,1024
    train_batch_size1
    max_train_epochs10
    save_every_n_epochs1
    network_dim32
    network_alpha16
    learning_rate1e-4
    mixed_precisionbf16
    optimizer_typeadamw8bit
    shuffle_captiontrue
    keep_tokens1
    caption_separator,
    caption_extension.txt
    extra_args--qwen3 /tmp/ComfyUI/models/clip/qwen_3_06b_base.safetensors --vae /tmp/ComfyUI/models/vae/qwen_image_vae.safetensors --save_model_as safetensors --network_module networks.lora_anima --network_train_unet_only --lr_scheduler constant --timestep_sampling sigmoid --discrete_flow_shift 1.0 --gradient_checkpointing --cache_latents --vae_chunk_size 64 --vae_disable_cache --max_data_loader_n_workers 0
    stop_on_errortrue
    training_presetstandard
    training_strength_modetarget_steps
    target_steps_per_lora2000
    num_repeats1
    save_strategyfinal_only

    AnimaBatchTrainConfig is the control room for the whole batch. It's a wide node with ~25 inputs, and at first glance it looks like the worst kind of Kohya-era config sprawl - every field a network_dim, every dropdown a trap. It's actually less scary than it looks: the defaults are sane for Anima-Base, and it produces a single ANIMA_TRAIN_CONFIG object that AnimaBatchStartTrain turns into a real sd-scripts command. Most beginners only ever touch a handful of these.

    How it works

    The node doesn't train anything; it just packages your settings into a config dict. The interesting logic happens one node downstream, in train_runner.py: the config fields map onto sd-scripts flags, paths get resolved, and the repeat count gets calculated.

    The two things worth understanding deeply:

    Presets are defaults, not modes. training_preset has smoke_test, standard, strong, and style - but they don't reroute the training path. Per the code, each preset only fills in fields you've left empty (smoke_test = 500 target steps / 768² / rank 16, standard = 2000 steps / 1024² / rank 32, strong = 3000 / 3e-5, style = 4000 / 1e-5 at 768²). Since the node always sends concrete defaults, the preset only really bites if you clear fields. Think of it as a quick config loader, not a mode switch.

    Repeat math keeps different folders at similar strength. With training_strength_mode = target_steps, it computes num_repeats = ceil(target_steps_per_lora * batch_size / image_count / max_train_epochs), then estimates actual_steps = ceil(image_count * repeats * epochs / batch_size). A 20-image folder and an 80-image folder therefore land near the same total step count, and the log warns if a folder's actual steps drift more than 70–180% of target. This is the pack's answer to the classic "big folder overtrains, small folder underachieves" problem. Set training_strength_mode = manual_epochs if you'd rather just pick num_repeats yourself.

    The inputs that matter

    • base_model_path - must point at anima-base-v1.0.safetensors. The default resolves relative to your ComfyUI folder, so it usually just works.
    • python_executable and train_script_path - leave these blank and the pack auto-selects the Windows backend and wrapper. Only touch them if you moved things.
    • resolution - 1024,1024 for standard; the style/smoke_test presets drop to 768².
    • network_dim / network_alpha - the classic Kohya pair, 32/32 in the README's tuned workflow. Anima is a 2B DiT, not SDXL: the KB's Anima notes say LoRAs plateau early (~1800 steps) and overfit past ~2400–3000 regardless of dataset size, so don't reach for huge rank.
    • max_train_epochs, target_steps_per_lora, save_strategy - epochs (10 in the tuned workflow), your per-LoRA step budget, and whether to keep checkpoints every N epochs or only the final one.
    • extra_args - the multiline box that carries Anima's special flags: --network_module networks.lora_anima, --network_train_unet_only, --qwen3 and --vae paths, --timestep_sampling sigmoid --discrete_flow_shift 1.0, gradient checkpointing and cached latents. Leave it alone unless you know what you're changing.
    • shuffle_caption / keep_tokens - shuffle_caption = true with keep_tokens = 1 locks the trigger word as the first token while the rest of the tags shuffle. The README calls this "trigger word protection."

    Installing it

    It's a stock node in the AnimaForge Windows pack: ComfyUI Manager → "ComfyUI-AnimaForge-Windows", or

    cd C:\ComfyUI\custom_nodes
    git clone https://github.com/AI-KSK/ComfyUI-AnimaForge-Windows.git
    cd ComfyUI-AnimaForge-Windows
    powershell -ExecutionPolicy Bypass -File .\scripts\install_windows.ps1 -SetupBackend
    

    Common issues

    The biggest one is version blindness: this config is tuned for Anima-Base v1.0, and the community's rule of thumb is that LoRAs need a retrain after any Anima version bump - Preview 3 famously broke Preview 2 LoRAs. If you point the config at a different base, expect to rework extra_args and step budgets. And if you're new, run smoke_test first: confirming the whole batch pipeline works before committing to a 10-epoch run is the difference between a 2-minute smoke test and a wasted hour.

    CategoryAnima/Batch LoRA

    Inputs (24)

    NameTypeDefaultDescription
    train_script_pathSTRING/tmp/ComfyUI/custom_nodes/ComfyUI-AnimaForge-Windows/scripts/anima_train_network_wrapper.py
    python_executableSTRING/tmp/ComfyUI/custom_nodes/ComfyUI-AnimaForge-Windows/backend/sd-scripts/.venv/bin/python
    base_model_pathSTRING/tmp/ComfyUI/models/diffusion_models/anima-base-v1.0.safetensors
    output_dirSTRING/tmp/ComfyUI/models/loras/anima_lora
    resolutionSTRING1024,1024
    train_batch_sizeINT11–64
    max_train_epochsINT101–10000
    save_every_n_epochsINT11–10000
    network_dimINT321–1024
    network_alphaINT161–1024
    learning_rateSTRING1e-4
    mixed_precisionCOMBObf163 options: bf16, fp16, no
    optimizer_typeSTRINGadamw8bit
    shuffle_captionBOOLEANtrue
    keep_tokensINT10–1000
    caption_separatorSTRING,
    caption_extensionSTRING.txt
    extra_argsSTRING--qwen3 /tmp/ComfyUI/models/clip/qwen_3_06b_base.safetensors --vae /tmp/ComfyUI/models/vae/qwen_image_vae.safetensors --save_model_as safetensors --network_module networks.lora_anima --network_train_unet_only --lr_scheduler constant --timestep_sampling sigmoid --discrete_flow_shift 1.0 --gradient_checkpointing --cache_latents --vae_chunk_size 64 --vae_disable_cache --max_data_loader_n_workers 0
    stop_on_errorBOOLEANtrue
    training_presetCOMBOstandard4 options: smoke_test, standard, strong, style
    training_strength_modeCOMBOtarget_steps2 options: target_steps, manual_epochs
    target_steps_per_loraINT20001–1000000
    num_repeatsINT11–10000
    save_strategyCOMBOfinal_only2 options: final_only, every_n_epochs

    Outputs (1)

    NameTypeDescription
    ANIMA_TRAIN_CONFIGANIMA_TRAIN_CONFIG