Skip to content

Dead simple FLUX LoRA training UI with LOW VRAM support

Notifications You must be signed in to change notification settings

cocktailpeanut/fluxgym

Repository files navigation

Flux Gym

Dead simple web UI for training FLUX LoRA with LOW VRAM (12GB/16GB/20GB) support.

screenshot.png

What is this?

  1. I wanted a super simple UI for training Flux LoRAs
  2. The AI-Toolkit project is great, and the gradio UI contribution by @multimodalart is perfect, but the project only works for 24GB VRAM.
  3. Kohya Scripts are very flexible and powerful for training FLUX, but you need to run in terminal.
  4. What if you could have the simplicity of AI-Toolkit WebUI and the flexibility of Kohya Scripts?
  5. Flux Gym was born. Supports 12GB, 16GB, 20GB VRAMs, and extensible since it uses Kohya Scripts underneath.

Install

1. One-Click Install

You can automatically install and launch everything locally with Pinokio 1-click launcher: https://pinokio.computer/item?uri=https://github.com/cocktailpeanut/fluxgym

2. Install Manually

First clone Fluxgym and kohya-ss/sd-scripts:

git clone https://github.com/cocktailpeanut/fluxgym
cd fluxgym
git clone -b sd3 https://github.com/kohya-ss/sd-scripts

Your folder structure will look like this:

/fluxgym
  app.py
  requirements.txt
  /sd-scripts

Now activate a venv from the root fluxgym folder:

If you're on Windows:

python -m venv env
env\Scripts\activate

If your're on Linux:

python -m venv env
source env/bin/activate

This will create an env folder right below the fluxgym folder:

/fluxgym
  app.py
  requirements.txt
  /sd-scripts
  /env

Now go to the sd-scripts folder and install dependencies to the activated environment:

cd sd-scripts
pip install -r requirements.txt

Now come back to the root folder and install the app dependencies:

cd ..
pip install -r requirements.txt

Finally, install pytorch Nightly:

pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu121

Now let's download the model checkpoints.

First, download the following models under the models/clip foder:

Second, download the following model under the models/vae folder:

Finally, donwload the following model under the models/unet folder:

The result file structure will be something like:

/models
  /clip
    clip_l.safetensors
    t5xxl_fp16.safetensors
  /unet
    flux1-dev.sft
  /vae
    ae.sft
/sd-scripts
/outputs
/env
app.py
requirements.txt
...

Start

Go back to the root fluxgym folder, with the venv activated, run:

python app.py

Make sure to have the venv activated before running python app.py.

Windows: env/Scripts/activate Linux: source env/bin/activate

Usage

The usage is pretty straightforward:

  1. Enter the lora info
  2. Upload images and caption them (using the trigger word)
  3. Click "start".

That's all!

flow.gif

About

Dead simple FLUX LoRA training UI with LOW VRAM support

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published