[misc]: realign blank lines left by the comment sweep

This commit is contained in:
Aryan Kumar
2026-11-10 01:32:33 +00:00
committed by fv-superagent
parent 054149ee3f
commit 74e3061646
29 changed files with 0 additions and 68 deletions
-2
View File
@@ -50,8 +50,6 @@ class AttentionBackend(ABC):
def get_metadata_cls() -> type["AttentionMetadata"]:
raise NotImplementedError
@staticmethod
@abstractmethod
def get_builder_cls() -> type["AttentionMetadataBuilder"]:
-5
View File
@@ -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
@@ -27,7 +27,6 @@ class SageAttentionBackend(AttentionBackend):
return SageAttentionImpl
class SageAttentionImpl(AttentionImpl):
def __init__(
@@ -35,7 +35,6 @@ class SageAttention3Backend(AttentionBackend):
raise NotImplementedError
class SageAttention3Impl(AttentionImpl):
def __init__(
-1
View File
@@ -33,7 +33,6 @@ class SDPABackend(AttentionBackend):
return SDPAImpl
@dataclass
class SDPAMetadata(AttentionMetadata):
current_timestep: int
-3
View File
@@ -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."""
-1
View File
@@ -36,6 +36,5 @@ __all__ = [
"get_tp_group",
"get_tp_rank",
"get_tp_world_size",
"get_local_torch_device",
]
@@ -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
-2
View File
@@ -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.
-4
View File
@@ -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
@@ -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."""
@@ -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__)
@@ -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__)
@@ -13,7 +13,6 @@ from fastvideo.pipelines.stages import (ConditioningStage, DecodingStage, Denois
LatentPreparationStage, TextEncodingStage, TimestepPreparationStage,
Hy15ImageEncodingStage)
logger = init_logger(__name__)
@@ -13,7 +13,6 @@ from fastvideo.pipelines.stages import (ConditioningStage, DecodingStage, Denois
LatentPreparationStage, TextEncodingStage, TimestepPreparationStage,
Hy15ImageEncodingStage)
logger = init_logger(__name__)
@@ -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__)
@@ -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"]:
-7
View File
@@ -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:
-1
View File
@@ -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
@@ -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,
@@ -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.
-1
View File
@@ -71,7 +71,6 @@ class CosmosModel(WanModel):
transformer_override_safetensor=(transformer_override_safetensor),
)
def prepare_batch(
self,
raw_batch: dict[str, Any],
@@ -65,7 +65,6 @@ class HunyuanModel(WanModel):
lora=lora,
)
def prepare_batch(
self,
raw_batch: dict[str, Any],
@@ -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.
@@ -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,
-2
View File
@@ -83,8 +83,6 @@ def make_inference_args(
return args
def load_module_from_path(
*,
model_path: str,
@@ -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"
@@ -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',
-1
View File
@@ -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."""