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

Image Preview #416

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Image Preview #416

wants to merge 3 commits into from

Conversation

ring-c
Copy link
Contributor

@ring-c ring-c commented Sep 20, 2024

For big batches, if something went wrong - we are losing all generated images. I want to get images as they a sampled. This way I can save content to disk and/or show preview as it get done.

Its also a step to #354, we can just call a sd_result_cb with additional parameters. This will take time to modify each sample method in sample_k_diffusion() so i do plan to make it as separate PR (if i can get it working).

What do you think about this changes? This PR is not breaking, just replacing functionality if callback is set.

@ring-c ring-c marked this pull request as ready for review September 20, 2024 15:17
@ring-c
Copy link
Contributor Author

ring-c commented Sep 28, 2024

Well, i added a callback for a sampling steps.
Its inefficient, with steps callback:
txt2img completed in 64.58s
Without:
txt2img completed in 18.03s
(Euler A, 32 steps)

Can look something like this:
Screenshot_20240928_112203

@ring-c ring-c marked this pull request as draft September 28, 2024 06:18
@amblamps
Copy link

Well, i added a callback for a sampling steps. Its inefficient, with steps callback: txt2img completed in 64.58s Without: txt2img completed in 18.03s (Euler A, 32 steps)

Can look something like this: Screenshot_20240928_112203

Does the 64.58s include saving the images to disk?

@ring-c
Copy link
Contributor Author

ring-c commented Sep 28, 2024

@amblamps images are saved in this time, but impact is minimal. I will try to test different approaches to minimize times, but most of the time is decode_first_stage call.

@ring-c
Copy link
Contributor Author

ring-c commented Sep 28, 2024

After testing I can confirm that with right callback function, with will not stop execution - everything else is 0 second, except decode_first_stage. It gives 0.8s to 1.0s compute time on my setup, most of the time its 0.82s to 0.86s. This is per decode, mean per step.

@ring-c ring-c marked this pull request as ready for review September 28, 2024 12:51
cmdr2 pushed a commit to cmdr2/stable-diffusion.cpp that referenced this pull request Nov 19, 2024
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