diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

Add StableDiffusion repaint pipeline

Open nathanielherman opened this issue 2 years ago • 12 comments

nathanielherman avatar Nov 19 '22 07:11 nathanielherman

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

Bump on this PR! Also @patrickvonplaten wdym by "leave it here"?

nathanielherman avatar Nov 28 '22 22:11 nathanielherman

Thanks for catching the issues @Randolph-zeng!

@nathanielherman let me know if you don't have bandwidth this week, I'd be happy to help getting the PR ready for merging :)

anton-l avatar Dec 08 '22 14:12 anton-l

Hey! I did most of the updates and will look at adding an integration test. On that note, AFAICT from here https://github.com/huggingface/diffusers/blob/main/tests/pipelines/stable_diffusion/test_stable_diffusion_inpaint_legacy.py#L352, the code is actually loading the non-legacy pipeline rather than the legacy one? I'm a bit confused how that's not breaking it though, since it's initializing it with a non-inpainting model ("CompVis/stable-diffusion-v1-4")

nathanielherman avatar Dec 08 '22 19:12 nathanielherman

Just curious, am I the only one that experienced the DDIM degradation here ? When I use the code in this PR I noticed that the DDIM almost failed completely in producing any meaningful impaint image that corresponds to the prompt. @nathanielherman Are you troubled by this same issue https://github.com/huggingface/diffusers/issues/1602 or does it work fine with you ? Thanks a lot if you can share some insight : )

Randolph-zeng avatar Dec 09 '22 02:12 Randolph-zeng

@Randolph-zeng hmm I'm confused by the linked issue, do you only get the issue for CFG outside of 6-7, or for any CFG? I only really use the default CFG of 7.5 but for that I get pretty reasonable outputs. (Though I wouldn't say repaint is obviously better results than default inpaint_legacy.)

nathanielherman avatar Dec 09 '22 22:12 nathanielherman

@anton-l bump on my question for the unit test, I just want to make sure I'm understanding correctly before I add my own unit test

nathanielherman avatar Dec 09 '22 22:12 nathanielherman

@nathanielherman regarding your question

the code is actually loading the non-legacy pipeline rather than the legacy one

The tests there carried over from the time when the legacy inpainting pipeline wasn't yet Legacy :) The pipeline loader substitutes the appropriate class for now: https://github.com/huggingface/diffusers/blob/31444f5790a8f91fc2caf3995fadc561e23fb279/src/diffusers/pipeline_utils.py#L539-L544 So you can safely assume that those tests are actually using StableDiffusionInpaintPipelineLegacy (we should probably update them, thanks for bringing it up!)

anton-l avatar Dec 12 '22 12:12 anton-l

@anton-l makes sense! I've added the test and attached the npy file as a comment on this PR — IIUC from the docs, someone would need to upload that npy file and then I can update the test to download it from the url?

nathanielherman avatar Dec 12 '22 22:12 nathanielherman

@nathanielherman uploaded it to the repo: https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/repaint/red_cat_sitting_on_a_park_bench_repaint.npy But also feel free to set up a personal repository on the hub to link the files, we can adapt later! :)

Great progress on the PR, let me know if it's ready for the final review!

anton-l avatar Dec 15 '22 12:12 anton-l

@anton-l perfect, it should be good for final review now!

nathanielherman avatar Dec 16 '22 21:12 nathanielherman

Gently ping @anton-l for a final review

patrickvonplaten avatar Jan 03 '23 11:01 patrickvonplaten

Thanks for the nice PR @nathanielherman!

Three things from my side:

    1. Could we also add fast tests here similar to: https://github.com/huggingface/diffusers/blob/f17fae641c7c268e60c479396891ea97a6b29aae/tests/pipelines/stable_diffusion/test_stable_diffusion_inpaint.py#L43
    1. Could we also add docs as explained here: https://github.com/huggingface/diffusers/tree/main/docs
    1. Could we remove all the deprecation messages?

Thanks!

patrickvonplaten avatar Jan 03 '23 11:01 patrickvonplaten

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

github-actions[bot] avatar Feb 26 '23 15:02 github-actions[bot]

Good Morning

Thanks for the great work. I am wondering why this pull request has been closed and how one can help.

Markus-Pobitzer avatar Mar 09 '23 09:03 Markus-Pobitzer

@anton-l is there something left we can do to merge this pipeline ?

vlordier avatar Apr 09 '23 20:04 vlordier

@vlordier the TODO is mostly just to update the tests as per the comments above (and fix any API issues uncovered by the common tests), and resolve the merge conflicts.

anton-l avatar Apr 12 '23 08:04 anton-l

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

github-actions[bot] avatar May 06 '23 15:05 github-actions[bot]