|
11 | 11 | from fastvideo.distributed import get_local_torch_device |
12 | 12 | from fastvideo.fastvideo_args import FastVideoArgs |
13 | 13 | from fastvideo.forward_context import set_forward_context |
| 14 | +from fastvideo.profiler import profiler_region |
14 | 15 | from fastvideo.hooks.activation_trace import trace_step |
15 | 16 | from fastvideo.pipelines.basic.minimax_h3.packing import ( |
16 | 17 | MINIMAX_H3_KEYFRAME_NOISE_AUG, |
@@ -132,11 +133,21 @@ def forward(self, batch: ForwardBatch, fastvideo_args: FastVideoArgs) -> Forward |
132 | 133 | text_indices = layout.text_indices.to(device) |
133 | 134 | prompt_embeds = batch.prompt_embeds[0].to(device) |
134 | 135 |
|
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 | + |
138 | 149 | try: |
139 | | - with denoise_region: |
| 150 | + with profiler_region("inference_denoising"): |
140 | 151 | for index, (video_timestep, |
141 | 152 | audio_timestep) in enumerate(zip(video_timesteps, audio_timesteps, strict=True)): |
142 | 153 | unique_timesteps, timestep_indices = row_timestep_plan[index] |
|
0 commit comments