Skip to content

About

Tooling for dataset captioning, model merging and quantizing.

Topics

Resources

Stars

8 stars

Watchers

1 watching

Forks

Repository files navigation

fwaun-tools

Tooling for training the fwaun model family. Two command groups under one binary:

  • dataset — a tag and caption editor for local Stable Diffusion LoRA datasets. Combines manual edits, an automatic WD14-family tagger, Qwen3-VL captioning, and Danbooru API fetches under one editing surface so the user doesn't have to think about provenance while curating.
  • model — diffusion-checkpoint utilities over safetensors files: task-vector merge-diff, LoRA extraction (extract-lora), and INT8+ConvRot quantization (quant-int8) and back to bf16 (dequant), and a header inspector (info). Pure-Rust/CPU, available in every build.

Built primarily for ANIMA preview and Krea 2 LoRA training, but the data model and export profiles are not ANIMA-specific.

The dataset commands are designed around the input formats consumed by kohya-ss/musubi-tuner and kohya-ss/sd-scripts, and the model commands around ComfyUI. Use with other trainers or inference stacks is not tested.

日本語版 README

Features

  • One chip list, three sources. Manual tags, auto-tagger output, and Danbooru tags live in the same list — color-coded, but the user curates without thinking about provenance.
  • Negative-tag suppression that survives model swaps. Mark -foo once; re-running the tagger preserves the suppression even with a different model.
  • Dataset-wide tags in one line. common_tags in fwaun-tools.toml applies the trigger word and its -hair_colour suppressions to every image without touching a single sidecar — including images added later. Any image can opt out individually.
  • Curation-only organizational tags. A positive manual tag starting with an underscore (_foo) is kept in the data and counted for tag-group sorting but never exported — so you can mark "reviewed, none of these" distinctly from "not yet reviewed".
  • Tag groups + Kanban view. Declare mutually-exclusive tag sets (e.g. costume variants) in fwaun-tools.toml; the GUI shows one column per tag with drag-and-drop to switch.
  • Full-size preview. Double-click a thumbnail to check the image at screen resolution, ← / → to step through the filtered list, Esc to close — or hand it to your usual viewer with the right-click menu's Open in default app / Show in folder.
  • Per-folder configuration via fwaun-tools.toml. Pick the tagger model, captioner, export profile and threshold per dataset.
  • Four output modes. export writes one text file per image (sd-scripts DreamBooth/LoRA caption-file mode — tags by default, --content caption for natural-language models like Qwen Image/Flux that weren't trained on danbooru tags, or --content tags+caption / caption+tags to put both blocks in one file for hybrid models like MOSS Image; --ext picks the output extension, e.g. --ext tags.txt, so several kinds can coexist in one folder without overwriting each other); metadata writes a single meta.json (sd-scripts fine-tune mode).
  • Fast re-opening. The GUI's Reload button re-scans the open folder and only regenerates thumbnails for images that actually changed, so picking up a CLI run or a handful of new files is instant instead of a full rebuild. Across sessions, an on-disk thumbnail cache (bounded and clearable from the config modal's App tab) does the same job.
  • Bilingual GUI. English / 日本語 toggle, defaults to host locale.
  • CLI for batch operations, GUI for curation. The GUI also has a Model tools tab (Dataset / Model tools mode switch) that front-ends the merge-diff / extract-lora / quant-int8 / dequant / info checkpoint utilities for people who'd rather not use the CLI.

Install

macOS (Apple Silicon) / Linux (x64 or arm64)

curl -fsSL https://raw.githubusercontent.com/fwaunstp/fwaun-tools/main/install.sh | sh

Windows (x64)

irm https://raw.githubusercontent.com/fwaunstp/fwaun-tools/main/install.ps1 | iex

Both installers download the latest GitHub release, verify SHA256, and drop both binaries side-by-side:

Platform CLI GUI
macOS ~/.local/bin/fwaun-tools ~/.local/bin/fwaun-tools-gui
Linux ~/.local/bin/fwaun-tools ~/.local/bin/fwaun-tools-gui
Windows %USERPROFILE%\bin\fwaun-tools.exe %USERPROFILE%\bin\fwaun-tools-gui.exe

