Text-to-Image
Diffusers
Safetensors
StableDiffusionPipeline
stable-diffusion
Inference Endpoints

How can we use DPM++ 2M Karras sampler in Diffusers?

#23
by adanish - opened

I'm trying to use the latest samplers which provide better performance with stable diffusion in the diffusers library, but I couldn't find DPM++ 2M Karras sampler in the library. These samplers are present in Automatic111. Can anyone guide me on how to use these samplers in the Diffusers library?

Hey @patrickvonplaten ,
I've checked this scheduler and its giving different results then DPM SDE Karras.

how do we get the settings as close to DPM++ 2M Karras sampler?

Has anyone gotten a solution for this? I have a project that I need to use DPM++ 2M Karras as the SDE version isn't producing the result I need. I'm trying to do this on replicate so it would be code in my predict.py I assume. The only thing I find is to define the schedule DPMSolverMultistep .

It's possible to make identical results using the StableDiffusionKDiffusionPipeline.

How can I use DPM++ 2M Karras sampler for inpainting and img2img in Diffusers?

There's a very useful mapper between A1111 and Hugging Face schedulers/samplers here: https://huggingface.co/docs/diffusers/v0.26.2/en/api/schedulers/overview#schedulers

I assume that you already loaded your model into a pipeline, so you can now modify the scheduler through code:

from diffusers import DPMSolverMultistepScheduler

scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)

pipe.scheduler = scheduler

Im not sure if this is the same scheduler as dpm++ 2m karras though, I just know the code xd.

Sign up or log in to comment