fix(memflow): snap invalid resolution to nearest multiple of 16 (#931)#932
Open
livepeer-tessa wants to merge 1 commit intomainfrom
Open
fix(memflow): snap invalid resolution to nearest multiple of 16 (#931)#932livepeer-tessa wants to merge 1 commit intomainfrom
livepeer-tessa wants to merge 1 commit intomainfrom
Conversation
…ad of hard-failing Previously, passing a resolution like 674×389 to the memflow pipeline caused an immediate ValueError and marked the pipeline as failed. This change: - Extends validate_resolution() with a snap=True flag that rounds down width/height to the nearest valid multiple and logs a warning, instead of raising. - Updates MemFlowPipeline.__init__ to use snap=True so non-standard resolutions (common when users resize the canvas freely) are accepted gracefully. - Adds snap_to_multiple() as a standalone helper for reuse. - Adds 11 unit tests covering both error and snap paths. Other pipelines that call validate_resolution() are unaffected; they continue to raise ValueError on invalid input (snap defaults to False). Fixes #931 Signed-off-by: Tessa (livepeer-tessa) <tessa@livepeer.org>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
🚀 fal.ai Preview Deployment
Livepeer Runner
Testing Livepeer Mode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
memflowpipeline crashes with aValueErrorwhen given a resolution that isn't divisible by 16 (e.g. 674×389 from a free-form canvas resize). The pipeline is then marked as failed and the session is unusable.Observed in prod on 2026-04-13: session
0e48d66d, 4 occurrences.Fixes #931
Solution
Instead of hard-failing, auto-snap the resolution down to the nearest valid multiple of 16 and log a warning:
Changes
utils.py: Addsnap_to_multiple()helper. Extendvalidate_resolution()with optionalsnap=Trueflag — when set, rounds down and warns instead of raising. Returns(height, width)tuple in all paths (previously returnedNone).memflow/pipeline.py: Usesnap=Trueso non-standard input resolutions are accepted. Applies the snapped values back toconfig.height/config.width.test_utils_resolution.py: 11 new unit tests covering both error and snap paths.Other pipelines unaffected
longlive,reward_forcing,streamdiffusionv2, andkrea_realtime_videoall callvalidate_resolutionwithoutsnap=Trueand continue to raise on invalid input (no behaviour change).