Pin a specific version with --version v0.2.1 (or -Version v0.2.1 on PowerShell).

By default both binaries are installed, except on a headless Linux host (no $DISPLAY / $WAYLAND_DISPLAY), where only the CLI is installed — the GUI needs a display to run. Override the selection with --both / --cli-only / --gui-only:

# CLI only (e.g. a training box you only SSH into)
curl -fsSL https://raw.githubusercontent.com/fwaunstp/fwaun-tools/main/install.sh | sh -s -- --cli-only
# force both even on a headless host (you'll use a remote / forwarded display)
curl -fsSL https://raw.githubusercontent.com/fwaunstp/fwaun-tools/main/install.sh | sh -s -- --both

The GUI is a single self-contained binary (built with egui) — no .app, no AppImage, no MSI. On Linux it depends on the standard X11 / Wayland system libraries that ship with every desktop distribution, but no extra runtime install is required.

On macOS the binary is not notarized. The installer clears the com.apple.quarantine attribute, but if Gatekeeper still blocks it when launched from Finder, run it from Terminal once (~/.local/bin/fwaun-tools-gui).

Linux glibc requirement (full build only)

The Linux release binaries are full builds (see Build variants), so they link against the glibc shipped on Ubuntu 24.04 (glibc 2.39). They will not run on Ubuntu 22.04, Debian 12, or earlier — the prebuilt ONNX Runtime that the local tagger / captioner depend on references __isoc23_* symbols introduced in glibc 2.38. Upgrade, or install the light CLI from source — it links no ONNX Runtime and has no glibc floor, so it runs on those older distros:

cargo install --git https://github.com/fwaunstp/fwaun-tools fwaun-tools-cli

cargo install builds the default light variant (needs a Rust toolchain; no prebuilt light binaries are published — see Build variants). The install.sh script prints this same hint if it detects an older glibc.

Windows support caveat

The maintainer develops on macOS and Linux. Windows builds are produced by CI but not regularly exercised — please file an issue if anything breaks.

Build from source

Requires Rust 1.88+ (edition 2024). On Linux, install standard X11 / Wayland dev headers (libx11-dev, libxcb1-dev, libxkbcommon-dev, libwayland-dev, libgl1-mesa-dev, or your distro's equivalents) for the GUI:

git clone https://github.com/fwaunstp/fwaun-tools
cd fwaun-tools
# light build (default) — no local ONNX inference, runs anywhere
cargo build --release -p fwaun-tools-cli
cargo build --release -p fwaun-tools-gui
# full build — adds the local WD14 tagger + Qwen3-VL captioner (glibc 2.38+)
cargo build --release -p fwaun-tools-cli --features full
cargo build --release -p fwaun-tools-gui --features full

Build variants

Two build flavors, selected with the full cargo feature:

light (default) full (--features full)
Local WD14 tagger (tag) ✗ ✓
Local Qwen3-VL captioner ✗ ✓
OpenAI-compatible captioner (caption) ✓ ✓
booru / export / metadata / tag / manual editing / tag groups ✓ ✓
ONNX Runtime linked no yes
Linux glibc floor none (runs on old distros) 2.38+
Approx. CLI size ~11 MB ~35 MB

The published release binaries are full. A light binary drops the two local ONNX models (WD14 tagging, Qwen3-VL captioning) but keeps everything else — including captioning via any OpenAI-compatible endpoint (llama.cpp, Ollama, LM Studio, vLLM, …). Running a local-ONNX-only command in a light build fails fast with a message telling you to install the full build. Use light when you caption over an API and/or need to run on an older-glibc host.

Quick start

  1. Launch fwaun-tools-gui (or run the CLI directly — see below).

  2. Open folder… → pick a directory of images.

  3. (Optional) Config… → write fwaun-tools.toml for the dataset. Sensible defaults apply if you skip this.

  4. Select images, then click Run tagger / Run captioner / Fetch booru. The first run downloads the relevant ONNX models into the HuggingFace cache (~/.cache/huggingface/hub). Set HF_HOME to relocate the cache, or HF_ENDPOINT (e.g.