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 assertion error in UniPC scheduler for high step counts #126

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

g7adrian
Copy link
Contributor

@g7adrian g7adrian commented Mar 1, 2025

This fixes an edge case in the FlowUniPCMultistepScheduler where using high sampling step counts (> 50) would cause an assertion error in the last step. The issue was that with lower_order_final=True, the order calculation could become 0 when step_index equals len(timesteps), causing 'assert self.this_order > 0' to fail.

The fix ensures this_order is always at least 1, maintaining stability while allowing higher quality generation with increased step counts.

I verified that with this fix generation works if setting "--sample-steps" to 100. Without this change, it fails at the last step.

🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]

This fixes an edge case in the FlowUniPCMultistepScheduler where using high sampling step counts (> 50) would cause an assertion error in the last step. The issue was that with lower_order_final=True, the order calculation could become 0 when step_index equals len(timesteps), causing 'assert self.this_order > 0' to fail.

The fix ensures this_order is always at least 1, maintaining stability while allowing higher quality generation with increased step counts.

🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]
@dichen-cd
Copy link

We were unable to reproduce this bug. Could you please provide detailed information on how to reproduce this bug?

@maxpaynestory
Copy link

On ComfyUI i tested with 100 steps UniPC and Wan2.1 works fine. Here is the screenshot

image

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.

3 participants