Skip to main content

LoraCraft

A LoRA training workbench: manage datasets, captions, training runs and results in one place. SDXL first.

What it does

  • 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.

Layout

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/

Install

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 loracraft

The 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.

Run

loracraft                            # http://127.0.0.1:8600
python -m loracraft --port 8700      # the same, on another port

To 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 --window

The 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.

Development

Requires uv and Node.js.

uv sync                              # Python environment, including PyTorch
cd web && npm install && npm run build
uv run loracraft

uv 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 build

Training worker

A 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.

Tag dictionary

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.

Tests

uv run pytest

Third-party code

src/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.

Metadata

Release files for loracraft 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for loracraft 0.1.0
File Size Uploaded Provenance Actions
loracraft-0.1.0.tar.gz 566.8 kB Without provenance Details for loracraft-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for loracraft 0.1.0
File Interpreter ABI Platform Actions
loracraft-0.1.0-py3-none-any.whl Python 3 none any Details for loracraft-0.1.0-py3-none-any.whl

Total release size: 1.1 MB

Release files / loracraft-0.1.0.tar.gz

Download URL loracraft-0.1.0.tar.gz
Size 566.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9ac720fea3e22a3d0028b76f02ac33881b6d3352fcabf206ff4241d5346dafa9
BLAKE2b-256 checksum
How to use checksums
64ecae7b683a149d23daab0342539fb2252dce6d33420c72fd18a9fbda8c94ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / loracraft-0.1.0-py3-none-any.whl

Download URL loracraft-0.1.0-py3-none-any.whl
Size 508.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
331523ea80e775f4a241c0fc94376661d8595c5890d63a6861d6dcffe99ac8f6
BLAKE2b-256 checksum
How to use checksums
3fd35c4c7433181a98a401b57063811ae48d5944eaea8a18b3005bfcf1096262
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for loracraft 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page