Skip to content
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

Add paint by example #1533

Merged
merged 30 commits into from Dec 7, 2022
Merged

Add paint by example #1533

merged 30 commits into from Dec 7, 2022

Conversation

patrickvonplaten
Copy link
Contributor

@patrickvonplaten patrickvonplaten commented Dec 3, 2022

This PR adds https://github.com/Fantasy-Studio/Paint-by-Example

  • Weight Conversion

Conversion script works:

python scripts/convert_original_stable_diffusion_to_diffusers.py --checkpoint_path ../new_inpaint_test/model.ckpt --dump_path ../new_inpaint_test --num_in_channels 9 --pipeline_type PaintByExample

Test weights are uploaded

from diffusers import DiffusionPipeline

pipeline = DiffusionPipeline.from_pretrained("Fantasy-Studio/Paint-by-Example")
  • Check forward pass - integration test works as expected
  • Demo
  • Publish

Check with authors: @Fantasy-Studio

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Dec 3, 2022

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

Copy link
Member

@pcuenca pcuenca left a comment

Choose a reason for hiding this comment

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

Very very cool!

Question: should we place the folder inside pipelines/stable_diffusion so it's a bit more visible?

patrickvonplaten and others added 3 commits December 7, 2022 10:12
Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
@@ -302,7 +302,7 @@ def test_attention_slicing_forward_pass(self):
output_with_slicing = pipe(**inputs)[0]

max_diff = np.abs(output_with_slicing - output_without_slicing).max()
self.assertLess(max_diff, 1e-5, "Attention slicing should not affect the inference results")
self.assertLess(max_diff, 1e-3, "Attention slicing should not affect the inference results")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

attention slicing forces different batch size matrix multiplication - there is no way we can guarantee a 1e-5 diff only IMO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@patrickvonplaten
Copy link
Contributor Author

Very very cool!

Question: should we place the folder inside pipelines/stable_diffusion so it's a bit more visible?

New paper -> new folder IMO

@patrickvonplaten patrickvonplaten merged commit 896c98a into main Dec 7, 2022
@patrickvonplaten patrickvonplaten deleted the add_paint_by_example branch December 7, 2022 10:06
tcapelle pushed a commit to tcapelle/diffusers that referenced this pull request Dec 12, 2022
* add paint by example

* mkae loading possibel

* up

* Update src/diffusers/models/attention.py

* up

* finalize weight structure

* make example work

* make it work

* up

* up

* fix

* del

* add

* update

* Apply suggestions from code review

* correct transformer 2d

* finish

* up

* up

* up

* up

* fix

* Apply suggestions from code review

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>

* Apply suggestions from code review

* up

* finish

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
sliard pushed a commit to sliard/diffusers that referenced this pull request Dec 21, 2022
* add paint by example

* mkae loading possibel

* up

* Update src/diffusers/models/attention.py

* up

* finalize weight structure

* make example work

* make it work

* up

* up

* fix

* del

* add

* update

* Apply suggestions from code review

* correct transformer 2d

* finish

* up

* up

* up

* up

* fix

* Apply suggestions from code review

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>

* Apply suggestions from code review

* up

* finish

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
@chenbinghui1
Copy link

@patrickvonplaten hello, how to convert diffuser's model to original paintbyexample model type. I find there is no scripts for doing this

yoonseokjin pushed a commit to yoonseokjin/diffusers that referenced this pull request Dec 25, 2023
* add paint by example

* mkae loading possibel

* up

* Update src/diffusers/models/attention.py

* up

* finalize weight structure

* make example work

* make it work

* up

* up

* fix

* del

* add

* update

* Apply suggestions from code review

* correct transformer 2d

* finish

* up

* up

* up

* up

* fix

* Apply suggestions from code review

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>

* Apply suggestions from code review

* up

* finish

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
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.

None yet

4 participants