-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
k-diffusion-euler #1019
k-diffusion-euler #1019
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.
Thanks a lot for the @hlky , very cool addition!
The code looks good to me, will try it out a bit more and comment here. Also it looks like the new tests are failing, happy to take a look at it.
But should be good to merge for me once the tests are green!
src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py
Outdated
Show resolved
Hide resolved
Hey @hlky would it be okay if I go push commits to the PR to fix the tests ? The PR should be good to merge once the tests pass :) |
@patil-suraj Sure, no problem :) |
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.
Thank you @hlky, excited to see these schedulers in action!
src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py
Outdated
Show resolved
Hide resolved
src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py
Outdated
Show resolved
Hide resolved
src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py
Outdated
Show resolved
Hide resolved
Hey @hlky , it seems like I can't push to your branch, if it's okay with you, could you allow me to push commits to your branch so I could fix the tests ? Otherwise, happy to merge this and open a follow-up PR to fix the tests. Let me know. Thank you :) |
Co-authored-by: Anton Lozhkov <aglozhkov@gmail.com>
Co-authored-by: Anton Lozhkov <aglozhkov@gmail.com>
Co-authored-by: Anton Lozhkov <aglozhkov@gmail.com>
Co-authored-by: Anton Lozhkov <aglozhkov@gmail.com>
…users into k-diffusion-euler
This is great! Thanks @hlky and @patil-suraj One thing I noticed is that in the scheduler's step function you're generating random noise, and not seeded noise. This causes the output to be non-deterministic even when the same seed is used. I've made a commit here which I'd be happy to push to this branch to your PR if you give access to me too. Or can make a PR to your repo. Or can wait for merge and then make a new PR with the modification, it's not a big one. One thought though is at each step a new "random" noise should be generated in which case I think maybe we can have some kind of cyclical counter that offsets the generator's seed in the step function so it's continually random. I'm not sure it'll affect the quality of the result doing this, but would affect output |
src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py
Outdated
Show resolved
Hide resolved
Hey @tonetechnician you are right, and actually that's why the tests were failing. If we pass the Also fine to merge this now, and open a follow-up PR to add this :)
Very good point! The cool thing about |
src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py
Outdated
Show resolved
Hide resolved
src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
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.
LGTM!
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
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.
Amazing work @hlky and @patil-suraj 🥳
Merging as it blocks #890 |
Thanks a lot @hlky and @tonetechnician ! |
I hope you guys know Euler_A is non-determinisitc in this implementation, and do not work with generator seeds. Random result every time. |
@WASasquatch I'm able to get reproducible results on GPU. You need to set your generator
torch.randn expects the generator to be on cpu. This can be fixed by changing the line tonoise = torch.randn(model_output.shape, dtype=model_output.dtype, generator=generator, device=device)
cc @patil-suraj |
Great catch @andrea-gatto ! |
Are you making a PR @andrea-gatto ? I also experienced this just now |
PR is here #1124 |
The issue isn't an error. It runs without error, the results for Euler_A are just random, while every other sampler works fine with torch generator. The code is fine, it's simple Euler_A isn't deterministic with a set seed like the rest. Though I did merge code hours before it was officially merged with a fork of Diffusers, as I was tired of waiting. ;) But I don't see any differences in files to current state on my end so not sure what it'd be with that specific sampler. |
@WASasquatch I get deterministic results with Euler Ancestral on GPU following that fix, maybe the fork you were using wasn't exactly the same (which could explain why you didn't get the error mentioned above), give diffusers==0.7.0 a try :) |
Well, it couldn't possibly be not the same code base,it was installed from
the PR, but possibly just outdated. Though seems you guys merged only few
ours after I forked diffusers/PR.
…On Fri, Nov 4, 2022 at 5:34 AM andrea-gatto ***@***.***> wrote:
@WASasquatch <https://github.com/WASasquatch> I get deterministic results
with Euler Ancestral on GPU following that fix, maybe the fork you were
using wasn't exactly the same (which could explain why you didn't get the
error mentioned above), give diffusers==0.7.0 a try :)
—
Reply to this email directly, view it on GitHub
<#1019 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIZEZNVEXDFU2ANX4PQXB3WGT7FZANCNFSM6AAAAAARP6566U>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Sincerely,
*Jordan S. C. Thompson *
|
* k-diffusion-euler * make style make quality * make fix-copies * fix tests for euler a * Update src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py Co-authored-by: Anton Lozhkov <aglozhkov@gmail.com> * Update src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py Co-authored-by: Anton Lozhkov <aglozhkov@gmail.com> * Update src/diffusers/schedulers/scheduling_euler_discrete.py Co-authored-by: Anton Lozhkov <aglozhkov@gmail.com> * Update src/diffusers/schedulers/scheduling_euler_discrete.py Co-authored-by: Anton Lozhkov <aglozhkov@gmail.com> * remove unused arg and method * update doc * quality * make flake happy * use logger instead of warn * raise error instead of deprication * don't require scipy * pass generator in step * fix tests * Apply suggestions from code review Co-authored-by: Pedro Cuenca <pedro@huggingface.co> * Update tests/test_scheduler.py Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com> * remove unused generator * pass generator as extra_step_kwargs * update tests * pass generator as kwarg * pass generator as kwarg * quality * fix test for lms * fix tests Co-authored-by: patil-suraj <surajp815@gmail.com> Co-authored-by: Anton Lozhkov <aglozhkov@gmail.com> Co-authored-by: Pedro Cuenca <pedro@huggingface.co> Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
k_euler and k_euler_a
related #944 #636