Skip to content

How-ToGPU

How to Train a Flux LoRA on a 12GB or 16GB GPU With FluxGym

How to install FluxGym, pick the 12GB, 16GB or 20GB VRAM preset, caption your photos with a trigger word and train your own FLUX.1 LoRA on an NVIDIA graphics card at home.

By , Systems & Technical Editor

6 min read

How to Train a Flux LoRA on a 12GB or 16GB GPU With FluxGym

Everything below comes from FluxGym's GitHub README, its model list and the app's own source code, plus the README of Kohya's sd-scripts, which does the actual training. We read them all on 3 December 2026.

A LoRA is a small add-on file that teaches an image model a new face, object or style from a handful of your own pictures. Training one for FLUX.1 usually calls for a big graphics card. FluxGym is a free, MIT-licensed web app by cocktailpeanut that was built to bring Flux LoRA training to cards with 12GB, 16GB or 20GB of video memory (VRAM). Its interface is a fork of the Gradio UI made for Ostris AI Toolkit, but the training itself runs on Kohya's sd-scripts. FluxGym says it supports all of sd-scripts' options through a hidden Advanced tab.

What you need

  • An NVIDIA graphics card with at least 12GB of VRAM. FluxGym's lowest memory preset is 12GB. Cards such as the ASUS RTX 3060 12GB Dual Gaming OC V2 or the ASUS RTX 5060 Ti 16GB Dual OC fall into its 12GB and 16GB presets. The manual install uses NVIDIA's CUDA builds of PyTorch. Our guide to how much VRAM you need explains where each card fits.

  • Windows or Linux, plus Git and Python if you install by hand. FluxGym also ships a Docker setup.

  • A set of clear photos of your subject. FluxGym accepts up to 150 images per dataset. Every image needs a caption, so a smaller, varied set is quicker to prepare.

  • Free disk space for the FLUX.1 model files, which FluxGym downloads automatically the first time you train.

One licence point is worth knowing. FluxGym's model list labels FLUX.1-dev, and the flux-dev2pro model based on it, with Black Forest Labs' FLUX.1 [dev] Non-Commercial License. FLUX.1-schnell is Apache 2.0. Check the licence before you use a LoRA commercially.

Step 1: Install FluxGym

There are two routes.

One-click with Pinokio. The README's first option is the Pinokio launcher, which installs and starts everything for you. If you haven't used it, see our guide to using Pinokio for local AI.

By hand. Open a terminal and clone FluxGym, then clone the sd3 branch of Kohya's sd-scripts inside it:

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

Create and activate a virtual environment in the fluxgym folder (python -m venv env, then env\Scripts\activate on Windows or source env/bin/activate on Linux). Install sd-scripts' requirements from inside the sd-scripts folder with pip install -r requirements.txt, go back up a level and run the same command again for FluxGym's own requirements.

Finally, install PyTorch. The README gives a CUDA 12.1 nightly command for most cards. RTX 50-series owners need a different one: install the CUDA 12.8 (cu128) nightly build and update bitsandbytes with pip install -U bitsandbytes. If PyTorch can't see your card afterwards, our guide to fixing "CUDA not available" in PyTorch covers the usual causes.

Step 2: Start the web UI

With the virtual environment active, run python app.py from the fluxgym folder, then open the local address the terminal prints in your browser. The Docker version is at http://localhost:7860.

Step 3: Name the LoRA and pick a VRAM preset

First, set up the job:

  • The name of your LoRA, which also names its output folder.

  • Trigger word/sentence, a made-up word you'll type later to call up your subject. FluxGym's own example is "hrld person". Pick something that isn't an ordinary word.

  • Base model. The list includes flux-dev, flux-schnell and the community flux-dev2pro. The developer says schnell didn't give high-quality results, so stick with flux-dev or flux-dev2pro. You can add other models by editing models.yaml.

  • VRAM: 20G (the default), 16G or 12G.

Pick the VRAM option that matches your card, as each one changes how sd-scripts trains. FluxGym's source code shows that:

Preset

What FluxGym changes

20G

AdamW 8-bit optimiser

16G

Adafactor optimiser with a constant-with-warmup learning-rate schedule

12G

Adafactor as above, plus split mode and training only the model's single blocks

The 12G preset saves the most memory by training less of the model. That's a sensible trade on a 12GB card, but if you have 16GB, use the 16G preset.

Step 4: Set repeats, epochs and resolution

  • Repeat trains per image defaults to 10.

  • Max Train Epochs defaults to 16.

  • Expected training steps fills itself in: epochs × number of images × repeats. Twenty images at the defaults works out at 3,200 steps.

  • Resize dataset images defaults to 512. Higher values capture more detail but use more memory and take longer.

Step 5: Upload and caption your images

Drag your photos into the upload box. Each image gets a caption box that starts out holding your trigger word. You then have three options:

  1. Write captions yourself, keeping the trigger word in each one.

  2. Click Add AI captions with Florence-2. FluxGym downloads a copy of Microsoft's Florence-2 model and uses it to describe each picture for you. Our JoyCaption vs Florence-2 comparison explains what it's good at.

  3. Upload ready-made .txt caption files with the same names as your images (img0.png and img0.txt). This works well with tools such as TagGUI.

