Skip to content

test_config

CPU-only unit tests for :func:load_run_config.

Classes

Functions

fastvideo.tests.train.utils.test_config.test_hsdp_shard_dim_defaults_to_num_gpus

test_hsdp_shard_dim_defaults_to_num_gpus(tmp_path: Path) -> None

When unset, hsdp_shard_dim and sp_size fall back to num_gpus.

Source code in fastvideo/tests/train/utils/test_config.py
def test_hsdp_shard_dim_defaults_to_num_gpus(tmp_path: Path) -> None:
    """When unset, hsdp_shard_dim and sp_size fall back to num_gpus."""
    data = _minimal_yaml()
    data["training"] = {"distributed": {"num_gpus": 4}}
    cfg = load_run_config(_write_yaml(tmp_path, data))
    assert cfg.training.distributed.hsdp_shard_dim == 4
    assert cfg.training.distributed.sp_size == 4

fastvideo.tests.train.utils.test_config.test_overrides_create_intermediate_keys

test_overrides_create_intermediate_keys(tmp_path: Path) -> None

Overrides into a nested key absent from YAML should still apply.

Source code in fastvideo/tests/train/utils/test_config.py
def test_overrides_create_intermediate_keys(tmp_path: Path) -> None:
    """Overrides into a nested key absent from YAML should still apply."""
    data = _minimal_yaml()
    # No `training.checkpoint` block in the minimal YAML.
    path = _write_yaml(tmp_path, data)
    cfg = load_run_config(
        path,
        overrides=["--training.checkpoint.checkpoints_total_limit=5"],
    )
    assert cfg.training.checkpoint.checkpoints_total_limit == 5