diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

Added sampling script for unconditional training example

Open lukovnikov opened this issue 2 years ago • 7 comments

Added sampling script that supports both DDPM and DDIM sampling for unconditional training example

lukovnikov avatar Nov 09 '22 23:11 lukovnikov

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

Hmmm is this really needed, isn't that just equivalent to running the DDIMPipeline ?

Guess we should maybe add better examples to the DDIM pipeline?

patrickvonplaten avatar Nov 15 '22 21:11 patrickvonplaten

The script enables the choice between DDPM and DDIM sampling pipelines but yeah it's basically just running those. I found it convenient to have a simple sampling script right here where it's being trained but you decide.

lukovnikov avatar Nov 16 '22 12:11 lukovnikov

I'm a bit worried here because it adds quite some maintenance and will be outdated very quickly (we'll forget to update it going forward). Could we maybe instead focus on high quality example docstrings in the DDIM and DDPM pipeline. E.g. we could add a nice example to the method here: https://github.com/huggingface/diffusers/blob/f1fcfdeec5ae98b30b0939baf9e64f47c813da99/src/diffusers/pipelines/ddpm/pipeline_ddpm.py#L66 just like we add examples to other functions: https://github.com/huggingface/diffusers/blob/f1fcfdeec5ae98b30b0939baf9e64f47c813da99/src/diffusers/pipeline_utils.py#L662

=> this gives some nice docstrings as shown here: https://huggingface.co/docs/diffusers/api/diffusion_pipeline#diffusers.DiffusionPipeline.components.example

patrickvonplaten avatar Nov 16 '22 17:11 patrickvonplaten

@patrickvonplaten I think good docstrings are nice but if there's an example training script and you just want to run training and then sample a bunch of images, you'd need to create this file anyway so why not just provide it so you can simply run two commands on the shell and not have to worry about implementing the additional folder creation and image saving stuff and creating a DDIMSchedule from the loaded DDPMSchedule. It's not hard, but 5 sec is better than 15 min.

I'm not sure what to think about maintenance. If people actually use it, and changes to the main code eventually break this script and you forget about it, I think it will be quite easy to fix once people post issues that it's broken?

lukovnikov avatar Nov 16 '22 19:11 lukovnikov

@patrickvonplaten perhaps we can merge this script with the training script in this example so you can just use one script to train and sample?

lukovnikov avatar Nov 22 '22 12:11 lukovnikov

I'm still not very in favor because https://github.com/huggingface/diffusers/pull/1234/files is essentially just calling the DDIMPipeline

Maybe cc @patil-suraj @pcuenca @anton-l here to hear your opinion

patrickvonplaten avatar Nov 28 '22 12:11 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 Dec 22 '22 15:12 github-actions[bot]

Sorry to only reply now, but I agree with Patrick here, since we are just calling DDIMPipeline IMO it's necessary to have a script for this.

patil-suraj avatar Dec 29 '22 13:12 patil-suraj

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 Jan 22 '23 15:01 github-actions[bot]