Skip to main content
Find my setup
Language: English

Train a Flux LoRA on a rented GPU, step by step

A Flux LoRA teaches the Flux image model a new face, product or style from a few dozen pictures. The result is a small file you load next to the model in ComfyUI.

Ostris's AI Toolkit, a free trainer under the MIT licence, does this on one rented GPU. Its example settings for FLUX.1 [dev] are written for a card with 24 GB of memory.

The steps below follow AI Toolkit's README and example settings, read on 27 October 2026.

Dozens of instant photos of a wedding party laid out on a wooden table
A LoRA learns from a folder of example pictures, each with a short caption. Photo: Alexander Mass, Pexels.

Who this is for

  • you want Flux to draw a particular person, product or style
  • you have your own photos, or permission to use them
  • you want to train on a rented GPU rather than your own computer

Not for you if you only want to make images with existing models: see running ComfyUI in the cloud.

Key numbers

  • 24 GB the card size AI Toolkit's example Flux settings are written for Official page,
  • 2,000 steps the example's training length; its notes call 500 to 4,000 a good range Official page,
  • 250 steps how often the example saves the LoRA and draws sample images Official page,

What you need

  • Pictures in JPG or PNG, each with a caption in a text file of the same name. AI Toolkit's README says you do not need to crop or resize them.
  • Only photos you own, or that the people in them have agreed to. Never train on someone's face without their consent.
  • A Hugging Face account with a read token. FLUX.1 [dev] is gated: request access on its page first, as the README says.
  • A rented NVIDIA GPU with 24 GB or more, running Linux.

Check the model's licence before you use the results commercially. FLUX.1 [dev] comes under Black Forest Labs' non-commercial licence; FLUX.1 [schnell] and FLUX.2 [klein] 4B base use the Apache 2.0 licence.

AI Toolkit trains all three, by its README. For FLUX.1 [schnell] it has its own example settings, which need a training adapter the file names.

Step 1: prepare the pictures

Put the pictures and their captions in one folder. Each caption describes the picture and contains a trigger word, a made-up word the LoRA will learn:

text

my_dataset/
  photo01.jpg
  photo01.txt     # a photo of [trigger] smiling on a beach
  photo02.jpg
  photo02.txt     # a photo of [trigger] in a grey suit, studio light

If you set a trigger word in the settings, AI Toolkit puts it wherever a caption says [trigger], by its README. WebP files currently have issues, it adds, so convert them first.

Step 2: rent the GPU and install AI Toolkit

Connect to the server over SSH and follow the README's manual install for Linux. It pins the PyTorch version it tests:

bash

git clone https://github.com/ostris/ai-toolkit.git
cd ai-toolkit
python3 -m venv venv && source venv/bin/activate
pip3 install --no-cache-dir torch==2.13.0 torchvision==0.28.0 torchaudio==2.11.0 \
  --index-url https://download.pytorch.org/whl/cu130
pip3 install -r requirements.txt
huggingface-cli login      # paste your read token

Copy your dataset folder to the server, for example with scp, into the ai-toolkit folder.

Step 3: set up the training file and train

Copy AI Toolkit's example file for a 24 GB card and change the lines below; they sit in different parts of the file:

bash

cp config/examples/train_lora_flux_24gb.yaml config/my_lora.yml
nano config/my_lora.yml

yaml

name: "my_first_flux_lora"        # the output folder and file name
trigger_word: "p3r5on"             # uncomment and set your made-up word
folder_path: "/path/to/ai-toolkit/my_dataset"
steps: 2000                        # 500 to 4,000 is a good range, says the file
name_or_path: "black-forest-labs/FLUX.1-dev"

The example also keeps rank 16, a learning rate of 0.0001 and 8-bit loading of the model, which fits it on 24 GB. Then start the run:

bash

python run.py config/my_lora.yml

Every 250 steps it saves the LoRA and draws sample images, so you can watch it learn. You can stop with Ctrl+C and resume later; the README warns not to stop while it is saving.

Or use the web interface

AI Toolkit also has a web interface, which needs Node.js 20 or newer. The README advises a password on any server, set with AI_TOOLKIT_AUTH:

bash

cd ui
AI_TOOLKIT_AUTH=choose-a-long-password npm run build_and_start
# on your own computer:
ssh -L 8675:127.0.0.1:8675 user@your-server    # then open http://localhost:8675

It serves on port 8675. The SSH tunnel keeps that port off the internet while you use it.

Step 4: test the LoRA in ComfyUI

