You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @patrickvonplaten Thanks for the clarification. For DPM++ 2s a - can you please confirm whether the algorithm_type should be sde-dpmsolver++ or dpmsolver++?
Hmm, I don't think sde-dpmsolver++ is implemented for DPMSolverSinglestepScheduler
NotImplementedError: sde-dpmsolver++ does is not implemented for <class 'diffusers.schedulers.scheduling_dpmsolver_singlestep.DPMSolverSinglestepScheduler'>
Ah good catch! We need to add this algorithm type. Here: https://github.com/huggingface/diffusers/pull/3344/files was the PR to add it to the Multi-Step scheduler. I think it can be more or less copied 1-to-1 to DPMSolverSinglestepScheduler - would you like to open a PR?
From settings you can change the eta of Euler a and other samplers, by default it's 1.0 and it's used here in kdiffusion and I imagine in euler a's case it would go here
The creation of sigmas in a1111 to be passed to a sampler seem a little involved. You can change the "rho", "sigma_min" and "sigma_max" from the ui, and there are some backwards compatible flags
I was going for 1 to 1 kind of for fun, but I think ideally some sacrifices should be made. Like I'm not sure people intentionally use the extra sampler settings, and they're all set to default as far as I know.
My implementation can be found here. I've compared various samplers to a1111 and my implementation and it seems to work, but probably there are details I've missed. https://github.com/CapsAdmin/diffusers-a1111/
I've refactored and fixed some issues, samplers reproduce the same result in a1111 except for DPM2 a Karras (which is marked as a second order sampler). I also explain a bit better in code what's going on in kdiffusion.py
I can observe that samplers like Heun, DPM2 a, DPM fast, DPM++ SDE Karras produce very similar results but has a subtle variation from a1111.
I was thinking this would be the sigma values being slightly different. For example:
I also discovered a potential bug where a1111 will pass eta=1 coming from sampler settings to DPM Fast and DPM Adaptive. The default eta in kdiffusion is 0.
When they are used with eta 0, DPM fast actually produces good results and DPM adaptive finishes a lot faster.
old man, 25 steps, DPM fast, eta 0
old man, 25 steps, DPM fast, eta 1
I think this setting was supposed to be used for ancestral samplers, but accidentally brought to these samplers.
So I guess this is the reason DPM fast is infamous for producing bad results.
@stevhliu did it eventually make it into the Diffusers documentation? I just want to make sure whether this mapping above is still the point of truth or if there is another one somewhere I should use...
Side note, I noticed there are a couple of schedulers in diffusers that are not included in the mapping above. It seems the list is not entirely exhaustive, maybe because they do not exist in A1111?
I've refactored and fixed some issues, samplers reproduce the same result in a1111 except for DPM2 a Karras (which is marked as a second order sampler). I also explain a bit better in code what's going on in kdiffusion.py
I can observe that samplers like Heun, DPM2 a, DPM fast, DPM++ SDE Karras produce very similar results but has a subtle variation from a1111.
I was thinking this would be the sigma values being slightly different. For example:
I used the same method from the k-diffusion pipeline in diffusers to get the min max sigma and I'm not sure how to do it otherwise.
The discrepancy arises from numerical precision. In A1111, betas are generated in float64, and the alphas_cumprod, used in sigma creation, is in float16 format. Conversely, diffusers use float32. torch.cumprod is sensitive to precision, especially when it contains 1000 items. If matching the format, sigmas should be identical. This discrepancy also leads to some differences between A1111 and diffusers' results.
Reacted by Andrew Zhu, Elias Hogstvedt, abc2cba and David Löwenfels
@caiqi I am debugging my comfyui implementation of TCD scheduler, and want to print the sigmas array like you did above. Can you please share how you did that? Sorry if it's a basic question, I am still learning my way around diffusers pipelines... I only see timesteps inside the scheduler mixin code and am not sure where to get the sigmas.
UPDATE: I figured it out, added this to the scheduler's set_timesteps method
Activity
patrickvonplaten commentedon Jul 20, 2023
@stevhliu could we maybe put this in a doc as discussed a bit during our meeting? Maybe in the overview doc page?
stevhliu commentedon Jul 20, 2023
Nice, I'll roll this into a PR I'm working on to update the scheduler APIs!
rbertus2000 commentedon Jul 21, 2023
@patrickvonplaten: I'm confused: Shouldn't DPM++ SDE be DPMSolverSDEScheduler? And in this issue you just said that "DPM++ 2s a" = DPMSolverSinglestepScheduler.
patrickvonplaten commentedon Jul 24, 2023
In my opinion, we could deprecate DPMSolverSDE at some point.
DPM++ 2s ayes indeed it's very similar toDPMSolverSinglestepSchedulerwith init withalgorithm_type="sde-dpmsolver++"anduse_karras_sigmas=Truecmdr2 commentedon Jul 24, 2023
Hi @patrickvonplaten Thanks for the clarification. For
DPM++ 2s a- can you please confirm whether thealgorithm_typeshould besde-dpmsolver++ordpmsolver++?Your recommendation in #3953 is
dpmsolver++:And your most-recent message here is
sde-dpmsolver++:Thanks!
cmdr2 commentedon Jul 24, 2023
Hmm, I don't think
sde-dpmsolver++is implemented forDPMSolverSinglestepSchedulerNotImplementedError: sde-dpmsolver++ does is not implemented for <class 'diffusers.schedulers.scheduling_dpmsolver_singlestep.DPMSolverSinglestepScheduler'>patrickvonplaten commentedon Jul 24, 2023
Ah good catch! We need to add this algorithm type. Here: https://github.com/huggingface/diffusers/pull/3344/files was the PR to add it to the Multi-Step scheduler. I think it can be more or less copied 1-to-1 to
DPMSolverSinglestepScheduler- would you like to open a PR?cmdr2 commentedon Jul 25, 2023
@patrickvonplaten Thanks! I've opened a PR at #4251
There's a discrepancy that I'm not sure about, I've raised that in the PR.
CapsAdmin commentedon Jul 25, 2023
I tried implementing a1111's kdiffusion samplers in diffusers along with the ability to pass user changable settings from a1111 to kdiffusion.
Do note that I don't have much experience in this field, it's just something I got into for fun the last month or two.
But my findings are:
"brownian_noise": Truewill pass a custom noise generator to kdiffusion that generate brownian noises_churn = 0.0, s_tmin = 0.0, s_tmax = 0.0, s_noise = 1.0,from settings which are passed onto the kdiffusion samplersI was going for 1 to 1 kind of for fun, but I think ideally some sacrifices should be made. Like I'm not sure people intentionally use the extra sampler settings, and they're all set to default as far as I know.
My implementation can be found here. I've compared various samplers to a1111 and my implementation and it seems to work, but probably there are details I've missed.
https://github.com/CapsAdmin/diffusers-a1111/
CapsAdmin commentedon Jul 26, 2023
I've refactored and fixed some issues, samplers reproduce the same result in a1111 except for DPM2 a Karras (which is marked as a second order sampler). I also explain a bit better in code what's going on in kdiffusion.py
I can observe that samplers like Heun, DPM2 a, DPM fast, DPM++ SDE Karras produce very similar results but has a subtle variation from a1111.
I was thinking this would be the sigma values being slightly different. For example:
I used the same method from the k-diffusion pipeline in diffusers to get the min max sigma and I'm not sure how to do it otherwise.
CapsAdmin commentedon Jul 26, 2023
I also discovered a potential bug where a1111 will pass eta=1 coming from sampler settings to
DPM FastandDPM Adaptive. The default eta in kdiffusion is 0.When they are used with eta 0,
DPM fastactually produces good results andDPM adaptivefinishes a lot faster.old man, 25 steps, DPM fast, eta 0

