Skip to content

Conversation

@dg845
Copy link
Collaborator

@dg845 dg845 commented Oct 27, 2023

What does this PR do?

This PR adds LatentConsistencyModelImg2ImgPipeline, a text-guided image-to-image version of LatentConsistencyModelPipeline based on the community pipeline by @nagolinc.

Based on PR #5477, which was originally in response to issue #5462.

Before submitting

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@patrickvonplaten
@sayakpaul
@nagolinc
@luosiallen

@nagolinc
Copy link
Contributor

nagolinc commented Oct 27, 2023

Did you do any experiments before changing this line?

https://github.com/huggingface/diffusers/blob/main/examples/community/latent_consistency_img2img.py#L326

https://github.com/huggingface/diffusers/pull/5559/files#diff-205b2ad5eac653752af8760192d8315263a5aec4203451d38f3b1db2b20551b9R672

The reason why I am passing the strength to set_timesteps (and using a custom scheduler) is that I found for very small number of timesteps (n=4) the method here (https://gist.github.com/nagolinc/6e0d3960a81714d13b821e3694d673d6) does not work well.

@dg845
Copy link
Collaborator Author

dg845 commented Oct 27, 2023

Thanks for the info @nagolinc! I haven't done any experiments yet. I will try to see if I can handle the strength logic within the pipeline code itself to avoid passing it to set_timesteps (which I think would modify the scheduler API). I guess this might require changes to how LatentConsistencyModelImg2ImgPipeline.get_timesteps and LCMScheduler.set_timesteps are implemented.

The reason why I am passing the strength to set_timesteps (and using a custom scheduler) is that I found for very small number of timesteps (n=4) the method here (https://gist.github.com/nagolinc/6e0d3960a81714d13b821e3694d673d6) does not work well.

Just to clarify, does "not work well" mean that the code runs into errors, or that the generated images are low quality? I'm running into some errors when testing on different timesteps with the code in 86adad0, but it might be because there are still some other bugs that I haven't found yet.

@HuggingFaceDocBuilderDev

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

@nagolinc
Copy link
Contributor

The images look bad:

using 1st method (https://gist.github.com/nagolinc/6e0d3960a81714d13b821e3694d673d6)

lcm_0Untitled

using 2nd method (https://gist.github.com/nagolinc/53c395d8cd70a852b03fca4eb273923f)
lcm_1Untitled

here's a notebook I was using to test out the two methods

https://github.com/nagolinc/notebooks/blob/main/lcm%20img2img.ipynb

@dg845
Copy link
Collaborator Author

dg845 commented Nov 3, 2023

Hi @patrickvonplaten, since #5632 has been merged, does this PR still make sense?

@sayakpaul
Copy link
Member

Yeah, I think we can safely close it.

@dg845
Copy link
Collaborator Author

dg845 commented Nov 3, 2023

Closing due to #5632 being merged.

@dg845 dg845 closed this Nov 3, 2023
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