Repository navigation
Conversation
TaylorSeer, Ada, Custom, FirstBlock, DualBlock and DynamicBlock still defined infer(weights, grid_sizes, embed, x, embed0, seq_lens, freqs, context) and called infer_modulation(), which no longer exists. WanModel calls transformer_infer.infer(weights, pre_infer_out), so all six crashed on the first step with "infer() missing 6 required positional arguments". Override infer_main_blocks(blocks, pre_infer_out) like the Tea and Mag modes do, and use the current block API: pre_process() on the self-attention phase's modulation, compute_phases[0..2], and post_process() with pre_infer_out. Custom reuses super().infer_main_blocks, so it keeps the offload path. FirstBlock, DualBlock and DynamicBlock run block ranges through a shared infer_block_range helper. The Taylor and DynamicBlock helpers that shadowed infer_block are renamed. The caching decisions and math are unchanged. Fixes ModelTC#466 Fixes ModelTC#738 Signed-off-by: Lin, KuanTing <Kuanting.Lin@amd.com>
klin-amd
marked this pull request as ready for review
November 15, 2026 06:49
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.
Fixes #466, fixes #738.
Problem
Six of the eight Wan feature-caching modes crash on the first DiT step:
TaylorSeer,Ada,Custom,FirstBlock,DualBlockandDynamicBlockinlightx2v/models/networks/wan/infer/feature_caching/transformer_infer.pystill define the oldinfer(weights, grid_sizes, embed, x, embed0, seq_lens, freqs, context).TaylorSeer,AdaandCustomalso callinfer_modulation(), which no longer exists, andFirstBlock,DualBlockandDynamicBlockcallinfer_block()with its old arguments.WanModelnow callstransformer_infer.infer(weights, pre_infer_out).TeaandMagalready use the current API and work.Fix
infer_main_blocks(blocks, pre_infer_out), asTeaandMagdo.pre_process()on the self-attention phase's modulation,compute_phases[0..2], andpost_process(..., pre_infer_out).Customreusessuper().infer_main_blocks, so it keeps the offload path.FirstBlock,DualBlockandDynamicBlockrun block ranges through a sharedinfer_block_rangehelper.The caching decisions are unchanged. Gates use
.squeeze()like the base block; with TI2V's per-token timesteps.squeeze(0)would broadcast to the wrong shape.Test
The Wan2.1 T2V 1.3B config of each mode under
configs/caching/, unchanged (480x832, 81 frames, 50 steps, seed 42), one H100, compared with the same config set toNoCaching.The setups of the linked issues, same seed, one H100:
configs/caching/adacache/wan_i2v_ada.json,img_0.jpg, the issue's promptinfer_modulationerror on older code)configs/wan22/wan_ti2v.json+Ada, t2v and i2vTypeError: ...infer() missing 6 required positional argumentsTaylorSeerTaylorSeer's out-of-memory at the official TI2V size and its degraded t2v output at 480x832 come from its cache size and schedule, which this PR does not change; with every step computed it matches NoCaching exactly.
All outputs in the first table are coherent videos. With the shipped thresholds DualBlock skips no step and DynamicBlock no block; with lower thresholds both run their cached branch (DualBlock 0.04: DiT 37.3 s, PSNR 15.8 dB, coherent; DynamicBlock 0.01: 34.0 s, visibly degraded, same skip logic as before). Ada, FirstBlock, DualBlock and DynamicBlock decide from rank-local tensors, so under sequence parallel ranks could in principle decide differently; Ada and FirstBlock ran to completion under Ulysses SP2.
pre-commit runpasses on the changed file.