Skip to content

Commit 3ae2c86

Browse files
fix(network): alias skip_layers_start_percent to *_fraction
Adds backward compatibility for the old keyword that was renamed to skip_layers_start_fraction across the Wan, WanI2V, and Cosmos Predict2 samplers. Existing callers passing skip_layers_start_percent will now have it honored instead of silently swallowed by **kwargs. Signed-off-by: Andrew White <andrewh@cdw.com>
1 parent 3106945 commit 3ae2c86

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

fastgen/networks/Wan/network.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,10 +935,15 @@ def sample(
935935
skip_layers (Optional[List[int]]): List of transformer layers to skip (used by SLG) during sampling.
936936
skip_layers_start_fraction (float): Fraction in [0, 1] of the sampling steps to complete
937937
before skip-layer guidance becomes active.
938+
``skip_layers_start_percent`` is accepted as a deprecated alias.
938939
939940
Returns:
940941
torch.Tensor: The sample output.
941942
"""
943+
# Backward compatibility: the old argument name was skip_layers_start_percent.
944+
if "skip_layers_start_percent" in kwargs:
945+
skip_layers_start_fraction = kwargs.pop("skip_layers_start_percent")
946+
942947
assert self.schedule_type == "rf", f"{self.schedule_type} is not supported"
943948

944949
self.unipc_scheduler.config.flow_shift = shift

fastgen/networks/WanI2V/network.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,10 @@ def sample(
352352
For I2V models, the first latent frame must be preserved as the clean
353353
conditioning frame after each scheduler step.
354354
"""
355+
# Backward compatibility: the old argument name was skip_layers_start_percent.
356+
if "skip_layers_start_percent" in kwargs:
357+
skip_layers_start_fraction = kwargs.pop("skip_layers_start_percent")
358+
355359
assert self.schedule_type == "rf", f"{self.schedule_type} is not supported"
356360

357361
# Extract first_frame_cond for replacement after scheduler steps

fastgen/networks/cosmos_predict2/network.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,7 @@ def sample(
11731173
skip_layers: List of transformer layers to skip (for skip-layer guidance).
11741174
skip_layers_start_fraction: Fraction in [0, 1] of the sampling steps to complete
11751175
before skip-layer guidance becomes active.
1176+
``skip_layers_start_percent`` is accepted as a deprecated alias.
11761177
fps: Frames per second tensor for temporal conditioning.
11771178
conditioning_latents: Latent frames to condition on for video2world mode,
11781179
shape (B, C, T, H, W). If provided, enables video2world mode.
@@ -1185,6 +1186,10 @@ def sample(
11851186
Returns:
11861187
The denoised sample tensor.
11871188
"""
1189+
# Backward compatibility: the old argument name was skip_layers_start_percent.
1190+
if "skip_layers_start_percent" in kwargs:
1191+
skip_layers_start_fraction = kwargs.pop("skip_layers_start_percent")
1192+
11881193
assert self.schedule_type == "rf", f"{self.schedule_type} is not supported"
11891194

11901195
# Match official Cosmos Predict2.5 inference: a Karras ramp over [0.01, 200] in

0 commit comments

Comments
 (0)