You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As image generation models get bigger & more powerful, more fine-tuners come to find that training only part of the
152
+
transformer blocks (sometimes as little as two) can be enough to get great results.
153
+
In some cases, it can be even better to maintain some of the blocks/layers frozen.
154
+
155
+
For **SD3.5-Large** specifically, you may find this information useful (taken from: [Stable Diffusion 3.5 Large Fine-tuning Tutorial](https://stabilityai.notion.site/Stable-Diffusion-3-5-Large-Fine-tuning-Tutorial-11a61cdcd1968027a15bdbd7c40be8c6#12461cdcd19680788a23c650dab26b93):
156
+
> [!NOTE]
157
+
> A commonly believed heuristic that we verified once again during the construction of the SD3.5 family of models is that later/higher layers (i.e. `30 - 37`)* impact tertiary details more heavily. Conversely, earlier layers (i.e. `12 - 24` )* influence the overall composition/primary form more.
158
+
> So, freezing other layers/targeting specific layers is a viable approach.
159
+
> `*`These suggested layers are speculative and not 100% guaranteed. The tips here are more or less a general idea for next steps.
160
+
> **Photorealism**
161
+
> In preliminary testing, we observed that freezing the last few layers of the architecture significantly improved model training when using a photorealistic dataset, preventing detail degradation introduced by small dataset from happening.
162
+
> **Anatomy preservation**
163
+
> To dampen any possible degradation of anatomy, training only the attention layers and **not** the adaptive linear layers could help. For reference, below is one of the transformer blocks.
164
+
165
+
166
+
We've added `--lora_layers` and `--lora_blocks` to make LoRA training modules configurable.
167
+
- with `--lora_blocks` you can specify the block numbers for training. E.g. passing -
"--adam_weight_decay_text_encoder", type=float, default=1e-03, help="Weight decay to use for text_encoder"
572
572
)
573
573
574
+
parser.add_argument(
575
+
"--lora_layers",
576
+
type=str,
577
+
default=None,
578
+
help=(
579
+
"The transformer block layers to apply LoRA training on. Please specify the layers in a comma seperated string."
580
+
"For examples refer to https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/README_SD3.md"
581
+
),
582
+
)
583
+
parser.add_argument(
584
+
"--lora_blocks",
585
+
type=str,
586
+
default=None,
587
+
help=(
588
+
"The transformer blocks to apply LoRA training on. Please specify the block numbers in a comma seperated manner."
589
+
'E.g. - "--lora_blocks 12,30" will result in lora training of transformer blocks 12 and 30. For more examples refer to https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/README_SD3.md'
0 commit comments