Skip to content

Fix panorama to support all schedulers #3546

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

Merged
merged 8 commits into from
May 24, 2023
Merged

Conversation

Isotr0py
Copy link
Contributor

  • Refactor some code and support all schedulers including PNDMScheduler for panorama pipeline.

Similar to #3499, make all schedulers sync with blocks sampling. This can solve most of the issues about failed images generation in panorama pipeline.

Test code

import torch
from diffusers import StableDiffusionPanoramaPipeline, PNDMScheduler

seed = 76
model_ckpt = "stabilityai/stable-diffusion-2-base"
prompt = "a photo of the dolomites"

pipe = StableDiffusionPanoramaPipeline.from_pretrained(model_ckpt, torch_dtype=torch.float16).to("cuda")
pipe.scheduler = PNDMScheduler.from_config(pipe.scheduler.config)
pipe.to("cuda")
generator = torch.Generator(device="cuda").manual_seed(seed)
image = pipe(prompt, generator=generator, num_inference_steps=25,width=1024,height=512).images[0]
display(image)

Results

PNDMScheduler

PNDM

UniPCMultistepScheduler

UniPC

KDPM2DiscreteScheduler

KDPM2

DEISMultistepScheduler

DEIS

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented May 24, 2023

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

@patrickvonplaten
Copy link
Contributor

Super nice PR! Good job @Isotr0py . @sayakpaul I'll let you review this one

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this is an elegant solution to deal with stateful schedulers like PNDM!

Can we also fix this test case then?

def test_stable_diffusion_panorama_pndm(self):

@sayakpaul
Copy link
Member

Also Cc: @omerbt

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@sayakpaul sayakpaul merged commit a94977b into huggingface:main May 24, 2023
@Isotr0py Isotr0py deleted the panorama branch May 24, 2023 12:29
yoonseokjin pushed a commit to yoonseokjin/diffusers that referenced this pull request Dec 25, 2023
* refactor blocks init

* refactor blocks loop

* remove unused function and warnings

* fix scheduler update location

* reformat code

* reformat code again

* fix PNDM test case

* reformat pndm test case
AmericanPresidentJimmyCarter pushed a commit to AmericanPresidentJimmyCarter/diffusers that referenced this pull request Apr 26, 2024
* refactor blocks init

* refactor blocks loop

* remove unused function and warnings

* fix scheduler update location

* reformat code

* reformat code again

* fix PNDM test case

* reformat pndm test case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants