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

txt2img can not be called multiple times. #238

Open
chinshou opened this issue Apr 23, 2024 · 4 comments
Open

txt2img can not be called multiple times. #238

chinshou opened this issue Apr 23, 2024 · 4 comments

Comments

@chinshou
Copy link

chinshou commented Apr 23, 2024

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.

@chinshou
Copy link
Author

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.

@Windsander
Copy link

;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.

@chinshou
Copy link
Author

;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.

@leejet
Copy link
Owner

leejet commented Apr 29, 2024

If you wish to generate images multiple times, simply set "free_params_immediately" to false.

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

3 participants