Skip to content

Conversation

tongdaxu
Copy link
Contributor

@tongdaxu tongdaxu commented Nov 27, 2023

What does this PR do?

This PR is a Community Pipeline with update of examples/comumunity/README.md and a new file examples/community/dps_pipeline.py. This pipeline implements the paper [ICLR 2023] Diffusion Posterior Sampling for General Noisy Inverse Problems:

  • The paper deals with zero-shot conditional sampling from unconditional diffuision models, with the corrupted signal and corrunpting operator known. It is kind of magical, as it can do super-resolution, deblurring without any any training or finetuning.
  • For example, using google's unconditional ddpm on celebahq dataset, we can reconstruct
    • Reconstructed image:
    • dps_generated_image
  • from x4 downsampled image:
    • Downsampled image:
    • dps_mea
  • or we can also reconstruct
    • Reconstructed image:
    • sample
  • from a heavily blurred image:
    • Gaussian blurred image:
    • ddpm_generated_image
  • Note that everything above does not require any training or finetuning. Unlike ControlNet that needs extra training, it is an entirely zero-shot approach that works with only pre-trained diffusion model.
  • The original implementation of the authors (https://github.com/DPS2022/diffusion-posterior-sampling) are built upon OpenAI's guided diffusion and ADM model, which are not supported in diffuser.
  • This community pipeline is build upon Google's DDPM as diffuser has no support on ADM. Thus I can not exactly reproduce the results in paper. I have checked the visual results and it looks pretty good (See updated readme). I am a reviewer for [ICLR] in area of generative model, and think my experience is enough to say that this implemetation looks mostly correct to me.

I have paid some attention to the docstr and typechecking, but I am not exactly sure so please correct me if you spot a mistake. I provide test code in main function of "dps_pipeline.py" and how to use it in updated readme.

Thanks for your time!

Before submitting

Who can review?

@patrickvonplaten and @yiyixuxu

@patrickvonplaten
Copy link
Contributor

Very cool!

@patrickvonplaten patrickvonplaten merged commit 14a0d21 into huggingface:main Nov 27, 2023
AmericanPresidentJimmyCarter pushed a commit to AmericanPresidentJimmyCarter/diffusers that referenced this pull request Apr 26, 2024
…nverse Problems (huggingface#5939)

* [community pipeline] dps impl

* add type checking

* pass ruff check

* ruff formatter
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.

2 participants