Physics in 2-Steps: Locking Motion Priors Before Visual Refinement Erases Them#6
Open
remyx-ai[bot] wants to merge 2 commits into
Open
Conversation
308e8f0 to
1ae76da
Compare
Convention-shape patches extracted from huggingface/diffusers's recent merged PRs. Algorithm logic is left untouched. Ruff auto-fixed lint-trivial issues on patched files.
1faded8 to
3838873
Compare
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.
What does this PR do?
Implements PhaseLock ("Physics in 2-Steps: Locking Motion Priors Before Visual Refinement Erases Them") as a training-free, plug-in spectral guidance module and wires it into the AnyFlow denoising loop.
extract_motion_phasesnapshots the FFT phase of an early few-step latent (the physically-consistent motion prior) andapply_phase_lockre-imposes it on later high-fidelity latents via shortest-arc phase nudging, preserving the magnitude spectrum (visual fidelity) bit-for-bit at full strength.Motivation
Following the 'Add AnyFlow Video Diffusion Pipelines' and 'Refactor AnyFlow for torch.compile and Standalone Masking' work, the natural next step is improving physical consistency of generated video. PhaseLock preserves valid motion priors from early inference steps without retraining or model changes. It operates purely on the per-step latent — exactly the I/O the AnyFlow (and standard diffusers)
callback_on_step_endhook reads and writes back (verified atpipeline_anyflow.py:613-623) — so it wires in as a clean addition with no model/trainer dependency, and no existing module implements spectral phase-locking.Note on availability: no code repository or model URL surfaced in the paper, recommendation envelope, or arXiv abstract page, so no LICENSE could be evaluated (class:
no-code-link, compat: 0.30). Worth confirming an open release before broader adoption.Changes
Call site:
AnyFlowPipeline.__call__insrc/diffusers/pipelines/anyflow/pipeline_anyflow.py— the per-step latent is passed throughphase_lock(...)after eachscheduler.stepwhen the optionalphase_lockargument is provided.extract_motion_phase/apply_phase_lock), re-imposing the early-step motion-prior phase on later latents while preserving the magnitude spectrum.phase_lockargument onAnyFlowPipeline.__call__, invoked after eachscheduler.step— so callingpipe(prompt, phase_lock=PhaseLockGuidance(...))exercises it on the production path, with the defaultNonepath left byte-for-byte unchanged.prior_step(the 2-step prior capture point),lock_strength(Latent Delta Guidance fraction),freq_cutoff_ratio(lock only low-frequency motion, leave high-frequency appearance detail untouched), andcutoff_step_ratio(let final steps refine freely).PhaseLockGuidancefromdiffusers.pipelines.anyflow, documents it in the AnyFlow API page with a runnable example, and adds unit + integration tests asserting the spectral guarantees (magnitude preserved, phase steered) and that the guidance measurably alters real pipeline output above the CPU noise floor.Out of scope
AnyFlowPipeline.__call__since the latent-spectrum operation is modality-agnostic and that is the verified call site.prior_step/lock_strength; the user must opt in and choose hyperparameters explicitly.Test plan
Before submitting
Who can review?
@DN6 @yiyixuxu @sayakpaul