Skip to content

fix(wan-audio): restore the phase argument at the three multi-line _apply_rope_with_cache_range call sites - #1460

Open
Anai-Guo wants to merge 1 commit into
ModelTC:mainfrom
Anai-Guo:fix-audio-rope-phase-arg
Open

fix(wan-audio): restore the phase argument at the three multi-line _apply_rope_with_cache_range call sites#1460
Anai-Guo wants to merge 1 commit into
ModelTC:mainfrom
Anai-Guo:fix-audio-rope-phase-arg

Conversation

@Anai-Guo

Copy link
Copy Markdown

What

WanAudioARTransformerInfer.infer_self_attn_with_kvcache calls
self._apply_rope_with_cache_range(...) in five places. Three of them are missing the
phase argument, so they raise:

TypeError: _apply_rope_with_cache_range() missing 1 required positional argument: 'local_per_frame'

Why it happened

#1238 "[refactor]: rope as module" added phase
as the first parameter of the method (the body now needs it for phase.causal_rope.apply_audio_cache):

     def _apply_rope_with_cache_range(
         self,
+        phase,
         x,
         freqs,

The same commit updated the two call sites that fit on one line:

-                q_rope = self._apply_rope_with_cache_range(q, freqs, h, w, 1, 0, ...)
-                k_rope = self._apply_rope_with_cache_range(k, freqs, h, w, 1, 0, ...)
+                q_rope = self._apply_rope_with_cache_range(phase, q, freqs, h, w, 1, 0, ...)
+                k_rope = self._apply_rope_with_cache_range(phase, k, freqs, h, w, 1, 0, ...)

but the three call sites in the same method that are formatted across multiple lines
(:406, :434, :448) were left as they were. They still pass the tensor first, which
lands in the phase slot and shifts every remaining argument by one.

Impact

:434 and :448 are in the non-seq_parallel branch — i.e. the plain single-GPU
Seko-AR audio path — so it fails on the first block, every run. :406 is the
seq_parallel and not replicated_ref_prefill + use_local_cache_rope branch.

Verification

No runtime here (no GPU), so I replayed the binding statically: parse the file, build a
stub from the real ast.arguments of the definition, and inspect.Signature.bind each of
the five call sites — with the two known-good sites as the control group.

Before:

line  353: OK   (11 pos)          <- updated by #1238
line  354: OK   (11 pos)          <- updated by #1238
line  406: FAIL -> TypeError: missing a required argument: 'local_per_frame'
line  434: FAIL -> TypeError: missing a required argument: 'local_per_frame'
line  448: FAIL -> TypeError: missing a required argument: 'local_per_frame'

After this patch all five bind cleanly. phase is already the first parameter of the
enclosing infer_self_attn_with_kvcache, so it is in scope at each site — this is purely
restoring the argument the refactor intended.

ruff check and ruff format --check (pinned v0.11.0, repo pyproject.toml) pass.

🤖 Generated with Claude Code

…ee multi-line call sites

PR ModelTC#1238 ("[refactor]: rope as module") added `phase` as the first parameter of
WanAudioARTransformerInfer._apply_rope_with_cache_range and updated the two
single-line call sites, but the three call sites written across multiple lines
were missed. They still start the argument list with the tensor, so each one
raises:

    TypeError: _apply_rope_with_cache_range() missing 1 required positional
    argument: 'local_per_frame'

Signed-off-by: Anai-Guo <antai12232931@outlook.com>
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.

1 participant