-
Notifications
You must be signed in to change notification settings - Fork 89
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
Fix set_timesteps #163
Fix set_timesteps #163
Conversation
…ger than num_train_timesteps Signed-off-by: Walter Hugo Lopez Pinaya <[email protected]>
Signed-off-by: Walter Hugo Lopez Pinaya <[email protected]>
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.
Looks fine to me, I don't see what the issue is with num_inference_step being a power of 3 but it's something you encountered clearly.
step_ratio = self.num_train_timesteps // self.num_inference_steps | ||
# creates integer timesteps by multiplying by ratio | ||
# casting to int to avoid issues when num_inference_step is power of 3 | ||
timesteps = (np.arange(0, num_inference_steps) * step_ratio).round()[::-1].copy().astype(np.int64) |
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.
I don't think copy
is needed here, the array is fresh and round
should also return a fresh one.
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.
Good point, again it was from the base implementation (huggingface/diffusers#724), but I think here it is safe to remove (for example PNDM already does not use it)
Thanks, Eric! The "power of 3" is one point that we found in the reference code and we kept to avoid problems (discussed here huggingface/diffusers#466) |
Signed-off-by: Walter Hugo Lopez Pinaya <[email protected]>
Fix #162
Signed-off-by: Walter Hugo Lopez Pinaya [email protected]