Portable Go wrapper around the
sd-scriptsand Musubi Python training stacks — train LoRAs and Textual Inversions for Anima, SDXL/Pony/Illustrious, LTX 2.3/Wan 2.2 video, and Krea 2 image models from a single embedded UI on Linux and Windows.
Linux (with Git)
git clone --depth 1 https://github.com/darksidewalker/DaSiWa-TrainFlow.git && cd DaSiWa-TrainFlow
chmod +x TrainFlow TrainFlow_Runtime_Tool && ./TrainFlow_Runtime_ToolLinux (without Git)
curl -L -o TrainFlow.zip https://github.com/darksidewalker/DaSiWa-TrainFlow/archive/refs/heads/main.zip
unzip TrainFlow.zip && cd DaSiWa-TrainFlow-main
chmod +x TrainFlow TrainFlow_Runtime_Tool && ./TrainFlow_Runtime_ToolWindows PowerShell (with Git)
git clone --depth 1 https://github.com/darksidewalker/DaSiWa-TrainFlow.git; cd DaSiWa-TrainFlow
.\TrainFlow_Runtime_Tool.exeWindows PowerShell (without Git)
Invoke-WebRequest -Uri https://github.com/darksidewalker/DaSiWa-TrainFlow/archive/refs/heads/main.zip -OutFile TrainFlow.zip
Expand-Archive TrainFlow.zip -Force; cd DaSiWa-TrainFlow-main
.\TrainFlow_Runtime_Tool.exeThe runtime tool opens at http://127.0.0.1:7870. Click Verify Runtime, then Install Requirements. Once ready, launch the trainer (./TrainFlow or .\TrainFlow.exe) — the UI opens at http://127.0.0.1:7860.
- Set up the runtime — run the Runtime Tool, verify it, install requirements
- Pick a profile — choose your model family in the main UI
- Point to your data — select model files and dataset folders using the Browse buttons
- Configure training — set trigger word, rank, optimizer, steps — or click Auto Calc for smart defaults based on your dataset size and GPU VRAM
- Start training — watch the live log, monitor hardware, browse preview samples
- Finish — click Quit when done; your outputs are in the project folder
| Linux | Windows | |
|---|---|---|
| CUDA (NVIDIA GPU) | ✅ | ✅ |
| ROCm (AMD GPU, Linux) | ✅ | 🟥 |
| AMD GPU monitoring | ✅ | ✅ |
| Portable Python runtime | ✅ | ✅ |
| uv / pip installs | ✅ | ✅ |
| Hardware overlay | ✅ | ✅ |
| Hardware Monitor | NVIDIA (CUDA) | AMD (Linux sysfs) | AMD (Windows WMI) |
|---|---|---|---|
| GPU utilization | ✅ | ✅ | 🟥 |
| VRAM used / total | ✅ | ✅ | ✅ |
| Temperature | ✅ | ✅ | 🟥 |
| Power draw / limit | ✅ | ✅ | 🟥 |
| CPU usage | ✅ | ✅ | ✅ |
| CPU temperature | ✅ | ✅ | ✅ |
| RAM usage | ✅ | ✅ | ✅ |
| Feature | Anima | SDXL / Pony / Illustrious | LTX 2.3 Video | Wan 2.2 Video | Krea 2 Image |
|---|---|---|---|---|---|
| LoRA training | ✅ | ✅ | ✅ | ✅ | ✅ |
| Textual Inversion | ✅ | ✅ | 🟥 | 🟥 | 🟥 |
| Auto Calc (profile-aware) | ✅ | ✅ | ✅ | ✅ | ✅ |
| Training previews (enabled by default) | ✅ | ✅ | ✅ | ✅ | ✅ |
| Dynamic multi-prompt sampling | ✅ | ✅ | ✅ | ✅ | ✅ |
| Resume from state | ✅ | ✅ | ✅ | ✅ | ✅ |
| Prodigy optimizer | ✅ | ✅ | ✅ | ✅ | ✅ |
| AdamW / AdamW8bit | ✅ | ✅ | ✅ | ✅ | ✅ |
| Flash Attention | ✅ | 🟥 | 🟥 | 🟥 | 🟥 |
| torch.compile | ✅ | 🟥 | 🟥 | 🟥 | 🟥 |
| FP8 base / scaled | 🟥 | 🟥 | ✅ | ✅ | ✅ |
| Native FP8 checkpoint detection | 🟥 | 🟥 | ✅ | ✅ | ✅ |
| Block swap + pinned memory | 🟥 | 🟥 | ✅ | ✅ | ✅ |
| H2D-only LoRA block swap | 🟥 | 🟥 | ✅ | ✅ | ✅ |
| VRAM-based batch sizing | ✅ | ✅ | ✅ | ✅ | ✅ |
| Metadata (author + tags) | ✅ | ✅ | ✅ | ✅ | ✅ |
| Text/latent caching | 🟥 | 🟥 | ✅ | ✅ | ✅ |
| Video normalization | 🟥 | 🟥 | ✅ | ✅ | 🟥 |
| Managed model download | ✅ | 🟥 | 🟥 | 🟥 | ✅ |
✅ Supported — 🟥 Not applicable or not supported
| Profile | Model Files | Network Module | Bucket Step | Pipeline |
|---|---|---|---|---|
| Anima | DiT + Qwen3 + VAE | networks.lora_anima |
64px | sd-scripts |
| SDXL / Pony / Illustrious | checkpoint (+ optional VAE) | networks.lora |
32px | sd-scripts |
| LTX 2.3 | checkpoint + Gemma encoder | networks.lora_ltx2 |
16px | Musubi video |
| Wan 2.2 | DiT + T5 + VAE | networks.lora_wan |
16px | Musubi video |
| Krea 2 | RAW DiT + Qwen3-VL + Qwen-Image VAE | networks.lora_krea2 |
32px | Musubi image |
Auto Calc reads your profile and dataset count, then picks rank, learning rates, batch size, gradient accumulation, steps, and save/sample intervals — all tuned to your available VRAM. It preserves your chosen optimizer (Prodigy stays at lr=1.0 constant; AdamW/AdamW8bit stay at 1e-4 cosine).
Single portable binary, no separate web build step. Everything runs from one download:
- Colored profile switcher for all five model families
- Local file browser for datasets, models, and resume paths
- Settings autosaved to
training/settings.json - Optimizer-aware defaults (Prodigy, AdamW8bit, AdamW)
- Full training controls: rank, alpha, learning rates, batch, grad accum, steps, intervals
- SDXL-specific UNet/text-encoder LR fields and UNet-only toggle
- Optional Flash Attention and torch.compile (Anima)
- Multi-prompt sample generation with color-coded prompts
- Training preview toggle (on by default, configurable per session)
- Resume panel with automatic latest-state discovery
- Live training log streamed in real time
- Preview gallery with image overlay
- Output button to open the project output folder
- WD EVA02 ONNX tagging/captioning
- Combined Tag + Resize workflow with configurable thresholds
- Resize-copy helper (
training/prepared/<project>) - Video normalization pipeline: resolution, FPS, duration, codec, quality, parallel workers, speed control, skip frames
- Automatic Musubi dataset TOML generation with text/latent cache rebuild triggers
- Companion Runtime Tool at
http://127.0.0.1:7870 - Verify, update, and install Python runtime dependencies (uv-first with pip fallback)
- Download Anima base models and Krea 2 runtime models directly from the UI
- Download prep assets (WD tagger, U2Net)
- PyTorch backend selector: CUDA 12.4 default, experimental ROCm 6.4, or existing user-managed install
- GPU auto-detection with vendor badge in the header
- Vendor-colored backend panel (green NVIDIA/CUDA, orange AMD/ROCm) with mismatch warnings
- Platform-specific portable Python (no system Python required)
Compact real-time display inside the sampler panel:
- CPU usage, RAM usage, CPU temperature
- GPU utilization, VRAM, temperature, power draw/limit, active task labels
- NVIDIA via nvidia-smi; AMD via kernel sysfs (Linux) or WMI (Windows)
Resume Training
Three options in the Resume panel:
- Resume training enables state resume
- Use latest saved state auto-finds the newest state directory
- Resume State Path lets you pick a specific folder manually
All runs write state by default (save_last_n_steps_state = 1, save_last_n_epochs_state = 1).
Textual Inversion
Switch Training Mode to Textual Inversion to train text embeddings instead of LoRAs. Configure:
- Placeholder token (default
*test*) - Number of vectors (default 16)
- Initializer word
- Learning rate (auto-scaled by vector count)
- Batch size (VRAM-aware)
- Random cropping toggle
Supported for Anima and SDXL/Pony/Illustrious profiles.
Anima LoRA Metadata
New LoRA files include Anima safetensors metadata. Inspect or repair existing LoRAs:
python training/sd-scripts/tools/anima_lora_metadata.py path/to/lora.safetensors
python training/sd-scripts/tools/anima_lora_metadata.py path/to/lora.safetensors --fixRequired Models
Use the Runtime Tool (Download Models) to fetch base files:
models/anima/dit/anima-base-v1.0.safetensors
models/anima/text_encoder/qwen_3_06b_base.safetensors
models/anima/vae/qwen_image_vae.safetensors
Use Download Prep for dataset-prep models:
models/wd-eva02-large-tagger-v3/ (WD EVA02 tagger)
models/u2net/u2net.onnx (U2Net background removal)
Or install manually:
git clone https://huggingface.co/SmilingWolf/wd-eva02-large-tagger-v3 models/wd-eva02-large-tagger-v3
curl -L -o models/u2net/u2net.onnx https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net.onnxtorch.compile (Anima)
Per-block DiT compilation for faster Anima training. Configurable mode, backend (inductor), dynamic shape handling, and cache size. Requires Triton — automatically disabled when ROCm or custom PyTorch backends are selected. On Windows with dynamic shapes, requires MSVC Build Tools environment.
ROCm and Custom PyTorch Note
CUDA remains the fully supported default. ROCm 6.4 and existing-PyTorch modes are experimental — they disable CUDA-only features (Flash Attention, torch.compile/Triton) automatically. AMD GPU monitoring on Linux works via kernel sysfs and does not require ROCm installed.
H2D-only Musubi Block Swap
LTX 2.3, Wan 2.2, and Krea 2 LoRA profiles use Musubi's H2D-only block swap by default when block swap is enabled. The frozen base weights keep a master copy in CPU RAM, so only host-to-device transfers are needed; the redundant device-to-host copy used by classic block swap is skipped. This is especially useful with FP8 base/scaled weights.
The Advanced Musubi dialog exposes H2D-only block swap (LoRA) and H2D ring buffers. The default ring size is 2 for transfer/compute overlap; select 1 to minimize VRAM at the cost of that overlap.
Requirements and limits:
- CUDA and frozen-base LoRA / LoHa / LoKr training only; it is not compatible with full base-model fine-tuning.
- Gradient checkpointing is required and is enabled by the Musubi profile defaults.
- Do not combine it with LTX 2 aggressive block-swap modes.
Adding New Training Types
Future types should use small profile adapters rather than UI/backend branches. See docs/training-type-integration.md for the full checklist.
Short version: add an architecture constant and profile case, Musubi command builder, TOML generation, colored UI button, and focused tests.
Note: upstream Musubi source is https://github.com/kohya-ss/musubi-tuner. The LTX 2.3 integration depends on LTX2 entrypoints that may live in an LTX-capable fork — preserve those files when updating vendored Musubi.
System Requirements
| Requirement | Notes |
|---|---|
| GPU | NVIDIA (CUDA) recommended; AMD (ROCm 6.4) on Linux |
| Python 3.12 | Recommended for the embedded runtime |
| nvidia-smi | Needed for NVIDIA GPU monitoring |
| amdgpu kernel driver | Needed for AMD GPU monitoring on Linux |
| Go 1.22+ | Only when building from source |
Build From Source
Only needed when modifying Go code or rebuilding release artifacts.
Linux:
go build -trimpath -ldflags="-s -w" -o TrainFlow ./cmd/trainflow
go build -trimpath -ldflags="-s -w" -o TrainFlow_Runtime_Tool ./cmd/runtime-toolCross-compile (Windows):
.\build.ps1Outputs:
TrainFlow # Linux binary
TrainFlow.exe # Windows binary
TrainFlow_Runtime_Tool # Linux runtime tool
TrainFlow_Runtime_Tool.exe # Windows runtime tool
dist/trainflow-linux-amd64 # Linux release
dist/trainflow-windows-amd64.exe # Windows release
dist/trainflow-runtime-tool-linux-amd64
dist/trainflow-runtime-tool-windows-amd64.exe
Shipping & Distribution
Do not commit python_embeded/ to Git.
Normal distribution — ship only the root binaries; the runtime tool creates the platform runtime on the user's machine:
- Windows:
TrainFlow.exe+TrainFlow_Runtime_Tool.exe - Linux:
TrainFlow+TrainFlow_Runtime_Tool
Fully offline packages — create a ZIP/7z containing binaries plus python_embeded/<platform> and upload as a GitHub Release asset.
Built on the sd-scripts training stack. Video training powered by musubi-tuner. TrainFlow's Musubi integration, including H2D-only block swap support, credits AkaneTendo25/musubi-tuner. The original Anima TrainFlow by ThetaCursed inspired the portable trainer concept.
