stable-diffusion.cpp
stable-diffusion.cpp copied to clipboard
txt2img can not be called multiple times.
txt2img can not be called multiple times. when calling txt2img the second time it will crash at following line
cond_stage_model->compute(n_threads, input_ids, input_ids2, max_token_idx, false, &chunk_hidden_states, work_ctx);
I suspect there is some resource not freed after the first time txt2img call.
If I call free_sd_ctx and new_sd_ctx again then I can call the txt2img again. But it is obviously not reasonble because new_sd_ctx is very slow and time-consuming that need to load the model again.
I found the crash caused by free_params_immediately=true when calling new_sd_ctx. So I assume we should check this param when user call the txt2img multiple times. Or point out the problem in the api document.
;p you can try this commits branch:
https://github.com/leejet/stable-diffusion.cpp/pull/236
I think it already fixed early, which currently is working on svd-xt heavy output check & waiting accept.
;p you can try this commits branch:
#236
I think it already fixed early, which currently is working on svd-xt heavy output check & waiting accept.
Thanks for your patch. Because I have some trouble to compile the cuda dll. It is too slow to test with cpu only dll. I will hold on until maintainer accept your merge. No rush for the patch.
If you wish to generate images multiple times, simply set "free_params_immediately" to false.