Skip to content

Conversation

Barque-S
Copy link

@Barque-S Barque-S commented Sep 30, 2025

What does this PR do?

The current version of the examples folder contains a bug in the prior preservation calculation in train_dreambooth_sd3.py and train_dreambooth_lora_sd3.py.

Taking the LoRA version as an example: when using --with_prior_preservation, encode_prompt() incorrectly receives args.instance_prompt instead of prompts (i.e., instance_prompt + class_prompt). This prevents correct encoding of the class prior, which negatively affects subsequent training.

A similar issue exists in the non-LoRA version, where encode_prompt() is called incorrectly.

This PR aims to fix these bugs.

Before submitting

Who can review?

@sayakpaul

…param instead of None; 2. tokenizers should be a list; 3. and max_sequence_length should be provided; 4. _encode_with_t5(...) now behave similar as train_dreambooth_lora_sd3.py does; when calling encode_prompt(...).
…instance_prompt should be passed to param prompt, when calling encode_prompt(...) here..
Copy link
Collaborator

@linoytsaban linoytsaban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants