Files
Davids048andClaude Fable 5.1 a5aa64ab6b [refactor]: decide every config value before the config freezes, and drop the from_pretrained keywords
VideoGenerator.from_pretrained(model_path, config) takes the same nested
settings as from_config; the 24 flat keywords, from_pretrained_kwargs_to_config,
FROM_PRETRAINED_KWARGS, and every flat_field in the schema are deleted.
nvfp4_fa4 is the typed field engine.attention.nvfp4_fa4, applied by a
resolution step. 65 call sites and the docs use the nested form; the three
kwargs golden cases are config cases with byte-identical results.

Every value is decided during resolution; no runtime code calls
with_override. The device offload policy (unified memory, MPS, layerwise
conflicts, lazy module load) runs as resolution steps in the main process
(fastvideo/api/device_policy.py), and the worker runs on the config it
receives. The LTX-2 refine defaults from model_index.json and the MiniMax-H3
schedule from fastvideo_inference.json are resolution steps
(fastvideo/api/checkpoint_defaults.py) that read local checkpoints or download
only those files; the H3 pipeline validates the schedule against the loaded
schedulers but no longer writes it. The preprocessing entry point passes the
downloaded local path as run state instead of a config override. Teacher and
critic models load with override_transformer_cls_name as a load argument.
The test isolation turns the device policy off, as it blocks downloads, so
that the goldens do not depend on the machine.

Against the 3f6893a0 goldens, every field still matches except boundary_ratio
and ltx2_vae_tiling (DESIGN section 9) and the fields that no longer exist.
The launcher and trainer YAML verifications report 0 unexplained differences.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-04 07:14:31 +00:00

59 lines
2.6 KiB
Python

# SPDX-License-Identifier: Apache-2.0
from torchvision import transforms
from torchvision.transforms import Lambda
from fastvideo.dataset.parquet_dataset_map_style import (build_parquet_map_style_dataloader)
from fastvideo.dataset.ltx2_precomputed_dataset import (build_ltx2_precomputed_dataloader, LTX2PrecomputedDataset)
from fastvideo.dataset.preprocessing_datasets import VideoCaptionMergedDataset, TextDataset
from fastvideo.dataset.transform import (CenterCropResizeVideo, Normalize255, TemporalRandomCrop)
from fastvideo.dataset.validation_dataset import ValidationDataset
def getdataset(preprocess_config, model_path: str) -> VideoCaptionMergedDataset:
"""Build the video-caption dataset of ``preprocess_config``, the ``preprocess`` section of a resolved
``PreprocessRunConfig``. ``model_path`` is the local checkpoint directory that holds the tokenizer."""
temporal_sample = (TemporalRandomCrop(preprocess_config.num_frames)
if preprocess_config.do_temporal_sample else None) # 16 x
norm_fun = Lambda(lambda x: 2.0 * x - 1.0)
resize_topcrop = [
CenterCropResizeVideo((preprocess_config.max_height, preprocess_config.max_width), top_crop=True),
]
resize = [
CenterCropResizeVideo((preprocess_config.max_height, preprocess_config.max_width)),
]
transform = transforms.Compose([
# Normalize255(),
*resize,
])
transform_topcrop = transforms.Compose([
Normalize255(),
*resize_topcrop,
norm_fun,
])
return VideoCaptionMergedDataset(data_merge_path=preprocess_config.data_merge_path,
preprocess_config=preprocess_config,
model_path=model_path,
transform=transform,
temporal_sample=temporal_sample,
transform_topcrop=transform_topcrop,
seed=preprocess_config.seed)
def gettextdataset(preprocess_config, model_path: str) -> TextDataset:
"""Build the text dataset of ``preprocess_config``; ``model_path`` is the local checkpoint directory that holds
the tokenizer."""
return TextDataset(data_merge_path=preprocess_config.data_merge_path,
preprocess_config=preprocess_config,
model_path=model_path,
seed=preprocess_config.seed)
__all__ = [
"build_parquet_map_style_dataloader",
"build_ltx2_precomputed_dataloader",
"LTX2PrecomputedDataset",
"ValidationDataset",
"VideoCaptionMergedDataset",
"TextDataset",
]