A LoRA training workbench: manage datasets, captions, training runs and results in one place. SDXL first.
- Dataset: import images with their captions, browse and filter by tag, edit tags one image at a time or in bulk, spot missing captions and undersized images.
- Auto-captioning: a vision LLM (any OpenAI-compatible endpoint, local or hosted) writes captions according to what the LoRA is for: a character, a style or a concept. Results are suggestions you accept or discard; with a tag dictionary installed, invented tags are flagged or corrected.
- Training: a self-contained SDXL LoRA trainer with plain-language setup, a queue, live progress and preview images after every round.
- Results: preview images of every round side by side, pick the best round, export it.
src/loracraft/
server/ FastAPI backend: projects, dataset, auto-captioning, run queue
trainer/ SDXL LoRA trainer, runs as its own process
vendor/kohya/ code adapted from kohya-ss/sd-scripts (Apache-2.0)
web/ Svelte frontend
tests/
Requires Python 3.12. Training needs a GPU that PyTorch drives through CUDA or ROCm; the dataset and captioning tools work without one.
Apple Silicon (MPS) is wired up but has never been run on a Mac: expect it to need fixes. It
trains in full precision only, so it wants a lot of memory. On a Mac, plain pip install loracraft
is enough, since the PyTorch build on PyPI includes MPS.
Install PyTorch first, from the index that matches your GPU, then LoraCraft. Which index that is (CUDA version, ROCm, …) is listed at pytorch.org:
python -m venv .venv # then activate it
pip install torch --index-url <index for your GPU>
pip install loracraftThe order matters. LoraCraft accepts any PyTorch build, so the one you installed is kept; without
one, pip install loracraft brings the default build from PyPI, which on Windows cannot use the
GPU. If that happened, repeat the pip install torch … line with --force-reinstall. The training
page tells you when the installed PyTorch cannot train.
loracraft # http://127.0.0.1:8600
python -m loracraft --port 8700 # the same, on another portTo use it as an app in a window of its own rather than in a browser tab, install the app extra:
pip install "loracraft[app]"
loracraft --windowThe window uses the system's web view: WebView2 on Windows (part of Windows 11), WKWebView on macOS; on Linux it needs GTK or Qt WebKit from the system packages, see the pywebview documentation. Closing the window does not stop a training run in progress: it carries on, and LoraCraft picks it up when started again.
User data (database, images, runs) lives in the per-user data directory, printed at startup:
%LOCALAPPDATA%\loracraft on Windows, ~/Library/Application Support/loracraft on macOS,
~/.local/share/loracraft on Linux. Set LORACRAFT_HOME to keep it elsewhere.
Requires uv and Node.js.
uv sync # Python environment, including PyTorch
cd web && npm install && npm run build
uv run loracraftuv sync installs the torch-rocm dependency group, which pins PyTorch to the AMD ROCm build for
Windows and RDNA2 cards (device-gfx1030). For another AMD card, change the device-gfx… names;
for another vendor, replace the group.
npm run build writes the web UI into src/loracraft/web_dist/, from where the server serves it.
For frontend work, run npm run dev in web/ alongside the server and open http://localhost:5600.
To build the distributions (the web UI must be built first):
uv buildTo release, set the new version in pyproject.toml, commit, then tag that commit and push the tag.
The release workflow builds the distributions, uploads them to PyPI and creates the GitHub release:
uv version 0.2.0 # also updates uv.lock
git commit -am "🔖 Release 0.2.0"
git tag v0.2.0 && git push origin main v0.2.0A run is a directory containing config.json (see trainer/config.py):
python -m loracraft.trainer <run_dir>It writes events.jsonl, checkpoints/ and samples/ into the same directory. Create a file
named stop there to stop gracefully. Checkpoints use kohya's key names and metadata, so they load
in ComfyUI and WebUI.
To validate Danbooru tags written by the vision model, put a tag list such as danbooru.csv (first
column: tag name) into <workspace>/dictionaries/. Without one, validation is skipped.
uv run pytestsrc/loracraft/vendor/kohya/ contains modified code from
kohya-ss/sd-scripts, licensed under Apache-2.0. See the
README in that directory for the source commit and the list of changes.