How to train a Flux LoRA (Flux.1 and Flux 2): the step-by-step beginner guide
Flux LoRA training is how you teach the Flux image model something it does not know: your face, your product, your drawing style, a camera look. The result is one .safetensors file of 20 to 300 MB that you can use in any Flux app, including Graydient. The process takes 15 to 30 pictures, a card with 12 to 16 GB of memory (or a rented one for an hour), and a free trainer. This guide walks through every step for Flux.1 dev and for Flux 2, and ends with how to run your new LoRA here.
You will do seven things: pick the Flux base, build a small dataset, write captions, choose a trainer, set a handful of numbers, train and test, then import the file into Graydient. Each step is written out below with the values that work for most people. If you already have a trained file, jump to the section on using it.
Graydient runs LoRAs; it does not train them. Training happens on your own graphics card, on a GPU you rent by the hour, or in an online trainer. Once the file exists, every Graydient plan can render with it for one flat price.
What you need
- 15 to 30 good pictures of one subject, or 30 to 60 for a style. Phone photos are fine if they are sharp and varied.
- A graphics card with 12 to 16 GB of memory for Flux.1 dev or Flux 2 Klein 4B, or 24 GB and up for Flux 2 dev. No card? Rent one for an hour (see below) or use an online trainer.
- A free trainer: AI Toolkit, Kohya sd-scripts (or the FluxGym interface on top of it) or OneTrainer. All run on Windows and Linux with Python installed.
- One to three hours, most of it waiting. A Graydient plan only matters at the end, when you want to render with the file. Compare plans and pricing.
Step 1: pick the Flux base to train on
A LoRA is bound to the base model it was trained on, so start with the base you want to render with. The Flux family has three branches that do not share LoRAs:
| Base | Memory to train | Where the LoRA runs afterwards |
|---|---|---|
| Flux.1 dev | 12 to 16 GB with the base in fp8 and an 8-bit optimizer; 24 GB is comfortable | Flux.1 dev, Flux.1 schnell (weaker), Flux Krea dev and the many Flux.1 fine-tunes. On Graydient: <flux-dev>. The largest LoRA ecosystem; pick this if unsure. |
| Flux 2 Klein 4B | 12 to 16 GB; train on the Klein 4B Base checkpoint, not the 4-step distilled one | Klein 4B and Klein 4B based checkpoints only. Fast to train and fast to render; Apache 2.0 licence. |
| Flux 2 Klein 9B | About 24 GB; train on the Klein 9B Base checkpoint | Klein 9B only. Better detail than 4B, non-commercial licence. |
| Flux 2 dev | 24 GB minimum, 48 GB comfortable; rent for this unless you own a 4090 or 5090 | Flux 2 dev and Flux 2 dev based checkpoints. On Graydient: <flux2>. The highest quality, the slowest to train. |
The rule to remember: Flux.1 LoRAs do not work on Flux 2, Flux 2 LoRAs do not work on Flux.1, and Klein 4B, Klein 9B and Flux 2 dev each need their own LoRA. Krea 2 is a different model, not Flux. If you use several bases, train once per base from the same dataset.
Step 2: build the dataset
Flux learns fast from small, clean datasets. Quality beats count; 20 sharp and varied pictures beat 80 near-duplicates.
- Collect 15 to 30 pictures for a person, product or object. Change the angle, the distance, the lighting and the background between shots. Include at least a third close-ups and a third full body or full product.
- For a style, collect 30 to 60 works with the same medium and line quality but different subjects: people, places, objects. The variety is what tells the trainer the subject is not the style.
- Remove blur, heavy compression, watermarks, text overlays and anyone who is not the subject. One stray face in the set will show up in renders.
- Resolution: 1024 pixels on the long side is the standard for Flux. Keep aspect ratios mixed; every trainer buckets them automatically. Do not stretch pictures to squares.
- Put the pictures in one folder with a text file next to each picture that has the same name. The caption goes in the text file:
dataset/01.jpg dataset/01.txt dataset/02.jpg dataset/02.txt
Step 3: write the captions
Flux reads natural sentences through its T5 text encoder, so captions are plain descriptions, not keyword lists. The captions decide what the LoRA learns and what it leaves alone:
- For a subject, start with a trigger word that is not a real word, then describe everything that is not the subject: clothes, pose, place, light. The trainer learns that the trigger word is the part the caption does not explain.
- For a style, describe the content of each picture and never the style. The style is what the LoRA learns by omission, and it will then apply to any subject you prompt.
- Keep captions to one or two sentences. Auto-caption with Florence-2 or JoyCaption if you have more than 30 pictures, then read and fix the first ten by hand.
- Do not use a real person's name as the trigger word, and do not caption things that are not in the picture.
A subject caption for a person LoRA: ohwx woman, wearing a grey wool coat, standing on a stone bridge, overcast daylight, looking at the camera
A caption for a style LoRA, where the style is deliberately not mentioned: a fishing boat in a harbour at dawn, two men on the pier, fog over the water
Step 4: choose a trainer
Four free, open-source trainers cover every Flux base. They all take the same dataset folder and produce the same kind of .safetensors file:
- AI Toolkit (by ostris): the most used Flux trainer. One YAML configuration file per run, a web interface, low-VRAM modes, and support for Flux.1 dev, Flux 2 dev and Flux 2 Klein. Start the run with
python run.py config/my_flux_lora.yaml. The best first choice. - Kohya sd-scripts and FluxGym: Kohya is the veteran trainer behind most Stable Diffusion LoRAs and has a Flux branch. FluxGym is a one-page web interface on top of it with 12, 16 and 20 GB presets. Good when you want a form to fill, not a file to edit.
- OneTrainer: a desktop application with a friendly interface for SDXL and Flux.1. Pick it if you also train SDXL LoRAs and want one tool.
- Online trainers: Civitai's on-site trainer and the Flux trainers on GPU hosting sites take a zip of pictures and return a file. They cost credits per run and hide the settings, but you need no card at all. The file they produce imports into Graydient the same way.
Step 5: set the five numbers that matter
Every trainer exposes dozens of options. Leave the defaults alone except these, which decide how strong, how general and how large the LoRA is:
| Setting | Flux.1 dev | Flux 2 Klein 4B (Base) |
|---|---|---|
| Network rank (dim) | 16 for a face or object, 32 for a detailed style | 16; 32 for styles |
| Alpha | Equal to the rank | Equal to the rank |
| Learning rate | 1e-4 to 2e-4 (Prodigy or Adafactor if the trainer offers it) | 1e-4 |
| Steps | 1000 to 2000, so each picture is seen 60 to 120 times | 1000 to 2000 |
| Resolution | 1024 (768 if memory is short) | 1024 |
| Batch size | 1 (2 on 24 GB) | 1 or 2 |
| Base precision | fp8 base with an 8-bit optimizer on 12 to 16 GB; bf16 on 24 GB and up | bf16 fits on 16 GB; fp8 on 12 GB |
Set the trainer to save a checkpoint every 250 steps and to render two sample pictures at each save, with the same prompt and seed. These samples are how you will pick the winner. Flux.1 dev and Flux 2 dev are guidance-distilled; the trainers handle that for you, so leave the guidance setting at its default.
Step 6: train
- Start the run and watch the memory for the first minute. If it fills the card and spills into system memory, stop: training will take ten times longer and may crash.
- If memory spills, switch the base to fp8, turn on gradient checkpointing, use the 8-bit AdamW or Adafactor optimizer, drop the resolution to 768, and keep the batch at 1. Any one of these frees gigabytes.
- Once it runs clean, leave it alone. Flux.1 dev takes one to two hours for 1500 steps on a 16 GB card; Klein 4B is faster; Flux 2 dev takes about an hour on a rented 48 GB card.
- Look at the sample pictures as they appear. The subject usually shows up by step 500 and is solid by 1000. If it is perfect at 750, you may stop early.
Training is slow and noisy, not fragile. A run that survives the first minute almost always finishes. Cache the latents and text embeddings before training if your trainer offers it; it saves memory and time on every run.
Step 7: test and pick the right checkpoint
The last checkpoint is rarely the best. Overtrained LoRAs copy the dataset's backgrounds, burn the contrast and stop listening to prompts. Test them all:
- Write four prompts the dataset does not contain: a new place, a new outfit, a different light, a different medium. Fix the seed.
- Render each saved checkpoint with the four prompts at LoRA weights 0.6, 0.8 and 1.0.
- Pick the earliest checkpoint that nails the subject and still follows the new prompts. Later ones are usually overcooked; earlier ones are vague.
- Rename the winner to something you will recognise in a library a year from now, such as the subject and the base: my-flux-lora, not lora_000750.
No graphics card? Rent one for an hour
Flux 2 dev training, or any Flux training on a laptop, is cheaper on a rented card than on your own time. A 24 or 48 GB card costs well under the price of a coffee per hour on GPU rental marketplaces, and a Flux LoRA needs one to two hours.
- Rent a machine with a 24 GB card for Flux.1 dev or Klein, 48 GB for Flux 2 dev. Pick a template that has the trainer preinstalled when the marketplace offers one; AI Toolkit templates are common.
- Upload the dataset folder, run the same settings as above, and download the checkpoints you want to test. The dataset and the weights stay yours.
- Stop the machine when the download finishes. The whole thing, including setup, is usually under two hours of rental.
Use your Flux LoRA on Graydient
Graydient does not need the file on your computer to render with it. Put it where Graydient can fetch it and import the link:
- Upload the .safetensors file to a repository in your Hugging Face account (public or private), or publish it on Civitai with the base model set to the Flux version you trained on.
- log in to Graydient, open Model Import from your dashboard library, and paste the direct file link from Hugging Face or the Civitai page link. The full steps are in how to import Civitai and Hugging Face models on Graydient.
- Wait for the LoRA to appear in your library and copy the ShortCode Graydient gave it.
- Render with the LoRA tag and the matching base in any Graydient app:
<lora:my-flux-lora:0.8> <flux-dev>for a Flux.1 LoRA, or<lora:my-flux2-lora:0.8> <flux2>for a Flux 2 LoRA. Every app, weight and stacking rule is in the beginner guide to Flux and Flux 2 LoRAs on Graydient.
A complete first render for Telegram or Discord, with the trigger word first and the LoRA at 0.8 on the Flux dev base: /render ohwx woman, portrait, soft window light, 85mm photo <lora:my-flux-lora:0.8> <flux-dev> /steps:24 /guidance:3.5 /size:1024x1024
Licences: what you may do with the LoRA
A LoRA is a derivative of its base model, so the base licence travels with it. Check the current licence text on the model page before you sell renders or the file:
- Flux.1 dev and Flux 2 dev are released under Black Forest Labs' non-commercial licence. Personal projects and research are fine; commercial use needs their commercial licence.
- Flux 2 Klein 4B (and its Base checkpoint) is Apache 2.0, so LoRAs trained on it carry no base-model restriction. Klein 9B is under the non-commercial licence.
- The pictures in your dataset have their own rights. Train on photos you took or own, and never on a real person without their consent.
If something goes wrong
- Out of memory in the first minute: the base in fp16 plus the optimizer does not fit. Switch to fp8, 8-bit AdamW or Adafactor, gradient checkpointing, resolution 768, batch 1. If it still spills, rent a card.
- The LoRA changes the whole picture, not just the subject: the captions did not describe the background and light, so the trainer learned them as part of the trigger word. Re-caption with the context spelled out and vary the dataset.
- The face is right at weight 1.0 but prompts are ignored: overtrained. Use an earlier checkpoint. Next run, halve the steps or lower the learning rate to 5e-5.
- Only a vague resemblance at any weight: undertrained, or the dataset is too uniform. Add steps in 500-step blocks, or add pictures with new angles.
- The LoRA does nothing on Graydient: the base does not match. A Flux.1 LoRA needs
<flux-dev>; a Flux 2 LoRA needs<flux2>. Also check that the trigger word is in the prompt. - Training runs but is painfully slow: it spilled into system memory, or the dataset is on a slow drive. Fix the memory as in the first point, cache latents, and move the dataset to an SSD.
That is the whole method: one base, 20 clean pictures, honest captions, five numbers, a run, a test. Your first Flux LoRA will not be your best, and the second one takes half the time. When the file exists, log in to Graydient or compare plans and pricing to render with it as many times as you like. Every plan includes a 7-day money-back guarantee.
Questions
Can Graydient train a Flux LoRA for me?
No. Graydient is a flat-rate rendering service; it runs LoRAs but does not train them. Train on your own card, a rented one or an online trainer as described above, then import the file. Rendering with it afterwards costs nothing extra on any plan.
How many pictures do I need for a Flux LoRA?
15 to 30 for a face, product or object; 30 to 60 for a style. Flux learns from small sets. Past 100 pictures you are fine-tuning, not training a LoRA, and you need more steps and memory.
How much VRAM does Flux LoRA training need?
12 to 16 GB for Flux.1 dev or Flux 2 Klein 4B with the base in fp8 and an 8-bit optimizer. About 24 GB for Klein 9B. 24 GB minimum and 48 GB comfortable for Flux 2 dev. Rent for the last two unless you own a 4090 or 5090.
How long does it take?
One to two hours for Flux.1 dev on a 16 GB card at 1500 steps, less for Klein 4B, and about an hour for Flux 2 dev on a rented 48 GB card. Captioning and testing add another hour the first time.
Can I train a Flux 2 LoRA the same way as a Flux.1 LoRA?
Yes, with the same dataset and captions. Train Klein LoRAs on the Klein Base checkpoints (4B Base or 9B Base), not on the 4-step distilled ones, and remember that the result only runs on that one Klein size. Flux 2 dev needs more memory, so most people rent for it.
Do I need a trigger word for a Flux LoRA?
For a person or object, yes: a made-up word at the start of every caption, which you then put at the start of every prompt. For a style, no trigger word is needed if the captions describe the content and not the style; the LoRA then applies to everything.
Can I keep the LoRA private?
Yes. Upload it to a private Hugging Face repository and import the file link while logged in to Hugging Face; Graydient only fetches files your account may download. Your library is yours alone, and the file never appears on ModelTrends or anywhere public.