The finished LoRA is a .safetensors file in output/my_first_flux_lora/. Copy it into ComfyUI's models/loras folder, then add a LoRA loader to a Flux workflow.

Write prompts that use your trigger word, and compare the saved versions from different steps. The example keeps the four most recent saves, so you can keep the one you like best.

Our guide to running ComfyUI in the cloud shows how to install it on the same rented server.

Which card to rent

  • 24 GB, such as an RTX 4090 or an L4: what AI Toolkit's example Flux settings are written for.
  • 32 GB, such as an RTX 5090: more room for higher resolutions.
  • 48 GB, such as an L40S: room for larger batches, or to turn off 8-bit loading.
24 and 32 GB cards. Prices checked on 25 Oct 2026.
PlanPriceNew-customer offerLink
GPU Mart Enterprise Dedicated GPU Server - RTX 4090 24 GB GPU $409/month monthly rate of a 24-month term, paid in advance · VAT not stated checked 25 Oct 2026 A free 24-hour trial of a VPS, dedicated or GPU server for new clients, on request checked 29 Oct 2026 Visit
Unihost AZM-04, NVIDIA RTX 4090 24 GB GPU €359.90/month monthly, paid in advance; minimum one month checked 25 Oct 2026 No offer Visit
GPU Mart Enterprise Dedicated GPU Server - RTX 5090 32 GB GPU $479/month monthly rate of a 24-month term, paid in advance · VAT not stated checked 25 Oct 2026 A free 24-hour trial of a VPS, dedicated or GPU server for new clients, on request checked 29 Oct 2026 Visit
Liquid Web GPU server, NVIDIA L4 24GB 24 GB GPU $584.25/month monthly; 25% off the first month, then $779 · VAT not stated checked 25 Oct 2026 No offer Visit

Monthly plans suit regular training; hourly ones suit a single run.

48 GB cards (NVIDIA L40S). Prices checked on 25 Oct 2026.
PlanPriceNew-customer offerLink
DigitalOcean GPU Droplet, 1 x NVIDIA L40S 48 GB GPU $1.57/hour (about $1,146/month) on demand, billed per second · VAT not stated checked 25 Oct 2026 New accounts get a $5 credit that lasts 90 days and covers every product except SaaS add-ons checked 29 Oct 2026 Visit
UpCloud GPU Server, 1 x NVIDIA L40S, 8 cores, 64 GB 48 GB GPU €1.11/hour (about €746/month; no charge after 28 days of use)30-day month: the last 2 days are free.31-day month: the last 3 days are free.February: no free days (one in a leap year).Started mid-month: it may never reach the cap that month. on demand, billed by the starting hour; monthly cost capped at 28 days of use checked 25 Oct 2026 No offer Visit
Liquid Web GPU server, NVIDIA L40S 48GB 48 GB GPU $1,049.25/month monthly; 25% off the first month, then $1,399 · VAT not stated checked 25 Oct 2026 No offer Visit

Monthly costs for hourly prices assume the server runs all month (730 hours), or less where a provider caps the monthly bill.

Per-second and hourly billing: delete the server when the run ends.

A run costs its GPU hours times the hourly price. Watch the time between the first two saves, then multiply for the full run before you leave it going.

Our GPU memory guide for image and video models shows what each Flux model needs to make images.

How we checked

We read AI Toolkit's README and example settings, and the Flux model pages on Hugging Face, on 27 October 2026. The settings quoted are AI Toolkit's own.

Our own measurements will be added here, with their dates, when our test bench runs them.

Mistakes to avoid

  • Training on photos of people who have not agreed

    Instead: Use your own photos, or get written consent.

  • Forgetting to request access to FLUX.1 [dev]

    Instead: The download fails until Hugging Face grants it.

  • Pressing Ctrl+C while it saves

    Instead: That can corrupt the save; wait until it finishes.

  • Leaving the web interface open without a password

    Instead: Set AI_TOOLKIT_AUTH and use an SSH tunnel.

Other questions

How much GPU memory does Flux LoRA training need?

AI Toolkit's example settings for FLUX.1 [dev] are written for 24 GB, with the model loaded at 8-bit.

How many steps should a Flux LoRA train for?

AI Toolkit's example uses 2,000 and calls 500 to 4,000 a good range.

Can I sell images made with a FLUX.1 [dev] LoRA?

FLUX.1 [dev] comes under a non-commercial licence; read its terms. FLUX.1 [schnell] and FLUX.2 [klein] 4B base use Apache 2.0.

Sources and test notes

Every page read on 27 October 2026. All settings quoted are AI Toolkit's own example values.

Back to ComfyUI in the cloud