DEV Community

AI-KSK
AI-KSK

Posted on

Training a Qwen-Image-2512 Face LoRA in AI Toolkit: 3,000 Steps, Rank 64, Batch 1

The most reusable asset in image generation right now is not a workflow file. It is a checkpoint that already knows one specific face. This episode is the author's on-camera recipe for building exactly that with AI Toolkit and Qwen-Image-2512, from an empty cloud account to a finished LoRA.

Evidence note: this episode ships no workflow JSON. Every number below is a value the author states in the video or sets on screen, not a value read out of a graph file.

When this is useful

  • You need a reusable identity LoRA for one person, and you would rather train it once than prompt-engineer a likeness every time.
  • You have only one or two clean reference photos and need to expand them into a usable training set.
  • You are renting GPU time by the hour and want the whole path from bare cloud account to a trained adapter in one sitting.

What the author changes versus a stock AI Toolkit run

  1. Resolution is raised to 1280. AI Toolkit defaults to 512 / 768 / 1024 buckets; the author turns 1280 on as well.
  2. LoRA rank is raised to 64. The author calls 64 "already a very large value" for identity work, accepts the default 32 as reasonable, and warns that higher ranks produce bigger files and overfit faster.
  3. Batch size stays at 1, gradient accumulation stays at 1. Above 1, the author says, the character's identity gets averaged out and the result stops looking like the person you trained.
  4. Timestep type is Sigmoid. The author's rule: if clothing and pose come out right but the face does not, use this.
  5. EMA is off. The Qwen-Image-2512 documentation defaults it off, so the run matches.
  6. Float8 is on. For a multi-billion-parameter model the author calls this the most sensible default, because it frees enough VRAM for high resolution at almost no visible cost.
  7. Low-VRAM mode and layer offload are off on an 80GB A800. On a 24GB card you would turn them on, and the author notes they constantly shuttle data between RAM and VRAM and slow training down.
  8. Text-embedding cache on, latent cache on, caption dropout 0.05. Caching needs disk but removes repeated work; dropout stops the model leaning too hard on the text.

Step by step

1. Rent the machine. The author's three-step path to a JupyterLab session: create a cluster (name only), create a shared storage volume, then create a dev machine attached to that cluster. The volume is sized at 256, which the author calls plenty, and HDD is explicitly fine for training because the model is loaded once. The dev machine uses a shared node pool, an A800, and the platform's preset image; the storage volume is mounted as-is. Only one GPU is needed for this video's workload.

2. Install AI Toolkit. The author maintains a written command sheet for this and asks viewers to run the commands in order. In short: create a persistent conda environment under /root/data, install CUDA 12.6 PyTorch plus the project's Python dependencies, install Node.js 20 for the UI, then start the UI, which listens on port 8675.

3. Pull the weights with ModelScope. The sheet uses ModelScope's snapshot_download to place Qwen-Image-2512 at ./models/Qwen-Image-2512 inside the ai-toolkit directory, i.e. the final path /root/data/ai-toolkit/models/Qwen-Image-2512 that you paste into the task form later.

4. Tunnel to the UI. The address the installer prints is not reachable from your laptop. Map the port over SSH from your own machine, substituting your instance's port. The author's newer variant of that command adds keep-alive (ServerAliveInterval=15, ServerAliveCountMax=3, TCPKeepAlive=yes) so an idle tunnel does not drop. The default login password is 123456, which the author recommends changing.

5. Build the dataset. For a person the author recommends 20-50 high-quality close, medium and full-body images; for an object, 15-30 images across angles, detail levels and lighting. Delete blurry, overexposed and badly framed shots first, because "AI will happily learn bad image quality as a style". Vary background, clothing and expression even when training a face, or the background gets welded to your trigger token. No manual cropping is needed: AI Toolkit buckets by aspect ratio, which also preserves the original composition.

6. Choose a trigger word. Not young woman. Something that cannot collide with the model's existing concept of a woman, e.g. a9527 woman. Caption normally, then let the trigger token carry the identity. The author asks for detailed but not exhaustive prompts and argues that mood words are pointless at this model tier and may even degrade results.

7. Create the training task. Name it after the trigger, point at the 2512 model path, choose LoRA as the target type, set save precision to BF16 (FP32 is the highest, BF16 the practical midpoint), and save an archive every 250 steps with up to 99 saves. The author's tuned values: 3,000 steps for a 25-image set, learning rate 1e-4, default Adam, 1 repeat per image per epoch.

8. Sample, or don't. Sampling is decoupled from training; it costs time and the author mostly turns it off. If you want a look at the run, set it to every 500 steps with 2 images rather than the default 10.

Parameter basis

No workflow JSON exists for this episode, so the following is a transcription of the author's settings, not a verified graph read:

Setting Value Source
Base model path /root/data/ai-toolkit/models/Qwen-Image-2512 spoken, on screen
LoRA rank 64 (default 32 called acceptable) spoken
Batch size / grad accum 1 / 1 spoken
Steps 3,000 for 25 images spoken
Learning rate 1e-4 spoken
Optimizer default Adam spoken
Timestep type Sigmoid spoken
Save precision BF16 spoken
Save interval every 250 steps, up to 99 spoken
Caption dropout 0.05 spoken
Resolution buckets up to 1280 spoken
UI port 8675 spoken + written sheet

Limits

  • Nothing downloadable. No JSON, no graph, no mirror image for this episode; the deliverable is the procedure.
  • The numbers are one person's recipe. Rank 64 and 3,000 steps are tuned for a single face on one A800; the author explicitly says the defaults are also defensible.
  • No quality benchmark. The author reports that 2512 captures facial texture well and that he prefers it to Klein for face detail, but no side-by-side metric is shown.
  • Low-VRAM path is untested here. The 24GB advice is the author's expectation of what will fit, not a measured run.
  • Metadata mismatch. The episode's note sheet lists a Bilibili title about an unrelated AI side-business topic; this article follows the recording's actual subject. Treat the Bilibili link as the episode pointer, not as a content reference.

Episode resources

Top comments (0)