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

Fix ControlNet batch #2909

Merged
merged 1 commit into from
May 19, 2024
Merged

Fix ControlNet batch #2909

merged 1 commit into from
May 19, 2024

Conversation

huchenlei
Copy link
Collaborator

Closes #2886.

The root cause of this issue is that both img2img script instance and txt2img script instance has access to the same group of enabled_units objects, and each batch iteration, batch_tab_process_each on both img2img script and txt2img script are invoked to advance the iterator on the same unit.

Previously units are copied on each call to Script.get_enabled_units, which is costly, but maintains the correctness. This PR solves the issue by distinguish txt2img and img2img script, which resolves the issue more fundamentally, and also avoiding copy cost of ControlNetUnit.

@huchenlei huchenlei merged commit a5c0da5 into Mikubill:main May 19, 2024
2 checks passed
@huchenlei huchenlei deleted the fix_batch branch May 19, 2024 19:56
@fastjhone0
Copy link

Closes #2886.

The root cause of this issue is that both img2img script instance and txt2img script instance has access to the same group of enabled_units objects, and each batch iteration, batch_tab_process_each on both img2img script and txt2img script are invoked to advance the iterator on the same unit.

Previously units are copied on each call to Script.get_enabled_units, which is costly, but maintains the correctness. This PR solves the issue by distinguish txt2img and img2img script, which resolves the issue more fundamentally, and also avoiding copy cost of ControlNetUnit.

Thank you so much for this fix

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.

[Bug]: Batch mode skip half of the images
2 participants