Extensions/ComfyUI-AnimaForge-Windows
ComfyUI Extension

ComfyUI-AnimaForge-Windows

Windows-friendly edition of the AnimaForge ComfyUI Anima LoRA factory with Windows-first layout and setup. (Description by CC)

By AI-KSK·Created 3 months ago·Updated 3 months ago· 0
AI-KSK/ComfyUI-AnimaForge-Windows
Nodes
On cloudLocal install
Stars0
Updated3 months ago
Readme

AnimaForge Windows

AnimaForge Windows is the Windows-friendly edition of the AnimaForge ComfyUI Anima LoRA factory.

It keeps the same core idea:

one dataset folder = one LoRA task
folder name = trigger word
Gemma/VLM = automatic captioning
AnimaForge = caption cleanup, trigger protection, repeat calculation, and batch training

The difference is packaging. This project is designed for users who do not run Linux, cloud notebooks, or /workspace-style containers.

Why This Project Exists

The original workflow assumes a prepared Linux-style environment with sd-scripts, model files, Python paths, and training wrappers already in place. That is fine for a controlled Docker or cloud image, but it is difficult for many Windows users.

This edition moves toward a Windows-first layout:

ComfyUI/custom_nodes/ComfyUI-AnimaForge-Windows/
  backend/
    sd-scripts/          created by setup script, ignored by Git
  scripts/
    install_windows.ps1
    setup_sd_scripts_backend.ps1
    anima_train_network_wrapper.py
  workflows/

sd-scripts is not committed into this repository as a giant vendored tree. Instead, the setup script clones it into backend/sd-scripts, creates a virtual environment, installs dependencies, and lets the ComfyUI node call that backend automatically.

Practical Design

This project does not require users to understand Linux paths such as:

/workspace/sd-scripts/.venv/bin/python

On Windows, the default backend Python becomes:

backend\sd-scripts\.venv\Scripts\python.exe

The training wrapper becomes:

scripts\anima_train_network_wrapper.py

The included workflows leave train_script_path and python_executable blank, so the plugin can auto-select these Windows-friendly defaults.

Requirements

Install these first:

  • Windows 10 or Windows 11
  • Git for Windows
  • Python 3.10 or 3.11
  • ComfyUI
  • NVIDIA GPU with a working CUDA PyTorch setup
  • Anima-Base v1.0 model
  • qwen_3_06b_base.safetensors
  • qwen_image_vae.safetensors
  • ComfyUI-llama-cpp_vlm for the included Gemma/VLM caption workflow
  • llama-cpp compatible VLM model and matching mmproj file

Expected model locations:

ComfyUI\models\diffusion_models\anima-base-v1.0.safetensors
ComfyUI\models\clip\qwen_3_06b_base.safetensors
ComfyUI\models\vae\qwen_image_vae.safetensors
ComfyUI\models\LLM\gemma-3-12b-it-heretic-Q6_K.gguf
ComfyUI\models\LLM\gemma-3-12b-it-mmproj-BF16.gguf

Install

Clone this repository into ComfyUI custom nodes:

cd C:\ComfyUI\custom_nodes
git clone https://github.com/AI-KSK/ComfyUI-AnimaForge-Windows.git
cd ComfyUI-AnimaForge-Windows

Install plugin dependencies into your ComfyUI Python:

powershell -ExecutionPolicy Bypass -File .\scripts\install_windows.ps1

Set up the local sd-scripts backend:

powershell -ExecutionPolicy Bypass -File .\scripts\setup_sd_scripts_backend.ps1

Or run both from one command:

powershell -ExecutionPolicy Bypass -File .\scripts\install_windows.ps1 -SetupBackend

Restart ComfyUI after installation.

Why Not Commit sd-scripts Directly?

sd-scripts plus its virtual environment can become several gigabytes. Committing it directly would make the plugin hard to download, hard to update, and legally messy for attribution.

This project uses a better split:

  • AnimaForge plugin code stays small and easy to update.
  • sd-scripts is installed into backend/sd-scripts.
  • The backend can be updated independently.
  • The setup script documents the third-party dependency clearly.

sd-scripts is Apache 2.0 licensed. See THIRD_PARTY.md.

