-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Adding pred_original_sample to SchedulerOutput for some samplers #614
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
…Scheduler, LMSDiscreteScheduler, KarrasVeScheduler step methods so we can access the predicted denoised outputs
Just checked that e.g. PNDMScheduler (which also uses SchedulerOutput) still works as expected, where scheculer_output.prev_sample is the same as before, and scheculer_output.pred_original_sample = None. So the addition of pred_original_sample to the SchedulerOutput class won't break things that don't compute it. |
Not sure why the code check on src/diffusers/schedulers/scheduling_karras_ve.py is failing? |
Running |
…output dataclasses so the default SchedulerOutput in scheduling_utils does not need pred_original_sample as an optional extra
The documentation is not available anymore as the PR was closed or merged. |
Great, have undone the change to the default |
Strange the prev one passed everything but after that change its back to failing the code check, but if I run |
Think I figured it out, needed to pip install isort, black and hf-doc-builder for |
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 good, thank you @johnowhitaker!
…gingface#614) * Adding pred_original_sample to SchedulerOutput of DDPMScheduler, DDIMScheduler, LMSDiscreteScheduler, KarrasVeScheduler step methods so we can access the predicted denoised outputs * Gave DDPMScheduler, DDIMScheduler and LMSDiscreteScheduler their own output dataclasses so the default SchedulerOutput in scheduling_utils does not need pred_original_sample as an optional extra * Reordered library imports to follow standard * didnt get import order quite right apparently * Forgot to change name of LMSDiscreteSchedulerOutput * Aha, needed some extra libs for make style to fully work
Modified DDPMScheduler, DDIMScheduler, LMSDiscreteScheduler, KarrasVeScheduler step methods so we can access the predicted denoised outputs. SchedulerOutput (or KarrasVeOutput in the case of KarrasVeScheduler) now has
pred_original_sample
in addition toprev_sample
.I've checked that all these work (fortunately the changes aren't doing anything too drastic since all these already calculate pred_original_sample internal to their step functions). But I haven't checked to make sure there aren't others using SchedulerOutput - just in case I made pred_original_sample Optional and set default to None.
I haven't touched the flax versions since I'd need to brush up on my jax
Quickest way to test (example DDIM) is as follows:
pndm, sde_ve and sde_vp are a little different, so left them alone for now.