Skip to content

Conversation

@yiyixuxu
Copy link
Collaborator

@yiyixuxu yiyixuxu commented Sep 4, 2023

As I'm working on the fine tune training script for Kandinsky, I noticed when we use the combined pipeline to load both prior and decoder pipelines together, we can't pass the prior pipeline's components, e.g. we will not be able to do this

pipe = AutoPipelineForText2Image.from_pretrained(
    "kandinsky-community/kandinsky-2-2-decoder", 
    torch_dtype=torch.float16,
    prior_image_encoder = image_encoder)

Below test currently fails, but will be fixed with this PR

from diffusers import AutoPipelineForText2Image, DDPMScheduler, UnCLIPScheduler
import torch

pipe = AutoPipelineForText2Image.from_pretrained(
    "kandinsky-community/kandinsky-2-2-decoder", 
    torch_dtype=torch.float16)

# confirm that the default prior_scheduler is unclip
assert pipe.prior_scheduler.__class__.__name__ == "UnCLIPScheduler"

scheduler = DDPMScheduler.from_pretrained("kandinsky-community/kandinsky-2-2-decoder", subfolder="scheduler")

pipe = AutoPipelineForText2Image.from_pretrained(
    "kandinsky-community/kandinsky-2-2-decoder", 
    torch_dtype=torch.float16,
    prior_scheduler = scheduler)
pipe = pipe.to("cuda")

# should update the prior_scheduler to ddpm
assert pipe.prior_scheduler.__class__.__name__ == "DDPMScheduler"

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Sep 4, 2023

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

@patrickvonplaten
Copy link
Contributor

Very cool! I was actually thinking about the exact same design yesterday since we need it for #3849 as well!

Could you maybe add some tests and then more than happy to merge this one :-)

@patrickvonplaten
Copy link
Contributor

Good to merge for me - thanks!

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.

Clean and simple!

Let's fix the failing CI before merging, though.

Hmm, the failing test actually seems to be flaky as mentioned in #4842.

@yiyixuxu yiyixuxu merged commit 2c1677e into main Sep 4, 2023
@yiyixuxu yiyixuxu deleted the combined-pipe-pass-components branch September 4, 2023 16:21
yoonseokjin pushed a commit to yoonseokjin/diffusers that referenced this pull request Dec 25, 2023
… pipeline (huggingface#4883)

* fix

* add test

---------

Co-authored-by: yiyixuxu <yixu310@gmail,com>
AmericanPresidentJimmyCarter pushed a commit to AmericanPresidentJimmyCarter/diffusers that referenced this pull request Apr 26, 2024
… pipeline (huggingface#4883)

* fix

* add test

---------

Co-authored-by: yiyixuxu <yixu310@gmail,com>
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.

5 participants