logo
1
0
WeChat Login

lora-scripts-next · Anima Trainer

lora-scripts-next

SD-Trainer — One-click LoRA training GUI for SD / SDXL / Flux / Anima
Powered by kohya-ss/sd-scripts, with the familiar Akegarasu GUI experience.

stars forks license release

Download  ·  中文文档  ·  Credits & License


Quick Start

Windows Portable Package (recommended for beginners)

Download SD-Trainer-v2.3.0.7z (~55 MB, includes embedded Python) from Releases, extract, and double-click run_gui.bat.

First launch auto-installs PyTorch + CUDA + all dependencies (~3 GB download). Chinese users get mirror acceleration automatically.

FilePurpose
run_gui.batLaunch training GUI (http://127.0.0.1:28000)
Update-SD-Trainer.batPull latest code from GitHub
Download-Anima-Model.batDownload Anima base model from ModelScope

Requirements: Windows 10/11 64-bit, NVIDIA GPU (RTX 20+), ~7 GB disk space.

Portable package: Flash Attention 2 not supported (for now)

The Windows portable package (SD-Trainer-v*.7z) does not install Flash Attention 2; training uses xformers or PyTorch SDPA. This is intentional, not a failed install.

PointWhy
flash-attn needs tritonPrebuilt flash-attn wheels install, but many kernels still run via Triton (flash_attn.ops.triton).
Embedded Python + tritonThe portable bundle uses Python Embeddable (python_embeded\) without a full toolchain; triton / triton-windows often fail at JIT compile time.
Cannot keep flash-attn without tritonFlash-attn-only installs hit No module named 'triton'; transformers may still probe flash_attn if the package is present.
What we doSkip flash-attn on first setup; on launch, remove broken flash-attn/triton pairs and set TRANSFORMERS_ATTN_IMPLEMENTATION=sdpa.

For Flash Attention 2, use install from source and follow Flash Attention 2 (source / venv). Portable flash-attn support may come later when embed Python + triton is reliable.

Install from Source

git clone https://github.com/wochenlong/lora-scripts-next.git
cd lora-scripts-next
OSAction
WindowsDouble-click run_gui.bat (auto-installs on first run, then launches)
Linuxbash install.bash && bash run_gui.sh

The browser auto-opens http://127.0.0.1:28000 on launch.

Python version: 3.10 recommended (full compatibility). 3.11–3.12 mostly works. 3.13+ is not supported.

Choose Browser

By default the system default browser opens. Use --browser to pick one:

python gui.py --browser chrome
python gui.py --browser edge

Flash Attention 2 (source / venv installs)

Portable users: see the section above — do not pip install flash-attn into python_embeded.

This section is for git clone + venv (or a full Python under python\), with PyTorch 2.7.0 + CUDA 12.8 installed.

What it accelerates
TrainingFlash Attention 2
Anima / SD3 LoRAWhen the stack self-checks OK, the GUI sets attn_mode to flash (log: Anima attn_mode auto-detected: flash)
SD 1.5 / SDXL / Flux, etc.Uses xformers from requirements.txt; does not require the flash-attn wheel

Priority for Anima: flashxformerstorch (PyTorch SDPA).

Requirements
  • Python 3.10 recommended (3.11–3.12 if a matching prebuilt wheel exists)
  • 64-bit venv — not the portable python_embeded
  • Matching PyTorch: torch==2.7.0+cu128, torchvision==0.22.0+cu128
  • Windows: install both triton-windows and flash-attn (flash-attn imports Triton kernels at runtime)
Option 1: Automatic (recommended)
  1. Clone the repo and run run_gui.bat on first launch (install-cn.ps1 or install.ps1 creates venv, deps, and tries the flash-attn wheel).
  2. On every launch, run_gui.ps1 checks triton + flash_attn; if missing, it installs triton-windows then the prebuilt wheel (failure is non-fatal — falls back to xformers / SDPA).

China mirror first-time install:

powershell -ExecutionPolicy Bypass -File .\install-cn.ps1

International:

powershell -ExecutionPolicy Bypass -File .\install.ps1
Option 2: Manual install (Windows)

Inside an activated venv:

.\venv\Scripts\activate

# 1. PyTorch (if not already installed)
pip install torch==2.7.0+cu128 torchvision==0.22.0+cu128 --index-url https://download.pytorch.org/whl/cu128

# 2. Triton (required on Windows, before flash-attn)
pip install "triton-windows<3.4"

# 3. Flash Attention 2 prebuilt wheel (Python 3.10 example)
pip install https://huggingface.co/lldacing/flash-attention-windows-wheel/resolve/main/flash_attn-2.7.4.post1%2Bcu128torch2.7.0cxx11abiFALSE-cp310-cp310-win_amd64.whl

Use cp311 / cp312 in the wheel filename if that is your Python version.

Option 3: Linux / WSL / AutoDL
bash install.bash    # venv + torch/xformers/requirements + optional flash-attn build
bash run_gui.sh

Building flash-attn from source needs a CUDA toolkit and C++ compiler; on failure, xformers / SDPA is used.

Verify installation
python -c "import triton; import flash_attn; from flash_attn.ops.triton.rotary import apply_rotary; print('Flash Attention 2 OK')"

Then run python gui.py and start Anima LoRA training — logs should show attn_mode flash.

Troubleshooting
SymptomFix
No module named 'triton'Install triton-windows<3.4 on Windows, then the flash-attn wheel
Wheel installs but training uses xformersRun the verify command above; flash-attn without working triton is ignored
Long compile or build errorsOn Windows use the prebuilt wheel URLs, not pip install flash-attn from source
PyTorch not 2.7+cu128Align torch with install.ps1 before installing flash-attn
Installed into portable python_embededUnsupported — use source + venv instead

Features

  • Multi-model — SD 1.5 / SDXL / Flux / Anima all work out of the box
  • Anima LoRA training — One-click sidebar entry, supports LoRA / LoKr (LyCORIS) / T-LoRA
  • Attention backends — Source/venv: Flash Attention 2 when available (Windows prebuilt wheels). Portable package: xformers / PyTorch SDPA only (flash-attn not supported yet)
  • T-LoRA — Timestep-Dependent LoRA with dynamic rank and orthogonal init (paper)
  • Train Monitor — Auto-opens with GUI, TensorBoard-backed Loss / LR scalar cards, key training parameter checks, real-time progress, terminal log echo, and preview samples
  • Built-in TensorBoard — Accessible from the sidebar, no extra setup
  • GPU detection — Detects NVIDIA / AMD GPUs on first run; AMD users get a friendly notice with ROCm guidance
  • AutoDL ready — Dedicated startup script start_autodl.sh

Interface Preview

Train Monitor Loss Curves

TensorBoard-backed Loss / LR scalar cards in the 6008 Train Monitor

Train Monitor Preview Samples

Preview samples update directly in the monitor page

Train Monitor Log Viewer

Training logs are shown in both CMD and the monitor page


Documentation

TopicLink
Anima LoRA Training Guidedocs/anima-training.md
Train Monitor & SSE APIdocs/train-monitor.md
Frontend Customizationdocs/frontend-customization.md
Docker Deploymentdocs/docker.md
CLI Argumentsdocs/cli-args.md

Changelog
DateUpdate
2026-05-20v2.3.0 — Train Monitor upgrade: TensorBoard-backed Loss/LR cards, key parameter quick check, safer port fallback, terminal log echo, quieter monitor backend
2026-05-19v2.2.0 — Portable flash-attn/triton fix, run_gui.bat execution policy + crash logging, cross-drive monitor, branding/logo, CONTRIBUTORS.md
2026-05-19v2.1.0 — Flash Attention 2 prebuilt wheels for Windows (no C++ compiler needed), save-by-steps option, fix LoKr conv_dim/conv_alpha undefined bug
2026-05-18v2.0.0 — Portable package, Flash Attention 2 auto-acceleration, AMD GPU detection, auto bf16/fp16 fix, --browser chrome/edge, vendor sd-scripts, update check
2026-05-18T-LoRA support, interactive Loss chart, LoKr standardization, Windows portable package, AutoDL script
2026-05-17Anima training backend fully migrated to kohya-ss/sd-scripts
2026-05-06Train monitor rebuild: real-time Loss cards + sticky scroll
Credits & Upstream
ProjectRole
Akegarasu/lora-scriptsGUI framework & one-click training UX
kohya-ss/sd-scriptsCore training backend
KohakuBlueleaf/LyCORISLoKr / LoHa network modules (Apache-2.0)
ControlGenAI/T-LoRATimestep-Dependent LoRA (MIT, AIRI)
bluvoll/Akegarasu-lora-scripts-RFSDXL Rectified Flow reference

Full attribution in NOTICE.md.


Contributors

See CONTRIBUTORS.md for the full list of contributors and upstream credits.


Maintainer: @wochenlong

About

No description, topics, or website provided.
24.81 MiB
1 forks0 stars3 branches0 TagREADMEAGPL-3.0 license
Language
Python97%
TypeScript1.2%
Shell0.3%
HTML0.3%
Others1.2%