Skip to content

Commit 86452d9

Browse files
committed
pre-commit
1 parent db76ae3 commit 86452d9

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

fastvideo/pipelines/basic/minimax_h3/stages/minimax_h3_denoising.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from fastvideo.distributed import get_local_torch_device
1212
from fastvideo.fastvideo_args import FastVideoArgs
1313
from fastvideo.forward_context import set_forward_context
14+
from fastvideo.profiler import profiler_region
1415
from fastvideo.hooks.activation_trace import trace_step
1516
from fastvideo.pipelines.basic.minimax_h3.packing import (
1617
MINIMAX_H3_KEYFRAME_NOISE_AUG,
@@ -132,11 +133,21 @@ def forward(self, batch: ForwardBatch, fastvideo_args: FastVideoArgs) -> Forward
132133
text_indices = layout.text_indices.to(device)
133134
prompt_embeds = batch.prompt_embeds[0].to(device)
134135

135-
controller = get_global_controller()
136-
denoise_region = (controller.region("profiler_region_inference_denoising")
137-
if controller is not None else contextlib.nullcontext())
136+
vsa_metadata_builder = _h3_vsa_metadata_builder(self.transformer, fastvideo_args)
137+
if vsa_metadata_builder is not None:
138+
vsa_patch_size = fastvideo_args.pipeline_config.dit_config.patch_size
139+
vsa_prefix_segments = _h3_vsa_prefix_segments(layout, vsa_patch_size)
140+
# Per-request knobs (sweeps flip these between generate_video calls
141+
# without respawning workers); mode None defers to the env default.
142+
vsa_mode = batch.extra.get("vsa_mode", "exempt")
143+
if vsa_mode not in ("exempt", "compete"):
144+
raise ValueError(f"vsa_mode must be 'exempt' or 'compete', got {vsa_mode!r}.")
145+
vsa_exempt = vsa_mode == "exempt"
146+
vsa_dense_layers = tuple(batch.extra.get("vsa_dense_layers", ()))
147+
vsa_dense_first_n = int(batch.extra.get("vsa_dense_first_n_steps", 0))
148+
138149
try:
139-
with denoise_region:
150+
with profiler_region("inference_denoising"):
140151
for index, (video_timestep,
141152
audio_timestep) in enumerate(zip(video_timesteps, audio_timesteps, strict=True)):
142153
unique_timesteps, timestep_indices = row_timestep_plan[index]

0 commit comments

Comments
 (0)