Merged
Conversation
Contributor
|
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
Collaborator
|
can you take a look here? @hlky |
|
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. |
hlky
approved these changes
Dec 3, 2024
Contributor
hlky
left a comment
There was a problem hiding this comment.
Thanks @StAlKeR7779! 🤗
Test
from diffusers import DPMSolverSinglestepScheduler, DPMSolverMultistepScheduler, StableDiffusionXLPipeline
import torch
solver_order = 3
algorithm_type = "sde-dpmsolver++"
model = "stabilityai/stable-diffusion-xl-base-1.0"
dpm_single = DPMSolverSinglestepScheduler.from_pretrained(model, subfolder="scheduler", solver_order=solver_order, algorithm_type=algorithm_type)
dpm_multi = DPMSolverMultistepScheduler.from_pretrained(model, subfolder="scheduler", solver_order=solver_order, algorithm_type=algorithm_type)
pipeline = StableDiffusionXLPipeline.from_pretrained(model, variant="fp16", torch_dtype=torch.float16)
pipeline.enable_vae_tiling()
pipeline = pipeline.to("cuda")
prompt = "a photo of an astronaut riding a horse on mars"
pipeline.scheduler = dpm_single
num_inference_steps = 23
image = pipeline(prompt, num_inference_steps=num_inference_steps, generator=torch.Generator().manual_seed(0)).images[0]
image.save("dpm_single.png")
pipeline.scheduler = dpm_multi
image = pipeline(prompt, num_inference_steps=num_inference_steps, generator=torch.Generator().manual_seed(0)).images[0]
image.save("dpm_multi.png")
lawrence-cj
pushed a commit
to lawrence-cj/diffusers
that referenced
this pull request
Dec 4, 2024
* Fix wrong output on 3n-1 steps count * Add sde handling to 3 order * make * copies --------- Co-authored-by: hlky <hlky@hlky.ac>
sayakpaul
pushed a commit
that referenced
this pull request
Dec 23, 2024
* Fix wrong output on 3n-1 steps count * Add sde handling to 3 order * make * copies --------- Co-authored-by: hlky <hlky@hlky.ac>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What does this PR do?
This pull request addresses two issues:
Incorrect output in
DPMSolverSinglestepSchedulerFixed the issue where using
solver_order=3and a step count of 3n-1 resulted in incorrect output. The problem was caused by improper handling offinal_sigmas_type=zero, leading to alog(0)error in thesinglestep_dpm_solver_second_order_updatefunction. The handling has been implemented in the simplest possible way, and I welcome any suggestions how it can done better.Support for
sde-dpmsolver++in third orderAdded support for the
sde-dpmsolver++algorithm to both theDPMSolverSinglestepSchedulerandDPMSolverMultistepScheduler. Previously, usingsolver_order=3would throw an error:UnboundLocalError: local variable 'x_t' referenced before assignmentThis was due to the lack of a branch to handle the
sde-dpmsolver++algorithm in thesinglestep_dpm_solver_third_order_updateandmultistep_dpm_solver_third_order_updatefunctions. My implementation is based on how the sde is already integrated into first and second-order solvers, so please review carefully to ensure correctness.Fixes # (issue)
#9007
Who can review?
@yiyixuxu
@LuChengTHU (sorry if wrongly tag you)