Quick Start

Create a training dataset folder, for example:

C:\AnimaTrain\
  rebecca_girl\
    001.png
    002.png
    003.png

  lucy_girl\
    001.jpg
    002.jpg
    003.jpg

Each first-level folder becomes one LoRA task. The folder name becomes the trigger word.

Recommended folder names:

rebecca_girl
lucy_girl
blue_dress_style
silver_hair_knight

Avoid spaces and special symbols:

rebecca girl
Rebecca-Girl!!!
my new test dataset 01

Load the included workflow:

workflows\Anima_Gemma4_Batch_Caption_Train_FINAL.json

Then set dataset_root in AnimaBatchFolderLoader to your Windows dataset folder, such as:

C:\AnimaTrain

Gemma3 vs Gemma4 for Captioning

The included workflow uses a Gemma3 12B VLM setup:

model = gemma-3-12b-it-heretic-Q6_K.gguf
mmproj = gemma-3-12b-it-mmproj-BF16.gguf
chat_handler = Gemma3
n_ctx = 4096
vram_limit = 18

Gemma4-class models can produce strong captions, but they are much slower for batch captioning and require more VRAM. For this training workflow, Gemma3 12B is usually enough because the captioning task is not long reasoning. It needs reliable visible-content tags, clothing details, character details, style cues, and one short natural-language phrase.

For hundreds or thousands of images, captioning speed matters. Gemma3 is the practical default; Gemma4 is the slower high-end option.

Caption Format

AnimaForge targets Anima hybrid captions:

trigger_word, anime illustration, booru-style tags, one short natural language phrase

Example:

rebecca_girl, anime illustration, 1girl, solo, short hair, red eyes, upper body, looking at viewer, a girl in a cropped jacket facing the viewer

The cleaner removes common training pollution:

masterpiece
best quality
worst quality
score
rating
watermark
logo
signature
artist name
copyright name

Trigger Word Protection

The workflow uses:

shuffle_caption = true
keep_tokens = 1

This means the trigger word stays fixed as the first caption token, while the rest of the tags can shuffle during training.

Training Defaults

The included workflow uses:

resolution = 1024,1024
train_batch_size = 1
max_train_epochs = 10
save_every_n_epochs = 2
network_dim = 32
network_alpha = 32
learning_rate = 2e-5
mixed_precision = bf16
optimizer_type = AdamW8bit
training_strength_mode = target_steps
target_steps_per_lora = 3001
save_strategy = every_n_epochs

The workflow uses portable ComfyUI/... model paths. The plugin resolves those paths to the actual ComfyUI directory on Windows.

Repeat Calculation

When training_strength_mode = target_steps, repeats are calculated as:

num_repeats = ceil(target_steps_per_lora * batch_size / image_count / max_train_epochs)

Estimated actual steps:

actual_steps = ceil(image_count * num_repeats * epochs / batch_size)

This keeps different LoRA folders closer to the same training strength even when they have different image counts.

Output

Default LoRA output path:

ComfyUI\models\loras\anima_lora\<trigger_word>\

Example:

ComfyUI\models\loras\anima_lora\rebecca_girl\rebecca_girl.safetensors

Known Limitations

  • Training still runs through sd-scripts; this project makes installation easier, but it does not remove the underlying training dependency.
  • Batch training runs sequentially and may keep the ComfyUI queue busy until it finishes.
  • VLM caption quality depends on the selected vision-language model.
  • Gemma4-class captioning is slower; Gemma3 12B is the practical default for batch captioning.
  • Windows CUDA/PyTorch installation can vary by GPU and driver. You may need to adjust the PyTorch install command in setup_sd_scripts_backend.ps1.
  • The workflow is tuned for Anima-Base. Other base models may require different training arguments.

Security Notes

Do not publish workflow files that contain private credentials.

Check for these before sharing:

  • GitHub personal access tokens
  • API keys
  • Hugging Face access tokens
  • private model download URLs
  • local private paths you do not want to expose

Project Relationship

This project is a Windows-first companion to the original AnimaForge batch LoRA trainer. The goal is not to fork away from the core workflow, but to package the same production line in a way that is easier for Windows users to install and run.