Skip to content

Create modular pipeline from existing pipeline #11915

Description

@vladmandic

new concept of modular pipelines added via #9672 is very flexible way of creating custom pipelines
and one of the best early use-cases is new concept of modular guiders added via #11311

however, this would require a complete rewrite of the existing user apps/codebases to use new concepts
and would likely significantly slow down adoption (if not even block adoption for a long time)

ask here is to provide a way to use an existing pipeline to instantiate a modular pipeline,
very similar to how different standard diffuser pipelines can be instantiated
from a single pipeline class using from_pipe method

example of desired workflow:

importtorchimportdiffusers# load pipeline using any normal method # such as DiffusionPipeline, AutoPipelineForText2Image, StableDiffusionPipeline, etc. pipe=diffusers.DiffusionPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0",
torch_dtype=torch.bfloat16,
)
# create modular pipeline from loaded pipelinemodular=diffusers.ModularPipeline.from_pipe(pipe)
# create guider and activate itcfg=diffusers.ClassifierFreeGuidance(guidance_scale=5.0, guidance_rescale=0.0, start=0.0, stop=1.0)
modular.update_states(guider=cfg)
output=modular(
prompt='astronaut in a diner',
height=1024, width=1024)

cc: @yiyixuxu@a-r-r-o-w@sayakpaul

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions