翻篇收录说明
翻篇网页快照

Fine-tuning Diffusion Image Models with LoRA locally | Unsloth Documentation

https://unsloth.ai/docs/basics/fine-tune-diffusion-models-with-lora

最近抓取:2026-12-04 23:17:59(北京时间)

最近内容变化:2026-12-02 10:45:57(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

Train an image LoRA on your own pictures in Unsloth, with examples for FLUX.3, Qwen-Image-2.1, MiniMax-H3-Image and MOSS-Image.

正文摘录

A LoRA is a small add-on that teaches an image model a new style or subject. In Unsloth you train one from 10 to 50 of your own images, without writing code, then use it in Create. Each example below shows the same prompt and seed without (left) and with (right) a LoRA trained in Unsloth.FLUX.3 Image Klein, 500 steps on 60 tarot cardsMOSS-Image without the LoRAWith a LoRA trained on 16 neon line-art imagesWhich models you can trainModelTrain onUse the LoRA onGPU memory (NVIDIA)Default steps, rank, learning rate, resolutionFLUX.3 Image KleinFLUX.3 Klein BaseKlein and Klein Base12 GB+ (nf4)500, 32, 0.0001, 768Qwen-Image-2.1Qwen-Image-2.1Qwen-Image-2.1 and Turboabout 20 GB500, 16, 0.0001, 768Qwen-Image-2.1-TurboQwen-Image-2.1Turboabout 20 GB500, 16, 0.0001, 768MiniMax-H3-ImageMiniMax-H3-ImageMiniMax-H3-Image (full model)32 GB+ (estimate)150, 32, 0.00005, 1024MOSS-ImageMOSS-Image-SFT (or Base)MOSS-Image INT8, FP8 or bf16about 18 GB500, 32, 0.0001, 768Distilled models (Klein, Qwen-Image-2.1-Turbo) are not training bases: train on their base model and run the LoRA on the distilled one. For video models, see Fine-tune LTX-2.5 and Fine-tune MiniMax-H3.How to train an image LoRAImage LoRA training needs Unsloth 2026.11.5 or newer (MOSS-Image: a release newer than 2026.11.6). Launch with unsloth studio -H 0.0.0.0 -p 8888.You need:A supported GPU. Memory depends on the model; see the table above. AMD training is supported with bf16 and nf4 bases. MOSS-Image needs an NVIDIA GPU with bf16 (Ampere or newer).10 to 50 images of one style or subject.A trigger word in every caption, such as trtcrd or sks neon style, to turn the LoRA on in prompts.1Prepare your imagesFormats: PNG, JPG, WebP or BMP.Captions: a .txt (or .caption) file with the same name next to each image, for example card1.png and card1.txt. You can instead put a metadata.jsonl in the folder with one line per image, such as {"file_name": "card1.png", "text": "a trtcrd of a queen holding a cup"}. A caption file wins over metadata.jsonl.Trigger word: start every caption with it. Images without a caption use the Trigger prompt; with no trigger prompt they are skipped.Keep the set to one style or one subject. 16 images were enough for the neon examples below.One of 16 training images, caption ending in "sks neon style"2Open Train and pick the modelIn Images, click Train and set Model family. Pick the training base from the table above, for example FLUX.3 Klein Base for Klein or Qwen-Image-2.1 for Turbo.Train setup with the 1920 Tarot example dataset3Add your imagesUnder Training images, pick Upload new images... and upload the images with their captions, or start from an example dataset such as 1920 Tarot (60 cards, captions start with a trtcrd of). Set an Adapter name: the LoRA's name in Create.4Check the settingsThe defaults per model are in the table above. All models use a constant schedule with 20 warmup steps. Set Sample every (for example 100) and a Sample prompt with your trigger word to see preview images while it trains.Default settings for Qwen-Image-2.1Base precision is the precision of the frozen base model:Auto (recommended): on NVIDIA it picks bf16, then int8, then nf4 by free GPU memory.nf4 uses the least memory. Use it on NVIDIA GPUs with 20 to 24 GB for Qwen-Image-2.1.On AMD, use bf16, nf4 or Auto; int8 and fp8 training bases are not supported.5Start trainingClick Start training. The loss is noisy; watch the smoothed line. Click a step number to compare the sample images.FLUX.3 Klein Base, bf16: 3.68 images/s, 13.1 GB peakMOSS-Image samples at steps 0, 100 and 2006Use the LoRAWhen Adapter ready appears, the LoRA is in the LoRA list. Click Deploy to Create to load a model with your LoRA, then prompt with your trigger word and click Generate.A finished runTo add it yourself, load the model in Create, click Add LoRA and pick your LoRA. FP8 and INT8 builds add LoRAs only when the model loads, so click Reapply after adding one. Lower the LoRA Weight below 1 for a lighter effect.Examples by modelFLUX.3 Image KleinTrain on FLUX.3 Klein Base; the LoRA runs on both Klein and Klein Base. We trained on 1920 Tarot (60 cards, trigger trtcrd) with the defaults: 500 steps took a little over 2 minutes on an NVIDIA RTX PRO 6000.Base precisionTraining speedTraining loop memorynf42.07 images/s6.9 GBint81.92 images/s9.5 GBbf163.69 images/s13.1 GBfp84.41 images/s8.6 GBSame prompt and seed on Klein, without (left) and with (right) the LoRA: a trtcrd of a cat sitting on a throne holding a golden cup, "queen of cats".16 steps, seed 42FLUX.3 Image Klein with the LoRA in CreateDeploy to Create loads Klein with your LoRA. If Klein Base loaded as FP8 or INT8, click Reapply after adding the LoRA. Full guide: Fine-tune FLUX 3.Qwen-Image-2.1Train on Qwen-Image-2.1 (base Qwen/Qwen-Image-2.1). Budget about 20 GB on NVIDIA: the training loop uses about 6.5 GB with nf4, but caption encoding peaks at about 17.6 GB. Our run used 1920 Tarot with the defaults and took about 7 minutes (3.5 for the 500 steps).Base precisionTraining speedTraining loop memorynf41.48 images/s6.5 GBint81.66 images/s9.9 GBbf162.56 images/s16.0 GBfp83.28 images/s9.1 GBMeasured on an NVIDIA RTX PRO 6000. fp8 is experimental. nf4 runs of 200+ steps are compiled and faster (2.29 images/s).Seed 42, 1024 × 1024, 25 steps, guidance 1; only the LoRA changes. Prompt: a trtcrd of a cat sitting on a throne holding a golden cup, "queen of cats"Without the LoRAWith the LoRA (500 steps, nf4)Use a square image near 1024 × 1024; a tall 832 × 1248 image showed little of the style. Full guide: Fine-tune Qwen-Image-2.1.Qwen-Image-2.1-TurboTurbo is distilled, so train on Qwen-Image-2.1 and run the LoRA on Turbo. Deploy to Create after training loads Turbo with your LoRA; or load Turbo, click Add LoRA, pick your LoRA and click Reapply.Seed 42, 1024 × 1024, 8 steps, guidance 1, INT8; only the LoRA changes (500 steps on 1920 Tarot). Prompt: a trtcrd of a cat sitting on a throne holding a golden cup, "queen of cats"Without the LoRAWith the LoRAFull guide: Fine-tune Qwen-Image-2.1-Turbo.MiniMax-H3-ImageTrain on MiniMax-H3-Image. Plan for 32 GB+ of GPU memory (an estimate; tested on 96 GB) and about 95 GB of disk. Auto uses a bf16 base with 56 GB+ free (45.5 GB peak), else int8 (about 24 GB peak). The defaults are 150 steps at 1024 px and learning rate 0.00005; more steps can overcook the style and garble text. 150 steps on 1920 Tarot took about 100 seconds on an RTX PRO 6000 (about 8 minutes including the first download and load).Seed 42, 1024 × 1024, enhancer off: a trtcrd of a cat sitting on a throne holding a golden cup, "queen of cats" and a trtcrd of an astronaut standing on the moon holding a lantern, "the explorer".No LoRAWeight 0.6Weight 1.0No LoRAWeight 1.0Deploy to Create loads the full 66 GB model (not the FP8 repo) with the LoRA merged in; changing the LoRA or its Weight needs a reload. The style is strongest at 1024 × 1024, the training size. Full guide: Fine-tune MiniMax-H3-Image.MOSS-ImageTrain on OpenMOSS-Team/MOSS-Image-SFT (the default) or MOSS-Image-Base. It needs an NVIDIA GPU with bf16 (not a T4); Unsloth suggests about 18 GB. Our nf4 run's training loop used 4.6 GB, and the whole run peaked at 16.5 GB while the Qwen3.5-9B text encoder encoded the captions. Resolution must be a multiple of 16.Our run: 16 neon line-art images, nf4 base, rank 32, learning rate 0.0002, 512 px, 200 steps. It trained at 5.5 images/s on an NVIDIA RTX PRO 6000 (Colab G4) and took about 3.3 minutes including loading and previews.Seed 7, 512 × 512, 25 steps, guidance 2.5; only the LoRA changes. Prompt: a cat sitting on a sofa in a cozy living room, sks neon styleINT8, without the LoRAINT8, LoRA added at loadbf16 (Speed Eager), without the LoRAbf16 (Speed Eager), LoRA weight 1On the INT8 or FP8 build, click Add LoRA, pick your LoRA, then Reapply. On bf16, set Advanced → Speed to Eager or Off (bit-exact) before loading; with Speed on Auto, MOSS-Image compiles from the first image and LoRAs are turned off. Full guide: Fine-tune MOSS-Image.TipsUse the trigger word in your prompts. Prompts without it change much less.Weight: 1.0 gives the full style; 0.6 to 0.8 is subtler.Image size: the style is strongest near the training resolution and a square canvas.Too strong or garbled text: train fewer steps or lower the weight.PreviousGenerate Images DiffusionNextFine-tuning Video ModelsWas this helpful?