From 74e30616469e090e06b7a507c662bf5ca59dafe9 Mon Sep 17 00:00:00 2001 From: Aryan Kumar <156166681+aryan5v@users.noreply.github.com> Date: Tue, 10 Nov 2026 01:32:33 +0000 Subject: [PATCH] [misc]: realign blank lines left by the comment sweep --- fastvideo/attention/backends/abstract.py | 2 -- fastvideo/attention/backends/bsa_attn.py | 5 ----- fastvideo/attention/backends/sage_attn.py | 1 - fastvideo/attention/backends/sage_attn3.py | 1 - fastvideo/attention/backends/sdpa.py | 1 - fastvideo/attention/backends/sla.py | 3 --- fastvideo/distributed/__init__.py | 1 - .../device_communicators/pynccl_wrapper.py | 1 - fastvideo/eval/io/inputs.py | 2 -- fastvideo/mlx_runtime/minimax_h3.py | 4 ---- fastvideo/mlx_runtime/minimax_h3_audio_vae.py | 2 -- .../pipelines/basic/hunyuan/hunyuan_pipeline.py | 1 - .../basic/hunyuan15/hunyuan15_2sr_pipeline.py | 1 - .../basic/hunyuan15/hunyuan15_i2v_pipeline.py | 1 - .../basic/hunyuan15/hunyuan15_pipeline.py | 1 - .../basic/hunyuan15/hunyuan15_sr_pipeline.py | 1 - .../matrixgame2/matrixgame2_preprocess_pipeline.py | 1 - fastvideo/train/callbacks/validation.py | 7 ------- fastvideo/train/methods/base.py | 1 - .../train/methods/consistency_model/causal_cd.py | 4 ---- .../train/methods/knowledge_distillation/kd.py | 14 -------------- fastvideo/train/models/cosmos/cosmos.py | 1 - fastvideo/train/models/hunyuan/hunyuan.py | 1 - .../train/models/minimax_h3/minimax_h3_dmd.py | 3 --- .../train/models/minimax_h3/minimax_h3_pdd.py | 2 -- fastvideo/train/utils/moduleloader.py | 2 -- fastvideo/training/cosmos2_5_training_pipeline.py | 2 -- fastvideo/training/distillation_pipeline.py | 1 - fastvideo/worker/gpu_worker.py | 1 - 29 files changed, 68 deletions(-) diff --git a/fastvideo/attention/backends/abstract.py b/fastvideo/attention/backends/abstract.py index 265a99e8f..64c4036f4 100644 --- a/fastvideo/attention/backends/abstract.py +++ b/fastvideo/attention/backends/abstract.py @@ -50,8 +50,6 @@ class AttentionBackend(ABC): def get_metadata_cls() -> type["AttentionMetadata"]: raise NotImplementedError - - @staticmethod @abstractmethod def get_builder_cls() -> type["AttentionMetadataBuilder"]: diff --git a/fastvideo/attention/backends/bsa_attn.py b/fastvideo/attention/backends/bsa_attn.py index cac98ec0b..1ca2f73ec 100644 --- a/fastvideo/attention/backends/bsa_attn.py +++ b/fastvideo/attention/backends/bsa_attn.py @@ -44,7 +44,6 @@ logger = init_logger(__name__) BSA_TILE_SIZE = (4, 4, 4) - @functools.lru_cache(maxsize=10) def get_tile_partition_indices( dit_seq_shape: tuple[int, int, int], @@ -77,8 +76,6 @@ def get_reverse_tile_partition_indices( return torch.argsort(get_tile_partition_indices(dit_seq_shape, tile_size, device)) - - def _prune_queries( q_blocks: torch.Tensor, keep_ratio: float, @@ -530,8 +527,6 @@ def _reconstruct_pruned( return full_output - - class BSAAttentionBackend(AttentionBackend): accept_output_buffer: bool = False diff --git a/fastvideo/attention/backends/sage_attn.py b/fastvideo/attention/backends/sage_attn.py index 904309165..a4993fc40 100644 --- a/fastvideo/attention/backends/sage_attn.py +++ b/fastvideo/attention/backends/sage_attn.py @@ -27,7 +27,6 @@ class SageAttentionBackend(AttentionBackend): return SageAttentionImpl - class SageAttentionImpl(AttentionImpl): def __init__( diff --git a/fastvideo/attention/backends/sage_attn3.py b/fastvideo/attention/backends/sage_attn3.py index b31a1a5aa..671a397ec 100644 --- a/fastvideo/attention/backends/sage_attn3.py +++ b/fastvideo/attention/backends/sage_attn3.py @@ -35,7 +35,6 @@ class SageAttention3Backend(AttentionBackend): raise NotImplementedError - class SageAttention3Impl(AttentionImpl): def __init__( diff --git a/fastvideo/attention/backends/sdpa.py b/fastvideo/attention/backends/sdpa.py index 3811cfa60..d1d1d128e 100644 --- a/fastvideo/attention/backends/sdpa.py +++ b/fastvideo/attention/backends/sdpa.py @@ -33,7 +33,6 @@ class SDPABackend(AttentionBackend): return SDPAImpl - @dataclass class SDPAMetadata(AttentionMetadata): current_timestep: int diff --git a/fastvideo/attention/backends/sla.py b/fastvideo/attention/backends/sla.py index c92151566..d5a419420 100644 --- a/fastvideo/attention/backends/sla.py +++ b/fastvideo/attention/backends/sla.py @@ -35,7 +35,6 @@ from fastvideo.logger import init_logger logger = init_logger(__name__) - @triton.jit def compress_kernel( X, @@ -107,8 +106,6 @@ def get_block_map( return sparse_map, lut, topk - - class SLAAttentionBackend(AttentionBackend): """Sparse-Linear Attention backend.""" diff --git a/fastvideo/distributed/__init__.py b/fastvideo/distributed/__init__.py index 009d5dc78..cccf6a7f4 100644 --- a/fastvideo/distributed/__init__.py +++ b/fastvideo/distributed/__init__.py @@ -36,6 +36,5 @@ __all__ = [ "get_tp_group", "get_tp_rank", "get_tp_world_size", - "get_local_torch_device", ] diff --git a/fastvideo/distributed/device_communicators/pynccl_wrapper.py b/fastvideo/distributed/device_communicators/pynccl_wrapper.py index 21976d306..fdf4e6944 100644 --- a/fastvideo/distributed/device_communicators/pynccl_wrapper.py +++ b/fastvideo/distributed/device_communicators/pynccl_wrapper.py @@ -22,7 +22,6 @@ # changing the environment variable `FASTVIDEO_NCCL_SO_PATH`, or the `so_file` # variable in the code. - import ctypes import platform from dataclasses import dataclass diff --git a/fastvideo/eval/io/inputs.py b/fastvideo/eval/io/inputs.py index fbf9dfc9b..827cac2b2 100644 --- a/fastvideo/eval/io/inputs.py +++ b/fastvideo/eval/io/inputs.py @@ -262,8 +262,6 @@ def samples_from_manifest( return samples - - def _expand(spec: PathSpec, exts: tuple[str, ...]) -> list[Path]: """Resolve a path-style input into a sorted list of file paths. diff --git a/fastvideo/mlx_runtime/minimax_h3.py b/fastvideo/mlx_runtime/minimax_h3.py index 7c5b2e3b1..504c79dae 100644 --- a/fastvideo/mlx_runtime/minimax_h3.py +++ b/fastvideo/mlx_runtime/minimax_h3.py @@ -937,8 +937,6 @@ class MiniMaxH3SchedulerState: return timestep * sample + (1.0 - timestep) * noise - - def _as_mx_indices(indices): """NumPy/python index arrays are not accepted by MLX indexing; convert.""" import mlx.core as mx @@ -1728,8 +1726,6 @@ class MLXMiniMaxH3DiT: __call__ = forward - - def _load_array(array, dtype): import mlx.core as mx diff --git a/fastvideo/mlx_runtime/minimax_h3_audio_vae.py b/fastvideo/mlx_runtime/minimax_h3_audio_vae.py index 771e7f00e..4671bc5c2 100644 --- a/fastvideo/mlx_runtime/minimax_h3_audio_vae.py +++ b/fastvideo/mlx_runtime/minimax_h3_audio_vae.py @@ -235,8 +235,6 @@ def _activation1d(x, alpha, beta, up_filter, down_filter, ratio: int = ACTIVATIO return _low_pass(x, down_filter, ratio) - - class MLXMiniMaxH3AudioVAE: """DAC-style posterior encoder plus BigVGAN waveform decoder.""" diff --git a/fastvideo/pipelines/basic/hunyuan/hunyuan_pipeline.py b/fastvideo/pipelines/basic/hunyuan/hunyuan_pipeline.py index 5013a70d5..8e7501bf4 100644 --- a/fastvideo/pipelines/basic/hunyuan/hunyuan_pipeline.py +++ b/fastvideo/pipelines/basic/hunyuan/hunyuan_pipeline.py @@ -12,7 +12,6 @@ from fastvideo.pipelines.composed_pipeline_base import ComposedPipelineBase from fastvideo.pipelines.stages import (ConditioningStage, DecodingStage, DenoisingStage, InputValidationStage, LatentPreparationStage, TextEncodingStage, TimestepPreparationStage) - logger = init_logger(__name__) diff --git a/fastvideo/pipelines/basic/hunyuan15/hunyuan15_2sr_pipeline.py b/fastvideo/pipelines/basic/hunyuan15/hunyuan15_2sr_pipeline.py index 827f0c4f9..4bb713645 100644 --- a/fastvideo/pipelines/basic/hunyuan15/hunyuan15_2sr_pipeline.py +++ b/fastvideo/pipelines/basic/hunyuan15/hunyuan15_2sr_pipeline.py @@ -16,7 +16,6 @@ from fastvideo.pipelines.stages import (ConditioningStage, DecodingStage, Denois Hy15ImageEncodingStage, SRDenoisingStage) from fastvideo.distributed.parallel_state import get_local_torch_device - logger = init_logger(__name__) diff --git a/fastvideo/pipelines/basic/hunyuan15/hunyuan15_i2v_pipeline.py b/fastvideo/pipelines/basic/hunyuan15/hunyuan15_i2v_pipeline.py index c55c0d1b7..54676e559 100644 --- a/fastvideo/pipelines/basic/hunyuan15/hunyuan15_i2v_pipeline.py +++ b/fastvideo/pipelines/basic/hunyuan15/hunyuan15_i2v_pipeline.py @@ -13,7 +13,6 @@ from fastvideo.pipelines.stages import (ConditioningStage, DecodingStage, Denois LatentPreparationStage, TextEncodingStage, TimestepPreparationStage, Hy15ImageEncodingStage) - logger = init_logger(__name__) diff --git a/fastvideo/pipelines/basic/hunyuan15/hunyuan15_pipeline.py b/fastvideo/pipelines/basic/hunyuan15/hunyuan15_pipeline.py index 86f16c321..6bddd54a5 100644 --- a/fastvideo/pipelines/basic/hunyuan15/hunyuan15_pipeline.py +++ b/fastvideo/pipelines/basic/hunyuan15/hunyuan15_pipeline.py @@ -13,7 +13,6 @@ from fastvideo.pipelines.stages import (ConditioningStage, DecodingStage, Denois LatentPreparationStage, TextEncodingStage, TimestepPreparationStage, Hy15ImageEncodingStage) - logger = init_logger(__name__) diff --git a/fastvideo/pipelines/basic/hunyuan15/hunyuan15_sr_pipeline.py b/fastvideo/pipelines/basic/hunyuan15/hunyuan15_sr_pipeline.py index 580be140e..ea5413551 100644 --- a/fastvideo/pipelines/basic/hunyuan15/hunyuan15_sr_pipeline.py +++ b/fastvideo/pipelines/basic/hunyuan15/hunyuan15_sr_pipeline.py @@ -16,7 +16,6 @@ from fastvideo.pipelines.stages import (ConditioningStage, DecodingStage, Denois Hy15ImageEncodingStage, SRDenoisingStage) from fastvideo.distributed.parallel_state import get_local_torch_device - logger = init_logger(__name__) diff --git a/fastvideo/pipelines/preprocess/matrixgame2/matrixgame2_preprocess_pipeline.py b/fastvideo/pipelines/preprocess/matrixgame2/matrixgame2_preprocess_pipeline.py index 4ade79923..757bd28ab 100644 --- a/fastvideo/pipelines/preprocess/matrixgame2/matrixgame2_preprocess_pipeline.py +++ b/fastvideo/pipelines/preprocess/matrixgame2/matrixgame2_preprocess_pipeline.py @@ -104,7 +104,6 @@ class PreprocessPipeline_MatrixGame2(BasePreprocessPipeline): # mask_lat_size = mask_lat_size.transpose(1, 2) # mask_lat_size = mask_lat_size.to(latent_condition.device) - features["first_frame_latent"] = latent_condition if "action_path" in valid_data and valid_data["action_path"]: diff --git a/fastvideo/train/callbacks/validation.py b/fastvideo/train/callbacks/validation.py index 448fc8a0f..bd0275655 100644 --- a/fastvideo/train/callbacks/validation.py +++ b/fastvideo/train/callbacks/validation.py @@ -236,7 +236,6 @@ class ValidationCallback(Callback): return value.strip().lower() in {"1", "true", "yes", "on"} return bool(value) - def _adopt_training_denoising_ladder( self, method: TrainingMethod, @@ -319,7 +318,6 @@ class ValidationCallback(Callback): self._run_validation(method, iteration) - def _run_validation( self, method: TrainingMethod, @@ -839,7 +837,6 @@ class ValidationCallback(Callback): step, ) - def _metric_device(self) -> str: device = self.metrics_config.device if device == "cuda" and torch.cuda.is_available(): @@ -1170,7 +1167,6 @@ class ValidationCallback(Callback): return -1 return int(self.metrics_config.mouse_pitch_sign) - def _get_sampling_param(self) -> SamplingParam: if self._sampling_param is None: self._sampling_param = (SamplingParam.from_pretrained(self._pipeline_model_path())) @@ -1329,7 +1325,6 @@ class ValidationCallback(Callback): self._pipeline_key = key return self._pipeline - def _prepare_validation_batch( self, sampling_param: SamplingParam, @@ -1450,7 +1445,6 @@ class ValidationCallback(Callback): tensor, ) - def _student_sampling_pipeline_config( self, pipeline_config: Any, @@ -1655,7 +1649,6 @@ class ValidationCallback(Callback): action=action, ) - def state_dict(self) -> dict[str, Any]: state: dict[str, Any] = {} if self.validation_random_generator is not None: diff --git a/fastvideo/train/methods/base.py b/fastvideo/train/methods/base.py index 49c1b4754..c980fa930 100644 --- a/fastvideo/train/methods/base.py +++ b/fastvideo/train/methods/base.py @@ -77,7 +77,6 @@ class TrainingMethod(torch.nn.Module, ABC): if mods: self.role_modules[role] = torch.nn.ModuleDict(mods) - def set_tracker(self, tracker: Any) -> None: self.tracker = tracker diff --git a/fastvideo/train/methods/consistency_model/causal_cd.py b/fastvideo/train/methods/consistency_model/causal_cd.py index 8f974f422..d28193655 100644 --- a/fastvideo/train/methods/consistency_model/causal_cd.py +++ b/fastvideo/train/methods/consistency_model/causal_cd.py @@ -58,7 +58,6 @@ class CausalConsistencyDistillationMethod(TrainingMethod): ) self._init_optimizers_and_schedulers() - @property def _optimizer_dict(self) -> dict[str, Any]: return {"student": self._student_optimizer} @@ -84,7 +83,6 @@ class CausalConsistencyDistillationMethod(TrainingMethod): states["roles.ema.transformer"] = _FullModelState(self.ema_model.transformer) return states - def single_train_step( self, batch: dict[str, Any], @@ -166,7 +164,6 @@ class CausalConsistencyDistillationMethod(TrainingMethod): metrics: dict[str, LogScalar] = {} return loss_map, outputs, metrics - def backward( self, loss_map: dict[str, torch.Tensor], @@ -186,7 +183,6 @@ class CausalConsistencyDistillationMethod(TrainingMethod): if iteration >= self._ema_start_step: self._update_ema() - def _predict_flow( self, model: ModelBase, diff --git a/fastvideo/train/methods/knowledge_distillation/kd.py b/fastvideo/train/methods/knowledge_distillation/kd.py index e7a1ecd97..cdc2e7d4a 100644 --- a/fastvideo/train/methods/knowledge_distillation/kd.py +++ b/fastvideo/train/methods/knowledge_distillation/kd.py @@ -61,7 +61,6 @@ from fastvideo.train.utils.optimizer import build_optimizer_and_scheduler logger = logging.getLogger(__name__) - _COMPLETE_SENTINEL = "COMPLETE" _METADATA_FILE = "metadata.json" @@ -153,8 +152,6 @@ class _KDPathCache: dist.barrier() - - class _KDPathDataset(Dataset): """Reads per-sample ``.pt`` files from a completed KD cache. @@ -181,8 +178,6 @@ class _KDPathDataset(Dataset): return torch.load(path, weights_only=True, map_location="cpu") - - class _KDDataLoaderWrapper: """Wraps the parquet dataloader initially; activates to KD cache after generation. @@ -250,8 +245,6 @@ def _kd_collate(samples: list[dict[str, torch.Tensor]]) -> dict[str, torch.Tenso return {k: torch.stack([s[k] for s in samples]) for k in keys} - - class KDMethod(TrainingMethod): """Knowledge Distillation training method. @@ -335,7 +328,6 @@ class KDMethod(TrainingMethod): # --- Student optimizer / scheduler (same as FineTuneMethod) --- self._init_optimizers_and_schedulers() - @property def _optimizer_dict(self) -> dict[str, Any]: return {"student": self._student_optimizer} @@ -352,7 +344,6 @@ class KDMethod(TrainingMethod): del iteration return [self._student_lr_scheduler] - def on_train_start(self) -> None: super().on_train_start() # sets CUDA RNG, calls student.on_train_start() @@ -440,7 +431,6 @@ class KDMethod(TrainingMethod): for t in self._t_list[:-1]}, ) - def _generate_paths( self, source_dataset: Any, @@ -602,7 +592,6 @@ class KDMethod(TrainingMethod): idx = torch.argmin((timesteps - t).abs()) return sigmas[idx].expand(numel).reshape(numel, 1, 1, 1) - def single_train_step( self, batch: dict[str, Any], @@ -711,7 +700,6 @@ class KDMethod(TrainingMethod): grad_accum_rounds=grad_accum_rounds, ) - def _init_optimizers_and_schedulers(self) -> None: tc = self.training_config student_lr = float(tc.optimizer.learning_rate) @@ -732,8 +720,6 @@ class KDMethod(TrainingMethod): ) - - class KDCausalMethod(KDMethod): """KD for causal Wan: per-frame block-quantized timestep sampling. diff --git a/fastvideo/train/models/cosmos/cosmos.py b/fastvideo/train/models/cosmos/cosmos.py index 89cd4fca9..feefd41d9 100644 --- a/fastvideo/train/models/cosmos/cosmos.py +++ b/fastvideo/train/models/cosmos/cosmos.py @@ -71,7 +71,6 @@ class CosmosModel(WanModel): transformer_override_safetensor=(transformer_override_safetensor), ) - def prepare_batch( self, raw_batch: dict[str, Any], diff --git a/fastvideo/train/models/hunyuan/hunyuan.py b/fastvideo/train/models/hunyuan/hunyuan.py index 48ad4cada..2d31f90fa 100644 --- a/fastvideo/train/models/hunyuan/hunyuan.py +++ b/fastvideo/train/models/hunyuan/hunyuan.py @@ -65,7 +65,6 @@ class HunyuanModel(WanModel): lora=lora, ) - def prepare_batch( self, raw_batch: dict[str, Any], diff --git a/fastvideo/train/models/minimax_h3/minimax_h3_dmd.py b/fastvideo/train/models/minimax_h3/minimax_h3_dmd.py index a37134858..2a1ed72ae 100644 --- a/fastvideo/train/models/minimax_h3/minimax_h3_dmd.py +++ b/fastvideo/train/models/minimax_h3/minimax_h3_dmd.py @@ -199,7 +199,6 @@ class MiniMaxH3DMDModel(MiniMaxH3Model): def num_train_timesteps(self) -> int: return _DMD_TIMESTEP_SCALE - def _modality_shapes(self) -> tuple[tuple[int, int, int, int, int], tuple[int, int, int, int]]: """Return the ``[1, T, C, H, W]`` video and ``[1, 2, 32, Ta]`` audio shapes.""" data = self.training_config.data @@ -360,7 +359,6 @@ class MiniMaxH3DMDModel(MiniMaxH3Model): ), ) - def set_requires_negative_conditioning(self, requires: bool) -> None: """Fail fast: H3 cannot encode negative prompts at training time.""" if requires: @@ -725,7 +723,6 @@ class MiniMaxH3DMDModel(MiniMaxH3Model): sigma_fp64 = sigma.to(device=noisy.device, dtype=torch.float64) return (noisy_fp64 - sigma_fp64 * pred_noise_fp64).to(original_dtype) - def _load_vis_vae(self) -> Any: """Lazily load the H3 video VAE for visualization decodes. diff --git a/fastvideo/train/models/minimax_h3/minimax_h3_pdd.py b/fastvideo/train/models/minimax_h3/minimax_h3_pdd.py index 034c11343..92508a82c 100644 --- a/fastvideo/train/models/minimax_h3/minimax_h3_pdd.py +++ b/fastvideo/train/models/minimax_h3/minimax_h3_pdd.py @@ -73,7 +73,6 @@ class MiniMaxH3PDDMixin(_PDDMixinHost): """Only this role widens its heads; the shared pipeline config stays single-head.""" return {"pdd_steps": self.pdd_steps} - def pdd_fine_grid(self, device: torch.device) -> torch.Tensor: return pdd_fine_grid(self.pdd_steps, max_t=PDD_GRID_MAX_T, device=device) @@ -99,7 +98,6 @@ class MiniMaxH3PDDMixin(_PDDMixinHost): raise ValueError("MiniMaxH3PDDModel packs one document per batch; every sample must share a base time") return base * _DMD_TIMESTEP_SCALE - def predict_pdd_heads( self, state: torch.Tensor, diff --git a/fastvideo/train/utils/moduleloader.py b/fastvideo/train/utils/moduleloader.py index 4475bc590..16bda5634 100644 --- a/fastvideo/train/utils/moduleloader.py +++ b/fastvideo/train/utils/moduleloader.py @@ -83,8 +83,6 @@ def make_inference_args( return args - - def load_module_from_path( *, model_path: str, diff --git a/fastvideo/training/cosmos2_5_training_pipeline.py b/fastvideo/training/cosmos2_5_training_pipeline.py index 3fbde9f05..61a409c6a 100644 --- a/fastvideo/training/cosmos2_5_training_pipeline.py +++ b/fastvideo/training/cosmos2_5_training_pipeline.py @@ -60,7 +60,6 @@ class Cosmos25TrainingPipeline(TrainingPipeline): ) self.validation_pipeline = validation_pipeline - def _normalize_dit_input(self, training_batch: TrainingBatch) -> TrainingBatch: """Skip: Cosmos25WanVAEWrapper normalises latents during encoding. @@ -126,7 +125,6 @@ class Cosmos25TrainingPipeline(TrainingPipeline): return training_batch - if __name__ == "__main__": logger.warning("\n" "================================================================================\n" diff --git a/fastvideo/training/distillation_pipeline.py b/fastvideo/training/distillation_pipeline.py index d5f888b8e..77b61868c 100644 --- a/fastvideo/training/distillation_pipeline.py +++ b/fastvideo/training/distillation_pipeline.py @@ -998,7 +998,6 @@ class DistillationPipeline(TrainingPipeline): sampling_param = SamplingParam.from_pretrained(training_args.model_path) - logger.info("Using validation seed: %s", self.seed) logger.info('rank: %s: fastvideo_args.validation_dataset_file: %s', diff --git a/fastvideo/worker/gpu_worker.py b/fastvideo/worker/gpu_worker.py index 0045a511a..7f62b5364 100644 --- a/fastvideo/worker/gpu_worker.py +++ b/fastvideo/worker/gpu_worker.py @@ -69,7 +69,6 @@ class Worker: self.rank = rank self.distributed_init_method = distributed_init_method - def init_device(self) -> None: """Initialize the device for the worker."""