-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Add back-compatibility to LMS timesteps #750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The documentation is not available anymore as the PR was closed or merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool, thanks a lot!
@@ -250,7 +256,14 @@ def add_noise( | |||
sigmas = self.sigmas.to(original_samples.device) | |||
schedule_timesteps = self.timesteps.to(original_samples.device) | |||
timesteps = timesteps.to(original_samples.device) | |||
step_indices = [(schedule_timesteps == t).nonzero().item() for t in timesteps] | |||
if isinstance(timesteps, torch.IntTensor) or isinstance(timesteps, torch.LongTensor): | |||
warnings.warn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the deprecate
functionality here
or isinstance(timestep, torch.IntTensor) | ||
or isinstance(timestep, torch.LongTensor) | ||
): | ||
warnings.warn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the deprecate functionality here: #659
@@ -215,7 +210,18 @@ def step( | |||
|
|||
if isinstance(timestep, torch.Tensor): | |||
timestep = timestep.to(self.timesteps.device) | |||
step_index = (self.timesteps == timestep).nonzero().item() | |||
if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could lead to some nasty silent bugs though if the "new" passed timesteps are ints instead of float no? Not sure whether this is a good idea tbh
* Add back-compatibility to LMS timesteps * style
* Add back-compatibility to LMS timesteps * style
Now the legacy pipelines that support LMS won't break because of the integer timesteps :)
For instance: https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/CLIP_Guided_Stable_diffusion_with_diffusers.ipynb