stable-diffusion
stable-diffusion copied to clipboard
Saving intermediate images
When I run optimized_img2img.py module with 768x768px size it generates nice image but it takes long time and I was wondering if it's possible to get more images by saving intermediate images as well to a separate folder named exactly as the image generated just without .png
I was wondering about such an implementation. If it helps for development, the progrock variant of Disco Diffusion may serve as an example: https://github.com/lowfuel/progrockdiffusion
The VQGAN repo offers another possibility: https://github.com/EleutherAI/vqgan-clip
I know nothing about this stuff, but also wanted to get intermediate images of each step.
You can specify a img_callback in the model.sample call. I added a function to handle the callback, in which I just copied the existing code to spit out PNGs, which meant a batch of 4 512x512 images took an extra minute on my 1070 ti, so not ideal.
I also had to edit optimizedSD/ddpm.py, changing it's img_callback to return img instead of pred_x0.
When I run
optimized_img2img.pymodule with768x768pxsize it generates nice image but it takes long time and I was wondering if it's possible to get more images by saving intermediate images as well to a separate folder named exactly as the image generated just without.png
What is the use of getting intermediate images? Like is it to optimize ddim_steps or see how the image evolves over time?
What is the use of getting intermediate images? Like is it to optimize ddim_steps or see how the image evolves over time?
Yes, for these two reasons you described. For different samplers and different resolutions this feature would allow users to set minimal steps size while preserving image quality they strive for; and of course, very often I am very curious how the image evolved over time.
I think that most users work with another script - optimized_txt2img.py but in this issue I mentioned only optimized_img2img.py
I have created the same Feature Request in https://github.com/lstein/stable-diffusion/issues/154 because I think that this feature could be useful in both forks.
I know nothing about this stuff, but also wanted to get intermediate images of each step.
You can specify a
img_callbackin themodel.samplecall. I added a function to handle the callback, in which I just copied the existing code to spit out PNGs, which meant a batch of 4 512x512 images took an extra minute on my 1070 ti, so not ideal.I also had to edit
optimizedSD/ddpm.py,changing it's img_callback to returnimginstead ofpred_x0.
What if the overread problem is the image being saved on disk? did you save those images? If so, what if you try to async flush the images in the disk ?