SuperAPI AI Directory

OneTrainer

OneTrainer is an all-in-one solution for diffusion model training, offering both a graphical interface and a command-line interface. It supports a variety of mainstream models, such as Ernie Image, Z-Image, Qwen Image, FLUX.1, Flux.2 Dev/Klein, Chroma, Stable Diffusion 1.5/2.0/2.1/3.0/3.5, SDXL, Würstchen-v2, Stable Cascade, PixArt-Alpha, PixArt-Sigma, Sana, Hunyuan Video, and inpainting models, and is compatible with both diffusers and ckpt model formats. Training methods cover full fine-tuning, LoRA, and embeddings. Feature-wise, it provides masked training, automatic backups, image augmentation, TensorBoard integration, multiple prompts per image, noise scheduler rescaling, EMA, aspect ratio bucketing, multi-resolution training, as well as dataset and model tools (such as auto-tagging, mask generation, format conversion) and a sampling UI during training. Installation requires Python version 3.10 to 3.14 and can be completed by cloning the repository and running the installation script.

Open website

About this tool

OneTrainer is an all-in-one tool for diffusion model training, with the project hosted on GitHub.

Purpose: aimed at users who need to train or fine-tune diffusion models, providing a complete workflow from data processing to training monitoring.

Main capabilities:

  • Supported models: Ernie Image, Z-Image, Qwen Image, FLUX.1, Flux.2 Dev and Klein, Chroma, Stable Diffusion 1.5, 2.0, 2.1, 3.0, 3.5, SDXL, Würstchen-v2, Stable Cascade, PixArt-Alpha, PixArt-Sigma, Sana, Hunyuan Video, and inpainting models.
  • Model formats: diffusers and ckpt.
  • Training methods: full fine-tuning, LoRA, embeddings.
  • Masked training: allows training to focus only on specific regions of a sample.
  • Automatic backups: periodically makes a complete backup of training progress during training, including all information needed to seamlessly continue training.
  • Image augmentation: applies random transformations to each image sample, such as rotation, brightness, contrast, or saturation, to quickly create a more diverse dataset.
  • TensorBoard: simple TensorBoard integration for tracking training progress.
  • Multiple prompts per image: trains on each image sample using multiple different prompts.
  • Noise scheduler rescaling: from the paper Common Diffusion Noise Schedules and Sample Steps are Flawed.
  • EMA: train your own EMA model, with the option to keep the EMA weights in CPU memory to reduce VRAM usage.
  • Aspect ratio bucketing: automatically trains on multiple aspect ratios simultaneously; just select the target resolution and buckets are created automatically.
  • Multi-resolution training: trains on multiple resolutions simultaneously.
  • Dataset tools: use BLIP, BLIP2, and WD-1.4 to automatically tag datasets, or use ClipSeg or Rembg to create masks for masked training.
  • Model tools: convert between different model formats through a simple UI.
  • Sampling UI: sample the model during training without switching to another application.

Usage: Installation requires Python >=3.10 and <3.14, available from https://www.python.org/downloads/windows/ . The installation steps include:

  1. Clone the repository: git clone https://github.com/Nerogar/OneTrainer.git
  2. Run the installation script: On Windows, double-click or execute install.bat; on Linux and Mac, execute install.sh
  3. Enter the cloned directory: cd OneTrainer
  4. Create a virtual environment: python -m venv venv
  5. Activate the virtual environment: On Windows, execute venv\scripts\activate; on Linux and Mac, activate accordingly based on the shell
  6. Install dependencies: pip install -r requirements.txt Some Linux distributions lack necessary packages. For example, Ubuntu requires installing libGL; Alpine, Arch, and Xubuntu may lack tkinter. On Alpine, use apk add py3-tk; on Arch, use sudo pacman -S tk. Update method: Run update.bat or update.sh, or cd to the repository directory and then git pull, activate venv, and then pip install -r requirements.txt --force-reinstall.

OneTrainer has two main usage modes: graphical user interface (GUI) and command-line interface (CLI). GUI: Enter the OneTrainer folder. On Windows, double-click start-ui.bat; on Linux, execute start-ui.sh. CLI: All functions are split into different scripts in the scripts directory, including:

  • train.py: Core training script
  • train_ui.py: Training UI
  • caption_ui.py: UI for manual or automatic captioning and for creating masks for mask training
  • convert_model_ui.py: Model conversion UI
  • convert_model.py: Model format conversion tool
  • sample.py: Tool for sampling from any model
  • create_train_files.py: Tool for creating the files required when training only from the CLI
  • generate_captions.py: Tool for automatically generating captions for a dataset
  • generate_masks.py: Tool for automatically generating masks for a dataset
  • calculate_loss.py: Tool for calculating the training loss for each image in a dataset To learn about each parameter, execute <script-name> -h, for example python scripts\train.py -h. Mac or Linux users can read the startup script documentation.

Applicable scenarios: Suitable for developers, researchers, and enthusiasts who need to train or fine-tune diffusion models, supporting the complete workflow from dataset preparation, captioning, and mask generation to training, sampling, and model conversion.

Limitations and precautions: Installation requires a specific Python version, and some Linux distributions require additional system packages to be installed. When encountering a reproducible error, you must first run update.bat or update.sh to confirm that the problem still exists, then export anonymous debug information (on Windows, double-click export_debug.bat; on Unix, execute ./run-cmd.sh generate_debug_report), generate debug_report.log, and submit it with the GitHub Issue. The official requirement is to provide this file, otherwise the issue may be closed. Before contributing code, it is recommended to read the project structure, install developer dependencies, and enable Git commit hooks, and the pre-commit installation command must be run in an environment where venv or Conda is not activated.