SD-Trainer — One-click LoRA training GUI for SD / SDXL / Flux / Anima
Powered by kohya-ss/sd-scripts, with the familiar Akegarasu GUI experience.
Download · 中文文档 · Credits & License
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.
| File | Purpose |
|---|---|
run_gui.bat | Launch training GUI (http://127.0.0.1:28000) |
Update-SD-Trainer.bat | Pull latest code from GitHub |
Download-Anima-Model.bat | Download Anima base model from ModelScope |
Requirements: Windows 10/11 64-bit, NVIDIA GPU (RTX 20+), ~7 GB disk space.
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.
| Point | Why |
|---|---|
| flash-attn needs triton | Prebuilt flash-attn wheels install, but many kernels still run via Triton (flash_attn.ops.triton). |
| Embedded Python + triton | The 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 triton | Flash-attn-only installs hit No module named 'triton'; transformers may still probe flash_attn if the package is present. |
| What we do | Skip 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.
git clone https://github.com/wochenlong/lora-scripts-next.git
cd lora-scripts-next
| OS | Action |
|---|---|
| Windows | Double-click run_gui.bat (auto-installs on first run, then launches) |
| Linux | bash 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.
By default the system default browser opens. Use --browser to pick one:
python gui.py --browser chrome
python gui.py --browser edge
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.
| Training | Flash Attention 2 |
|---|---|
| Anima / SD3 LoRA | When 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: flash → xformers → torch (PyTorch SDPA).
python_embededtorch==2.7.0+cu128, torchvision==0.22.0+cu128triton-windows and flash-attn (flash-attn imports Triton kernels at runtime)run_gui.bat on first launch (install-cn.ps1 or install.ps1 creates venv, deps, and tries the flash-attn wheel).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
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.
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.
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.
| Symptom | Fix |
|---|---|
No module named 'triton' | Install triton-windows<3.4 on Windows, then the flash-attn wheel |
| Wheel installs but training uses xformers | Run the verify command above; flash-attn without working triton is ignored |
| Long compile or build errors | On Windows use the prebuilt wheel URLs, not pip install flash-attn from source |
| PyTorch not 2.7+cu128 | Align torch with install.ps1 before installing flash-attn |
Installed into portable python_embeded | Unsupported — use source + venv instead |
start_autodl.sh
TensorBoard-backed Loss / LR scalar cards in the 6008 Train Monitor
Preview samples update directly in the monitor page
Training logs are shown in both CMD and the monitor page
| Topic | Link |
|---|---|
| Anima LoRA Training Guide | docs/anima-training.md |
| Train Monitor & SSE API | docs/train-monitor.md |
| Frontend Customization | docs/frontend-customization.md |
| Docker Deployment | docs/docker.md |
| CLI Arguments | docs/cli-args.md |
| Date | Update |
|---|---|
| 2026-05-20 | v2.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-19 | v2.2.0 — Portable flash-attn/triton fix, run_gui.bat execution policy + crash logging, cross-drive monitor, branding/logo, CONTRIBUTORS.md |
| 2026-05-19 | v2.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-18 | v2.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-18 | T-LoRA support, interactive Loss chart, LoKr standardization, Windows portable package, AutoDL script |
| 2026-05-17 | Anima training backend fully migrated to kohya-ss/sd-scripts |
| 2026-05-06 | Train monitor rebuild: real-time Loss cards + sticky scroll |
| Project | Role |
|---|---|
| Akegarasu/lora-scripts | GUI framework & one-click training UX |
| kohya-ss/sd-scripts | Core training backend |
| KohakuBlueleaf/LyCORIS | LoKr / LoHa network modules (Apache-2.0) |
| ControlGenAI/T-LoRA | Timestep-Dependent LoRA (MIT, AIRI) |
| bluvoll/Akegarasu-lora-scripts-RF | SDXL Rectified Flow reference |
Full attribution in NOTICE.md.
See CONTRIBUTORS.md for the full list of contributors and upstream credits.
Maintainer: @wochenlong