Skip to content

[SD3 dreambooth lora] smol fix to checkpoint saving#9993

Merged
linoytsaban merged 4 commits intohuggingface:mainfrom
linoytsaban:sd3-bug-fix
Nov 24, 2024
Merged

[SD3 dreambooth lora] smol fix to checkpoint saving#9993
linoytsaban merged 4 commits intohuggingface:mainfrom
linoytsaban:sd3-bug-fix

Conversation

@linoytsaban
Copy link
Collaborator

@linoytsaban linoytsaban commented Nov 22, 2024

minor change to fix saving of text-encoder layers in lora training script, as we have in place in the dreambooth training script.

related to #8955

@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.

@linoytsaban linoytsaban changed the title [SD3.5 dreambooth lora] smol fix to checkpoint saving [SD3 dreambooth lora] smol fix to checkpoint saving Nov 22, 2024
Comment on lines 1297 to 1303
elif isinstance(model, type(unwrap_model(text_encoder_one))): # or text_encoder_two
# check hidden size to distinguish between text_encoder_one and two
hidden_size = unwrap_model(model).config.hidden_size
if hidden_size == 768:
text_encoder_one_lora_layers_to_save = get_peft_model_state_dict(model)
elif hidden_size == 1280:
text_encoder_two_lora_layers_to_save = get_peft_model_state_dict(model)
Copy link
Member

Choose a reason for hiding this comment

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

Works for me. We cannot distinguish with the classes here because both have the same class. Maybe this reasoning as a comment?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done :)

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

Thanks for fixing!

@linoytsaban linoytsaban merged commit c4b5d2f into huggingface:main Nov 24, 2024
@linoytsaban linoytsaban deleted the sd3-bug-fix branch November 26, 2024 10:18
lawrence-cj pushed a commit to lawrence-cj/diffusers that referenced this pull request Nov 26, 2024
* smol change to fix checkpoint saving & resuming (as done in train_dreambooth_sd3.py)

* style

* modify comment to explain reasoning behind hidden size check
sayakpaul pushed a commit that referenced this pull request Dec 23, 2024
* smol change to fix checkpoint saving & resuming (as done in train_dreambooth_sd3.py)

* style

* modify comment to explain reasoning behind hidden size check
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