Dead simple web UI for training FLUX LoRA with LOW VRAM (12GB/16GB/20GB) support.
- Frontend: The WebUI forked from AI-Toolkit (Gradio UI created by https://x.com/multimodalart)
- Backend: The Training script powered by Kohya Scripts
- I wanted a super simple UI for training Flux LoRAs
- The AI-Toolkit project is great, and the gradio UI contribution by @multimodalart is perfect, but the project only works for 24GB VRAM.
- Kohya Scripts are very flexible and powerful for training FLUX, but you need to run in terminal.
- What if you could have the simplicity of AI-Toolkit WebUI and the flexibility of Kohya Scripts?
- Flux Gym was born. Supports 12GB, 16GB, 20GB VRAMs, and extensible since it uses Kohya Scripts underneath.
You can automatically install and launch everything locally with Pinokio 1-click launcher: https://pinokio.computer/item?uri=https://github.com/cocktailpeanut/fluxgym
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:
- https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors?download=true
- https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp16.safetensors?download=true
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
...
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
The usage is pretty straightforward:
- Enter the lora info
- Upload images and caption them (using the trigger word)
- Click "start".
That's all!