-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
updated doc for stable diffusion pipelines #1770
updated doc for stable diffusion pipelines #1770
Conversation
yiyixuxu
commented
Dec 19, 2022
- one doc page for each stable diffusion pipeline
- added docstring examples (text2img, inpaint, img2img, upscale, depth2img)
The documentation is not available anymore as the PR was closed or merged. |
Hi @anton-l : How can I fix these 2 tests that failed? |
@yiyixuxu most of the time the code quality and repo consistency tests can be fixed by running There's also |
@@ -71,53 +76,3 @@ If you want to use all possible use cases in a single `DiffusionPipeline` you ca | |||
## StableDiffusionPipelineOutput | |||
[[autodoc]] pipelines.stable_diffusion.StableDiffusionPipelineOutput | |||
|
|||
## StableDiffusionPipeline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
@@ -24,7 +24,7 @@ For more details about how Stable Diffusion 2 works and how it differs from Stab | |||
|
|||
### Available checkpoints: | |||
|
|||
Note that the architecture is more or less identical to [Stable Diffusion 1](./api/pipelines/stable_diffusion) so please refer to [this page](./api/pipelines/stable_diffusion) for API documentation. | |||
Note that the architecture is more or less identical to [Stable Diffusion 1](./api/pipelines/stable_diffusion/overview) so please refer to [this page](./api/pipelines/stable_diffusion/overview) for API documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we maybe add new sections for every example here?:
Text-to-Image
Text-to-Image (512x512 resolution): stabilityai/stable-diffusion-2-base with [StableDiffusionPipeline
]
Text-to-Image (768x768 resolution): stabilityai/stable-diffusion-2 with [StableDiffusionPipeline
]
```python
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
import torch
repo_id = "stabilityai/stable-diffusion-2-base"
pipe = DiffusionPipeline.from_pretrained(repo_id, torch_dtype=torch.float16, revision="fp16")
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
pipe = pipe.to("cuda")
prompt = "High quality photo of an astronaut riding a horse in space"
image = pipe(prompt, num_inference_steps=25).images[0]
image.save("astronaut.png")
Image Inpainting
etc...
This way we could better link to the different tasks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the upscaler should we use "Super-Resolution" or "Image-Upscaling"? I want to make the names consistent at least on the navigation bar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Super-Resolution" sounds good to me! Def in favor of making names consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice - like the new structure much better & super cool that you added a bunch of examples to the pipeline_.....py
functions :-)
Could we add a bit more text to the individual stable diffusion pipeline functions?
@anton-l when I run these commands I notice it changes files that I did not touch on this PR - why did this happen and is it ok for me to commit these changes? |
It might be because of different versions of black, doc-builder and isort that you have installed. black: Line 83 in e4fe941
isort: Line 91 in e4fe941
doc-builder: Line 88 in e4fe941
So as you can see only Could you maybe do:
=> then @anton-l we should probably update black soon. Also cc @patil-suraj @pcuenca @williamberman FYI |
7c8ece5
to
4bd7af3
Compare
add pipeline examples to docstrings updated stable_diffusion_2 page added descriptions for each stable diffusion pipeline
4bd7af3
to
fafc352
Compare
Thanks! it works now I added some descriptions for each pipeline - do you want to take a look and let me know if there is anything we need to add before I merge? |
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_upscale.py
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some final suggestions to improve the docs, but overall this looks really nice to me :-)
Think once the suggestions are in we can merge this one!
Thanks a lot for working on it.
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
…sion_upscale.py Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
…sion_depth2img.py Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
…mg2img.py Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
test failing because the AltDiffusion pipelines have this "Copied from ..." statement but we want the doc string examples to be different: different checkpoint, prompt in a Chinese this is one of the commits that triggered the error be35fda Should I remove the "Copied from ..." statement? |
@yiyixuxu great catch! We'll do a trick here in this case to fix it - let me add one commit to your PR :-) |
import re | ||
|
||
|
||
def replace_example_docstring(example_docstring): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yiyixuxu this is more or less copied from transformers
here: https://github.com/huggingface/transformers/blob/588faad1062198e45cf3aebed21dc1fc1e1ed0d7/src/transformers/utils/doc.py#L1130
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
I've added a docstring function decorator we can use to circumvent this #Copied from" problem as it's very likely to happen again :-) In short, for examples we should probably always recommend to:
This is a trick we also use in |
* add a doc page for each pipeline under api/pipelines/stable_diffusion * add pipeline examples to docstrings * updated stable_diffusion_2 page * updated default markdown syntax to list methods based on huggingface#1870 * add function decorator Co-authored-by: yiyixuxu <yixu@Yis-MacBook-Pro.lan> Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>