Dead simple web UI for training FLUX LoRA with LOW VRAM (12GB/16GB/20GB) support.
FluxGym supports 100% of Kohya sd-scripts features through an Advanced tab, which is hidden by default.
The models are automatically downloaded when you start training with the model selected.
You can easily add more to the supported models list by editing the models.yaml file. If you want to share some interesting base models, please send a PR.
Here are people using Fluxgym to locally train Lora sharing their experience:
https://pinokio.computer/item?uri=https://github.com/cocktailpeanut/fluxgym
To learn more, check out this X thread: https://x.com/cocktailpeanut/status/1832084951115972653
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/cu121
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
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
Check your user id
and group id
and change it if it's not 1000 via environment variables
of PUID
and PGID
.
You can find out what these are in linux by running the following command: id
Now build the image and run it via docker-compose
:
docker compose up -d --build
Open web browser and goto the IP address of the computer/VM: http://localhost:7860
The usage is pretty straightforward:
That's all!
By default fluxgym doesn't generate any sample images during training.
You can however configure Fluxgym to automatically generate sample images for every N steps. Here's what it looks like:
To turn this on, just set the two fields:
Thanks to the built-in syntax from kohya/sd-scripts, you can control exactly how the sample images are generated during the training phase:
Let's say the trigger word is hrld person. Normally you would try sample prompts like:
hrld person is riding a bike
hrld person is a body builder
hrld person is a rock star
But for every prompt you can include advanced flags to fully control the image generation process. For example, the --d
flag lets you specify the SEED.
Specifying a seed means every sample image will use that exact seed, which means you can literally see the LoRA evolve. Here's an example usage:
hrld person is riding a bike --d 42
hrld person is a body builder --d 42
hrld person is a rock star --d 42
Here's what it looks like in the UI:
And here are the results:
In addition to the --d
flag, here are other flags you can use:
--n
: Negative prompt up to the next option.--w
: Specifies the width of the generated image.--h
: Specifies the height of the generated image.--d
: Specifies the seed of the generated image.--l
: Specifies the CFG scale of the generated image.--s
: Specifies the number of steps in the generation.The prompt weighting such as ( )
and [ ]
also work. (Learn more about Attention/Emphasis)
HF_TOKEN
(All local and private).The advanced tab is automatically constructed by parsing the launch flags available to the latest version of kohya sd-scripts. This means Fluxgym is a full fledged UI for using the Kohya script.
By default the advanced tab is hidden. You can click the "advanced" accordion to expand it.
You can also upload the caption files along with the image files. You just need to follow the convention:
.txt
file.img0.png
, the corresponding caption file must be img0.txt
.