diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

Fix bug in half precision for DPMSolverMultistepScheduler

Open rtaori opened this issue 3 years ago • 2 comments

The following code fails for the new DPMSolverMultistepScheduler when used in half precision due to torch.quantile() expecting inputs to be in full precision. This slight patch fixes this bug and allows for the following use case:

pipe = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", custom_pipeline="stable_diffusion_mega",
                                         scheduler=DPMSolverMultistepScheduler(beta_start=0.00085, beta_end=0.012, beta_schedule='scaled_linear'),
                                         torch_dtype=torch.float16, revision="fp16", safety_checker=None, use_auth_token=True).to('cuda')
pipe.text2img('a picture of a stealth fighter', num_images_per_prompt=10, num_inference_steps=50, output_type='numpy')

rtaori avatar Nov 20 '22 23:11 rtaori

The documentation is not available anymore as the PR was closed or merged.

Added a test!

rtaori avatar Nov 23 '22 15:11 rtaori

Thanks a lot @rtaori !

patrickvonplaten avatar Nov 29 '22 12:11 patrickvonplaten