You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
It would be nice to be able to use text2img & img2img & inpaint with the same instanced pipeline
Describe the solution you'd like pipe.generate(...) pipe.image_to_image(...) pipe.inpaint(...)
Describe alternatives you've considered
It's possible to call StableDiffusionInpaintPipeline.__call__(pipe, ...), but it might break at some point if classes are not compatible
If you want to use a certain pipeline for a specific use case that is not yet supported, you might have to copy the pipeline file and tweak the code to your needs.
I actually combined StableDiffusionPipeline and StableDiffusionInpaintPipeline locally, but then if there are some bugfixes in the library, I would need to update my copy too.
I'm using generation + inpainting at the same time, and as I understand if I instance StableDiffusionPipeline and StableDiffusionInpaintPipeline, it will consume 2x GPU memory. So wondering if there's some way to use uploaded weights in separate pipelines
Another option might be to use a separate class for the model like:
I think that merging the pipelines into a single one in src/diffusers/pipelines/stable_diffusion is making perfect sense.
A fix to the pipeline shoud be applied only in one place, this is the basic DRY principle.
as @python273 said, an unified pipeline is actually needed if you want to have a single pipeline in your GPU memory for an interface for stable-diffusion doing txt to image, image to image or inpainting
@patrickvonplaten Please reconsider and allow merging the pipelines into one in the library itself. Of course in the examples folders the pipelines could and should stay simple
In the meantime, an unified pipeline version made by @nagolinc with some fixes is available here
Activity
patrickvonplaten commentedon Sep 1, 2022
Hey @python273,
According to our philosophy here: https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/README.md#contribution
(see one purpose only) - I don't think it's a good idea to make all the classes into one.
However, the community might very well be interested in such a pipeline, so it would be a great addition for the community examples
python273 commentedon Sep 1, 2022
hmm, isn't it about examples?nevermindI actually combined
StableDiffusionPipelineandStableDiffusionInpaintPipelinelocally, but then if there are some bugfixes in the library, I would need to update my copy too.I'm using generation + inpainting at the same time, and as I understand if I instance
StableDiffusionPipelineandStableDiffusionInpaintPipeline, it will consume 2x GPU memory. So wondering if there's some way to use uploaded weights in separate pipelinesAnother option might be to use a separate class for the model like:
leszekhanusz commentedon Sep 1, 2022
I think that merging the pipelines into a single one in
src/diffusers/pipelines/stable_diffusionis making perfect sense.A fix to the pipeline shoud be applied only in one place, this is the basic
DRYprinciple.as @python273 said, an unified pipeline is actually needed if you want to have a single pipeline in your GPU memory for an interface for stable-diffusion doing txt to image, image to image or inpainting
@patrickvonplaten Please reconsider and allow merging the pipelines into one in the library itself. Of course in the
examplesfolders the pipelines could and should stay simpleIn the meantime, an unified pipeline version made by @nagolinc with some fixes is available here
Inkorak commentedon Sep 1, 2022
You can share models through pipelines. You just need to initialize one pipeline with models from another pipeline:
python273 commentedon Sep 1, 2022
oh, this works, thanks
Made a helper function to create kwargs
Inkorak commentedon Sep 1, 2022
@python273 You can also write something like this. But I haven't tried it myself yet.
patrickvonplaten commentedon Sep 2, 2022
Hey @Inkorak,
Feel free to add such a pipeline to our community examples https://github.com/huggingface/diffusers/tree/main/examples/community 🙂
leszekhanusz commentedon Sep 11, 2022
@Inkorak
With a few changes I was able to make it work.
leszekhanusz commentedon Sep 11, 2022
Because I think it's interesting for many people I am going to maintain a unified pipeline.
to install:
to use:
then use this pipeline for either text-to-image, image-to-image or inpainting.
patrickvonplaten commentedon Sep 12, 2022
Very cool @leszekhanusz !