Read the captions before training. Describe what changes from photo to photo (clothes, background, lighting) and leave out what should stay the same, so the trigger word picks up your subject.

Step 6: Check the advanced settings and sample images

Open the advanced settings to see the defaults FluxGym uses:

  • --learning_rate 8e-4

  • --network_dim (the LoRA's rank, which affects file size and capacity) 4, adjustable from 4 to 128 in steps of 4

  • --save_every_n_epochs 4, so you get a checkpoint every four epochs to compare

  • --seed 42, --timestep_sampling shift and --guidance_scale 1.0

Underneath are all the other sd-scripts launch flags, read automatically from your copy of sd-scripts.

By default FluxGym doesn't create sample images. To watch the LoRA improve, enter a few Sample Image Prompts (one per line, each with your trigger word) and set Sample Image Every N Steps, for example every 200 steps. Add --d 42 to the end of each prompt to fix the seed, so every sample uses the same starting point and you can compare them fairly. The README also lists --w and --h for size, --s for steps, --l for CFG scale and --n for a negative prompt.

Step 7: Train and use the LoRA

Click Start training and follow progress in the Train log, with samples appearing in the gallery. Results go into outputs/<your LoRA name>/. Each saved epoch is a separate LoRA file, so try a few rather than assuming the last one is best: later epochs can overfit and copy your photos too closely.

Copy the .safetensors file into your image app's LoRA folder and load it with your trigger word. Our guide to using LoRAs in ComfyUI shows how. FluxGym can also publish a LoRA to Hugging Face. Your access token is saved in a local file called HF_TOKEN, so don't share the FluxGym folder.

If you run out of memory

Lower the VRAM preset, drop the resize resolution back to 512 and close other GPU-hungry apps. Our guides to checking VRAM usage in Windows and fixing CUDA out-of-memory errors go further.

Is FluxGym still worth using?

Yes, if FLUX.1 is your target. The repository was last updated on 28 July 2026, with installer fixes such as triton-windows for NVIDIA cards on Windows, but its built-in model list still covers only FLUX.1. For FLUX.2, Qwen-Image, Z-Image or video models, look at Ostris AI Toolkit instead (see our AI Toolkit LoRA guide and our FluxGym vs AI Toolkit comparison). Our roundup of the best LoRA training software covers the other options.

The bottom line

FluxGym is the simplest free way to train a FLUX.1 LoRA on a 12GB or 16GB NVIDIA card: install it with Pinokio or by hand, choose the VRAM preset that matches your GPU, upload up to 150 images, caption them with your trigger word (Florence-2 can help) and click Start training. RTX 50-series cards need the CUDA 12.8 PyTorch build. For newer models, use AI Toolkit instead. Forge PC hasn't tested it.

In this article

Sources

  1. 01cocktailpeanut, FluxGym GitHub README
  2. 02cocktailpeanut, FluxGym models.yaml
  3. 03cocktailpeanut, FluxGym app.py source
  4. 04cocktailpeanut, FluxGym commit history
  5. 05Kohya, sd-scripts GitHub README

About the author

Marcus Thorne

Systems & Technical Editor

Marcus writes Forge PC's step-by-step build, troubleshooting and system optimisation guides. His background spans Windows kernel and power-state diagnostics, UEFI/BIOS configuration, NVMe storage arrays, ATX 3.1 power delivery and running local AI and LLM workloads on consumer graphics cards.

More from Marcus Thorne

Read next

How to Fix Games Stuck at 60 FPS on a High Refresh Rate Monitor

How-To

How to Fix Games Stuck at 60 FPS on a High Refresh Rate Monitor

Games locked at exactly 60 FPS on a high refresh rate monitor are usually capped, not slow. Here's how to check the refresh rate Windows uses, sort out V-Sync and forgotten frame caps, turn off Dynamic Refresh Rate, change power mode and make sure the game runs on the right GPU.

Marcus Thorne5 min

How to Fix DirectX 12 Not Supported Errors in PC Games

How-To

How to Fix DirectX 12 Not Supported Errors in PC Games

A game says DirectX 12 isn't supported, but Windows 11 already has the latest DirectX. Here's how to check what dxdiag reports, install the right graphics driver, make the game use your graphics card instead of integrated graphics, and tell whether your card simply lacks the feature level the game needs.

Marcus Thorne5 min

Best Free HTPC Software for Windows (2026)

Best Picks

Best Free HTPC Software for Windows (2026)

The best free home-theatre PC software for Windows, ranked: Kodi, Jellyfin, VLC and the JellyCon add-on. We explain which suits one TV, which streams to every room, and how they work together.

Hannah Vance4 min

Kodi vs Jellyfin: Which Should Run Your Home Media?

Versus

Kodi vs Jellyfin: Which Should Run Your Home Media?

Kodi is a media player for the PC by your TV; Jellyfin is a media server that streams to apps on every screen. We compare how they work, GPU decoding and transcoding, device support and how to use both together.

Callum Reid5 min