old man, 25 steps, DPM fast, eta 1

I think this setting was supposed to be used for ancestral samplers, but accidentally brought to these samplers.
So I guess this is the reason DPM fast is infamous for producing bad results.
xhinker commentedon Aug 4, 2023
Wow, this is great, thanks @patrickvonplaten , I have been spending lots of nights testing out the correct mapping relationship
alexisrolland commentedon Aug 15, 2023
Thank you @patrickvonplaten for writing up this mapping! <3
@stevhliu did it eventually make it into the Diffusers documentation? I just want to make sure whether this mapping above is still the point of truth or if there is another one somewhere I should use...
Side note, I noticed there are a couple of schedulers in diffusers that are not included in the mapping above. It seems the list is not entirely exhaustive, maybe because they do not exist in A1111?
Thank you both! 👐
stevhliu commentedon Aug 15, 2023
Hi @alexisrolland, the mapping is live on the
mainversion of the docs 🤗5 remaining items
patrickvonplaten commentedon Sep 12, 2023
Hey @CodeCorrupt,
Yes we could add them in a PR I think :-)
patrickvonplaten commentedon Sep 12, 2023
@CodeCorrupt do you mind opening a new issue with this?
CodeCorrupt commentedon Sep 13, 2023
New issue was opened #5002 👍
jiaxin-lin commentedon Dec 9, 2023
Hi! Wondering if there's plan for "DPM++ 3M SDE" implementation (or if that's already implemented?)
patrickvonplaten commentedon Dec 18, 2023
There is no plan to add it yet, feel free to open a PR @JLLLinn :-)
caiqi commentedon Feb 19, 2024
The discrepancy arises from numerical precision. In A1111, betas are generated in float64, and the alphas_cumprod, used in sigma creation, is in float16 format. Conversely, diffusers use float32. torch.cumprod is sensitive to precision, especially when it contains 1000 items. If matching the format, sigmas should be identical. This discrepancy also leads to some differences between A1111 and diffusers' results.
alexisrolland commentedon Feb 19, 2024
@stevhliu it seems the link is broken. Would you mind resharing a link to where this is in the doc please?
Thank you
stevhliu commentedon Feb 20, 2024
You can find it in the Schedulers overview :)
abc2cba commentedon Mar 4, 2024
How about the LCM scheduler?How to set init params to align a1111 rst?
dfl commentedon Mar 24, 2024
@caiqi I am debugging my comfyui implementation of TCD scheduler, and want to print the sigmas array like you did above. Can you please share how you did that? Sorry if it's a basic question, I am still learning my way around diffusers pipelines... I only see timesteps inside the scheduler mixin code and am not sure where to get the sigmas.
UPDATE: I figured it out, added this to the scheduler's set_timesteps method
andypotato commentedon Mar 27, 2024
+1 for this. I'm getting consistent good results with this sampler in A1111, so I'd really love to see it in Diffusers
Youngon commentedon May 21, 2024
mark