Skip to content

Conversation

linoytsaban
Copy link
Collaborator

This PR adds support for EDM-style training to the advanced script, based off PR #7126

@linoytsaban linoytsaban changed the title [Advanced DreamBooth LoRA SDXL] Support EDM-style training, follow up on #7126 [Advanced DreamBooth LoRA SDXL] Support EDM-style training (follow up of #7126) Mar 2, 2024
@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 marked this pull request as ready for review March 7, 2024 13:01
@linoytsaban linoytsaban requested a review from sayakpaul March 7, 2024 13:11
Comment on lines 1835 to 1845
def get_sigmas(timesteps, n_dim=4, dtype=torch.float32):
sigmas = noise_scheduler.sigmas.to(device=accelerator.device, dtype=dtype)
schedule_timesteps = noise_scheduler.timesteps.to(accelerator.device)
timesteps = timesteps.to(accelerator.device)

step_indices = [(schedule_timesteps == t).nonzero().item() for t in timesteps]

sigma = sigmas[step_indices].flatten()
while len(sigma.shape) < n_dim:
sigma = sigma.unsqueeze(-1)
return sigma
Copy link
Member

Choose a reason for hiding this comment

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

Add a todo here to revisit different sampling algorithms for obtaining the sigmas. Ideally, Tero Karras should just drop a PR here just sayin' 🤷‍♂️

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.

Sweet!

Let's add a section about this in the README and ship 🚀

@sayakpaul
Copy link
Member

Did you notice anything particularly notable @linoytsaban?

@linoytsaban
Copy link
Collaborator Author

@sayakpaul wanna take one more look?

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!

@sayakpaul sayakpaul merged commit 83062fb into huggingface:main Mar 14, 2024
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