diff --git a/.agents/skills/reseed-performance-baseline/SKILL.md b/.agents/skills/reseed-performance-baseline/SKILL.md index e2e54904d..e996e803c 100644 --- a/.agents/skills/reseed-performance-baseline/SKILL.md +++ b/.agents/skills/reseed-performance-baseline/SKILL.md @@ -279,7 +279,7 @@ records = load_records_for_model( For v2 exact-identity targets: ```python -from hf_store import load_records_for_identity +from fastvideo.performance.hf_store import load_records_for_identity records = load_records_for_identity( "/tmp/perf-tracking", diff --git a/fastvideo/performance/hf_store.py b/fastvideo/performance/hf_store.py index 86225cba7..561f33b07 100644 --- a/fastvideo/performance/hf_store.py +++ b/fastvideo/performance/hf_store.py @@ -259,13 +259,12 @@ def load_records( if baseline_eligible_only and not is_baseline_eligible_record(data): continue - if cutoff is not None: - ts = _parse_record_timestamp(data) - if ts is not None and ts < cutoff: - continue + ts = _parse_record_timestamp(data) + if cutoff is not None and ts is not None and ts < cutoff: + continue records.append(( - _parse_record_timestamp(data) or datetime.min.replace(tzinfo=timezone.utc), + ts or datetime.min.replace(tzinfo=timezone.utc), path, data, )) diff --git a/fastvideo/tests/performance/test_inference_performance.py b/fastvideo/tests/performance/test_inference_performance.py index a2c2978ff..33676ec09 100644 --- a/fastvideo/tests/performance/test_inference_performance.py +++ b/fastvideo/tests/performance/test_inference_performance.py @@ -348,7 +348,8 @@ def _build_identity_fields(cfg, init_kwargs, prompt, runtime_identity): resolved_model_revision=runtime_identity.get("resolved_model_revision"), measured_prompts=[prompt], ) - num_gpus = init_kwargs.get("num_gpus", cfg.get("run_config", {}).get("required_gpus", 1)) + run_config = cfg.get("run_config") or {} + num_gpus = init_kwargs.get("num_gpus", run_config.get("required_gpus", 1)) hw_profile = hardware_profile(num_gpus=num_gpus) sw_profile = software_profile() env_metadata = environment_metadata( @@ -466,7 +467,7 @@ def _build_result_record( # -- Test ------------------------------------------------------------------- def _run_benchmark(cfg): - run_config = cfg.get("run_config", {}) + run_config = cfg.get("run_config") or {} required_gpus = run_config.get("required_gpus", 1) available = torch.cuda.device_count() if available < required_gpus: diff --git a/fastvideo/tests/performance/test_inference_performance_identity.py b/fastvideo/tests/performance/test_inference_performance_identity.py index 921d8af06..360e1d352 100644 --- a/fastvideo/tests/performance/test_inference_performance_identity.py +++ b/fastvideo/tests/performance/test_inference_performance_identity.py @@ -95,6 +95,23 @@ def test_performance_producer_emits_v2_identity_from_raw_result_shape(monkeypatc assert "output_path" not in record["recipe"]["generation_kwargs"] +def test_v2_identity_tolerates_null_run_config(monkeypatch): + monkeypatch.setenv("FASTVIDEO_ATTENTION_BACKEND", "FLASH_ATTN") + cfg = _benchmark_config() + cfg["run_config"] = None + init_kwargs = dict(cfg["init_kwargs"]) + + identity_fields = perf._build_v2_identity_fields( + cfg, + init_kwargs, + dict(cfg["generation_kwargs"]), + "A cinematic video.", + "NVIDIA L40S PCIe", + ) + + assert identity_fields["hardware_profile"]["gpu_count"] == 2 + + def test_software_profile_tracks_exact_runtime_attention_kernel_and_container_versions(monkeypatch): package_versions = { "triton": "3.2.1",