Skip to content

Conversation

@linoytsaban
Copy link
Collaborator

This PR updates and fixes issues in the advanced dreambooth lora sdxl training script

  1. updates the advanced script according to the peft lora changes made in the canonical script
  2. fixes bug when using min SNR gamma and prior preservation loss:
    when using both, there is a shape mismatch between the instance loss and the mse_loss_weights when trying to perform the following operation:
    loss = loss.mean(dim=list(range(1, len(loss.shape)))) * mse_loss_weights
    causing an error.
    I think the reason is the shape of timesteps that is used to calculate the snr gamma - we use timesteps sampled for all images in the batch (i.e. both instance and class) rather than only instance.

@linoytsaban linoytsaban marked this pull request as ready for review December 25, 2023 14:45
@linoytsaban
Copy link
Collaborator Author

cc @apolinario @sayakpaul for review 🙏

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

@sayakpaul
Copy link
Member

Should #6294 be closed?

@linoytsaban
Copy link
Collaborator Author

linoytsaban commented Dec 25, 2023

Should #6294 be closed?

my bad! This one should only be the snr gamma - prior preservation bug fix then, I'll close this and open a new one for the bug fix.

Does the change for the snr gamma calculation make sense logically do you think?

@linoytsaban
Copy link
Collaborator Author

closing to not overlap with #6294, will open a separate one for the snr gamma bug

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.

4 participants