-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
A1111 <> Diffusers Scheduler mapping #4167
Comments
@stevhliu could we maybe put this in a doc as discussed a bit during our meeting? Maybe in the overview doc page? |
Nice, I'll roll this into a PR I'm working on to update the scheduler APIs! |
@patrickvonplaten: I'm confused: Shouldn't DPM++ SDE be DPMSolverSDEScheduler? And in this issue you just said that "DPM++ 2s a" = DPMSolverSinglestepScheduler. |
|
Hi @patrickvonplaten Thanks for the clarification. For Your recommendation in #3953 is
And your most-recent message here is
Thanks! |
Hmm, I don't think
|
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 |
@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. |
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:
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. |
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. |
Wow, this is great, thanks @patrickvonplaten , I have been spending lots of nights testing out the correct mapping relationship |
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! 👐 |
Hi @alexisrolland, the mapping is live on the |
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. |
Ok to close this @patrickvonplaten now that it is in the docs here? |
Hey HF team, I'm trying to mimic the A1111 samplers using the table listed here and in the docs but it seems the Please let me know if I'm just missing something 🤗 |
Hey @CodeCorrupt, Yes we could add them in a PR I think :-) |
@CodeCorrupt do you mind opening a new issue with this? |
New issue was opened #5002 👍 |
Hi! Wondering if there's plan for "DPM++ 3M SDE" implementation (or if that's already implemented?) |
There is no plan to add it yet, feel free to open a PR @JLLLinn :-) |
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. |
@stevhliu it seems the link is broken. Would you mind resharing a link to where this is in the doc please? Thank you |
You can find it in the Schedulers overview :) |
How about the LCM scheduler?How to set init params to align a1111 rst? |
@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 self.timesteps = torch.from_numpy(timesteps).to(device=device, dtype=torch.long)
print(f"timesteps: {repr(self.timesteps)}")
sigmas = np.sqrt(1 - self.alphas_cumprod)
print(f"sigmas: {sigmas.to(device=device)[self.timesteps]}") |
+1 for this. I'm getting consistent good results with this sampler in A1111, so I'd really love to see it in Diffusers |
mark |
A1111 <> Diffusers Mapping
use_karras_sigmas=True
algorithm_type="sde-dpmsolver++"
algorithm_type="sde-dpmsolver++"
anduse_karras_sigmas=True
use_karras_sigmas=True
use_karras_sigmas=True
use_karras_sigmas=True
use_karras_sigmas=True
Diffusers samplers have a couple more ways to be customized as can be seen from the inits of the respective samplers.
The text was updated successfully, but these errors were encountered: