---
title: "LoRA training scripts of the world, unite!"
description: "Combining Pivotal Tuning (textual inversion of newly inserted tokens, then LoRA fine-tuning) with the adaptive Prodigy optimizer produces strong SDXL Dreambooth LoRA results, and both are now available in a diffusers training script."
url: "https://swe.quest/articles/lora-training-scripts-of-the-world-unite-73f0d15365f25313"
canonical: "https://huggingface.co/blog/sdxl_lora_advanced_script"
source: "Hugging Face"
published: "2024-01-02"
difficulty: "hard"
kind: "How-to"
reading_minutes: 18
tags: ["model-training","computer-vision","machine-learning"]
---

# LoRA training scripts of the world, unite!

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2024-01-02, 18 min read, How-to. Original: [https://huggingface.co/blog/sdxl\_lora\_advanced\_script](https://huggingface.co/blog/sdxl_lora_advanced_script)

## Summary

Combining Pivotal Tuning (textual inversion of newly inserted tokens, then LoRA fine-tuning) with the adaptive Prodigy optimizer produces strong SDXL Dreambooth LoRA results, and both are now available in a diffusers training script. The guide covers the relevant flags and recommended values: stopping textual inversion halfway through training, Prodigy with learning\_rate=1.0 and bias correction, and separate text encoder and UNet learning rates. It also covers custom BLIP captions, Min-SNR gamma of 5.0, image repeats, prior preservation loss and dataset curation tips for faces and objects. Experiments on a 31-image Huggy mascot dataset compare batch sizes, optimizers and text encoder training modes.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [Computer vision](https://swe.quest/tags/computer-vision.md) (AI & ML)
- [Machine learning](https://swe.quest/tags/machine-learning.md) (AI & ML)

## Prerequisites

- Stable Diffusion basics
- LoRA fine-tuning ([easy posts on Model training](https://swe.quest/tags/model-training.md?difficulty=easy))
- Dreambooth
- deep learning optimizers ([easy posts on Machine learning](https://swe.quest/tags/machine-learning.md?difficulty=easy))

## Keywords

SDXL, LoRA, Dreambooth, Pivotal Tuning, Prodigy, diffusers, Textual Inversion, Min-SNR

## Related posts

- [Using LoRA for Efficient Stable Diffusion Fine-Tuning](https://swe.quest/articles/using-lora-for-efficient-stable-diffusion-fine-tuning-7bd5416d145ae531.md): Hugging Face · 2023-01-26 · Medium · 7 min read · Model training, Computer vision, Python
  LoRA freezes pretrained weights and trains small rank-decomposition matrices, and diffusers now supports applying it to Stable Diffusion's cross-attention layers for both full fine-tuning and Dreambooth.
- [Training Stable Diffusion with Dreambooth using Diffusers](https://swe.quest/articles/training-stable-diffusion-with-dreambooth-using-diffusers-498f7d039b45823b.md): Hugging Face · 2022-11-07 · Medium · 8 min read · Model training, Computer vision
  Dreambooth fine-tuning of Stable Diffusion overfits quickly, so learning rate and step count must be tuned together.
- [Preference Optimization for Vision Language Models](https://swe.quest/articles/preference-optimization-for-vision-language-models-a84799e96613bf21.md): Hugging Face · 2024-07-10 · Hard · 11 min read · Model training, Computer vision, LLMs, Python
  TRL now supports direct preference optimization (DPO) for vision language models, trained on chosen/rejected answer pairs rather than fixed labels.
- [(LoRA) Fine-Tuning FLUX.1-dev on Consumer Hardware](https://swe.quest/articles/lora-fine-tuning-flux-1-dev-on-consumer-hardware-310a6094e7391e33.md): Hugging Face · 2025-06-19 · Hard · 11 min read · Model training, Computer vision, Python
  FLUX.1-dev can be LoRA fine-tuned on a single consumer GPU by combining QLoRA (4-bit NF4 base transformer via bitsandbytes), 8-bit AdamW, gradient checkpointing, cached VAE latents and precomputed CLIP/T5 text embeddings, so that only the quantized transformer plus adapters sit in GPU memory.
- [SDXL in 4 steps with Latent Consistency LoRAs](https://swe.quest/articles/sdxl-in-4-steps-with-latent-consistency-loras-2dbb6e57c86cbe97.md): Hugging Face · 2023-11-09 · Medium · 10 min read · Inference & serving, Computer vision, Model training, Performance engineering
  LCM LoRAs apply latent consistency distillation as small LoRA adapters instead of distilling each full model, so any fine-tuned SDXL or Stable Diffusion 1.5 model can generate images in 4–8 steps instead of 25–50.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
