Skip to content

Conversation

@patrickvonplaten
Copy link
Contributor

@patrickvonplaten patrickvonplaten commented Oct 13, 2022

Once this is merged one can:

from diffusers import DiffusionPipeline

pipe = DiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", community="stable_diffusion_mega")

pipe.text2img("An astronaut riding a horse")
pipe.inpaint(...)
pipe.img2img(...)

when using diffusers >= 0.4.0

@patrickvonplaten patrickvonplaten changed the title All in one pipeline All in one Stable Diffusion Pipeline Oct 13, 2022
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Oct 13, 2022

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

@patrickvonplaten
Copy link
Contributor Author

Also cc @osanseviero @apolinario

Copy link
Contributor

@keturn keturn left a comment

Choose a reason for hiding this comment

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

usage looks straightforward enough 👍


@property
def components(self) -> Dict[str, Any]:
return {k: v for k, v in vars(self).items() if not k.startswith("_")}
Copy link
Contributor

Choose a reason for hiding this comment

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

This part spooks me a little bit, just because vars(self) is so broad. I'd be more comfortable with something more explicit, maybe drawing from ConfigMixin.config?

I guess the thing to consider when thinking about the risk is: What does it look like when it fails? i.e. what will StableDiffusionPipeline.__init__ do when we pass it some attribute we picked up from here that it doesn't expect?

Does it fail with a useful message? Does it fail with a mysterious message? Does it silently ignore it?

Is there anything in place to make sure the signatures of all StableDiffusion*Pipeline are consistent and remain that way?

e.g. They may all be DiffusionPipelines, but not all DiffusionPipelines have a feature_extractor, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Understood! Ideally we should make a solid function like this right for the DiffusionPipeline class .

I'll try to make the function a bit safer (with better error messages)

callback: Optional[Callable[[int, int, torch.FloatTensor], None]] = None,
callback_steps: Optional[int] = 1,
):
# For more information on how this function works, please see: https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion#diffusers.StableDiffusionImg2ImgPipeline
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this link to the docstring?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Like add docstring for the whole function and then state that it's copied ? Note that this won't be in our official docs as it's not in src/diffusers/pipelines

@patrickvonplaten patrickvonplaten merged commit 146419f into main Oct 17, 2022
@patrickvonplaten patrickvonplaten deleted the add_all_in_one_sd_pipeline branch October 17, 2022 12:37
kumquatexpress pushed a commit to harvestlabs/diffusers that referenced this pull request Oct 19, 2022
* uP

* correct

* make style

* small change
prathikr pushed a commit to prathikr/diffusers that referenced this pull request Oct 26, 2022
* uP

* correct

* make style

* small change
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