Skip to content

Question Regarding Reusing Context for Multiple Generations in Example Code #437

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

Closed
grorge123 opened this issue Oct 10, 2024 · 2 comments
Closed

Comments

@grorge123
Copy link

I noticed that in the example provided in stable diffusion.cpp, a context is created and used for a single image generation (either image-to-image or text-to-image). I wondered if it’s possible to reuse the same context for multiple generating without recreating it each time.

I tried reusing the context for multiple generations but encountered a segmentation fault either in image-to-image or text-to-image. For example, I copy and paste results = txt2img(...); after the original generate results code section.

Could you provide an example of a context that has been reused for multiple generations, or is this approach not supported?

@SkutteOleg
Copy link
Contributor

Set free_params_immediately to false when calling new_sd_ctx

#366 (comment)

@grorge123
Copy link
Author

It also works for me.
Thank you.

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

No branches or pull requests

2 participants