12 November 2026 · VRAMfarm team
Train a Flux LoRA on your own photos: 20 images, 24 GB and about two hours
Twenty good photos, about 2,000 training steps and a 24 GB card: that is all a likeness LoRA for Flux.1 dev needs. On a rented RTX 4090 the training itself takes 1 to 2.5 hours, and a first run with setup and test images comes to about €1.24 of GPU time. Most failed LoRAs fail before the GPU starts, on the photos and the captions, so those two steps deserve as much care as the commands.
The dataset: how many photos and which ones
For a person, 15–30 photos is the useful range. Fewer than 10 and the model can’t separate your face from the lighting of those particular shots. More than 40 rarely helps and makes it harder to keep the quality even. Twenty sharp, varied photos beat a hundred similar ones.
What a good set looks like:
- Variety where you want flexibility. Different angles (front, three-quarter, profile), lighting (daylight, indoor, evening), backgrounds, clothes and expressions. Whatever stays constant across the set ends up baked into the LoRA. If you wear the same black jumper in 15 photos, you will get that jumper back in every image.
- Mostly head and shoulders, a few half-body and full-body shots. About two thirds close-ups gives the face enough pixels; the rest teaches proportions.
- Only you in the frame. Crop other people out, or leave the photo out. A second face confuses the training more than anything else.
- No heavy filters, beauty modes or AI upscales. The LoRA learns the filter as part of your face.
- At least 1024 pixels on the short side after cropping. Phone photos are fine. Small images get upscaled by the trainer and look soft.
You don’t need to crop everything square: ai-toolkit and kohya sort images into aspect-ratio buckets. Put the images into one folder named something neutral, such as dataset, with file names like 01.jpg, 02.jpg. Your name does not belong in file names that sit on a rented machine.
For a style LoRA (an illustration style, a product look), the same numbers roughly apply: 20–50 images that share the style and differ in subject.
Captions and the trigger word
Each image gets a text file with the same name (01.txt next to 01.jpg). The caption tells the model which part of the image is the new concept and which part is ordinary.
Pick a trigger word that means nothing yet, such as annx or mrkv. A real word like “anna” already has a meaning in the model and fights your training. Then write short captions that mention the trigger and describe what changes from photo to photo:
photo of annx, a woman with curly hair, smiling, sitting at a cafe table, daylight
photo of annx, close-up portrait, serious expression, dark background
Two rules decide most of the result. Describe the things you want to stay changeable (clothes, background, light), because described things are treated as separate from the concept. Don’t describe the face itself in detail, because that is what the trigger word should absorb.
Flux is forgiving here. Captions of just photo of annx work surprisingly well for a single face, and many people train that way. Detailed captions help when the set is uneven or when you want to change clothes and settings freely later. Automatic captioners (FluxGym uses Florence-2; JoyCaption is popular) save typing, but read the output and remove anything wrong, especially descriptions of the face.
ai-toolkit, FluxGym or kohya: which trainer
All three are free and run on an empty server with PyTorch and Jupyter.
| Trainer | How you use it | Good for | VRAM presets |
|---|---|---|---|
| ai-toolkit (Ostris) | A YAML config and one command; optional web UI | Best defaults for Flux, sample images during training, also FLUX.2, Qwen-Image, Wan | 24 GB config; low_vram option for less |
| FluxGym | A simple web page: upload, caption, train | First LoRA, no config files | 12, 16 and 20 GB presets |
| kohya sd-scripts | Command line with many options | Fine control, the scripts FluxGym runs underneath | Anything, with fp8 and block swapping |
If you are comfortable with a terminal, take ai-toolkit: its example config train_lora_flux_24gb.yaml is a sensible starting point and produces sample images every few hundred steps, which is how you pick the best checkpoint. FluxGym is easier for a first try, especially on a 16 GB card.
Both train on Flux.1 dev. It is a gated model on Hugging Face: for ai-toolkit, accept its licence on the model page and create a read token; FluxGym fetches its model files on first start, as described in its README. Flux.1 dev has a non-commercial licence for the weights; check its current terms before you use images for paid work. If that matters, ai-toolkit can train on Flux.1 schnell (Apache 2.0) with a training adapter.
VRAM, time and cost per card
Flux.1 dev has 12 billion parameters, about 24 GB in bf16. Trainers load it in 8-bit, which halves that and leaves room for the LoRA, the optimiser and the images at 1024 px. That is why 24 GB is the comfortable size. On 16 GB the trainer also moves blocks of the model to system RAM and back during each step, which works but runs noticeably slower.
Typical run: 20 photos, 2,000 steps, rank 16, resolution buckets up to 1024 px.
| Card | VRAM | Training time (range) | Cost of the training at the middle of the range |
|---|---|---|---|
| RTX 4080, RTX 5080 (16 GB tricks) | 16 GB | 3–6 h | €1.40 on an RTX 4080 |
| RTX 3090 | 24 GB | 2.5–4 h | €0.90 |
| RTX 4090 | 24 GB | 1–2.5 h | €0.89 |
| RTX 5090 | 32 GB | 0.8–1.6 h | €0.84 |
| H100 | 80 GB | 0.5–1 h | €2.93 |
Treat the times as planning ranges, not benchmarks: resolution, rank, the number of sample images and the trainer version move them. Training only at 512 px roughly halves the time, with less fine detail. An H100 is the fastest but rarely the cheapest; a LoRA is too small a job to use it fully. The RTX 4090 and RTX 3090 are the usual choices, and the cheaper 3090 often wins on price per LoRA when you are not watching the clock. The pricing page has the current rates.
About steps: around 100 steps per photo is a reasonable start, so 1,500–2,500 for a set of 15–25. Learning rate 1e-4 and rank 16 (ai-toolkit’s defaults) suit faces. Save a checkpoint every 250 steps and judge by the samples. The best one is often not the last.
Running the training on a rented server
Launch an empty PyTorch + Jupyter server on a 24 GB card. The machine’s driver and CUDA version are shown before launch; current trainers want CUDA 12.x or newer, so check it there. Open Jupyter → File → New → Terminal, or connect over SSH (SSH key guide).
Upload your dataset folder through Jupyter’s upload button (zip it first, then unzip dataset.zip). Then install ai-toolkit, following its README for the exact versions:
cd /workspace
git clone https://github.com/ostris/ai-toolkit
cd ai-toolkit
pip install -r requirements.txt
echo "HF_TOKEN=<your read token>" > .env
cp config/examples/train_lora_flux_24gb.yaml config/annx.yaml
In config/annx.yaml, set name, trigger_word: "annx", folder_path: "/workspace/dataset", steps: 2000 and the sample prompts (use your trigger word in them). Then start it inside tmux, so it keeps running when you close the browser:
tmux new -s lora
python run.py config/annx.yaml
# detach with Ctrl+B, then D; come back with: tmux attach -t lora
The first start downloads Flux.1 dev and its text encoders, about 30–35 GB. Those minutes are billed, and the gigabytes count as traffic at the machine’s rate shown before launch. Checkpoints and sample images appear in /workspace/ai-toolkit/output/<name>/. Open the samples in Jupyter as they arrive; if they already look right at step 1,250, you can stop early.
FluxGym runs a web page on its own port. On an empty PyTorch server only SSH and Jupyter are reachable from outside, so open FluxGym through an SSH tunnel (ssh -L 7860:localhost:7860 ... with the host and port from My servers) and visit http://localhost:7860 on your computer.
A training run keeps the GPU busy, so idle protection leaves it alone. Once it finishes, the GPU goes quiet. If you are asleep and nothing is connected, you get an idle warning after about two hours, and an hour later the server saves /workspace and stops (a PyTorch server’s folder can be saved; where saving isn’t possible, you only get the warnings). Those idle hours are paid. To stop right at the end, add a call to the API after python run.py, or simply set an alarm.
Your photos on a rented machine
This is the question people ask quietly, so here is a plain answer.
Our GPUs come from vetted hosts, not from data centres we own. Before launch you see the machine’s country. Your server runs in its own container, separate from other customers, and its disk is deleted when the server stops. The host operates the physical computer, and anyone with physical control of a machine can in principle read what is on it. That is true of every rented server, from a marketplace to a big cloud, and it is the risk you are weighing.
For a set of portraits, these habits reduce it to very little:
- Strip metadata before uploading. Phone photos carry GPS coordinates and the device name.
exiftool -all= *.jpgon your computer removes them. - Upload only the training set, not your photo library, and use neutral file names.
- Delete the dataset when training is done (
rm -rf /workspace/dataset /workspace/dataset.zip), especially before Save and stop, so the photos aren’t kept in the saved folder. - Treat the LoRA like a photo of yourself. It reproduces your face on demand. Don’t post it publicly unless you mean to.
- Pick the machine’s country if it matters to you; it is shown before launch.
Photos of other people need their consent. Under GDPR a recognisable face is personal data, and a model that generates new images of someone goes further than sharing one picture. More on who can see what is in is my data safe on a rented GPU.
Keep the LoRA and use it in ComfyUI
A Flux LoRA at rank 16 is roughly 100–170 MB, at rank 32 about twice that. Download the checkpoint you liked from Jupyter (right-click → Download) so you have a copy at home. Then, in /workspace/ai-toolkit/output/<name>/, delete the checkpoints you don’t want and use Save and stop. The saved folder keeps /workspace for the next server, even on a different card, at €0.03 per GB per month; a few LoRAs together are well under a gigabyte. Flux.1 dev itself lives in the Hugging Face cache outside /workspace, so it is not stored and doesn’t add 30 GB to your bill. Details are in what happens to your files when you stop a GPU.
To generate with it, start ComfyUI, put the file into /workspace/ComfyUI/models/loras, add a LoraLoader node between the model and the sampler, and use the trigger word in your prompt. The ready-made Flux app runs Flux.1 schnell, where a dev LoRA works but looks less like you; download Flux.1 dev into ComfyUI for the full likeness. The ComfyUI guide shows where each file goes and how to fetch Flux dev with your token.
Start with a strength of 0.8–1.0. If every image looks like your photos rather than like you in a new scene, lower the strength or go back to an earlier checkpoint. If the likeness is weak, raise it, or train 500 more steps.