Compare commits

...
Author SHA1 Message Date
SolitaryThinker 2e86723151 [bugfix]: include PNGs in SSIM reference tooling 2026-07-14 01:59:47 -07:00
3 changed files with 19 additions and 3 deletions
+3 -3
View File
@@ -18,7 +18,7 @@ VIDEO_EXTENSIONS = (".mp4", ".avi", ".mov", ".mkv", ".webm", ".flv")
# pixel-space models (e.g. LTX-2 distilled). Keeping them in the same upload
# flow means seeding a new test only requires one HF round-trip.
LATENT_EXTENSIONS = (".pt",)
REFERENCE_EXTENSIONS = VIDEO_EXTENSIONS + LATENT_EXTENSIONS
REFERENCE_EXTENSIONS = VIDEO_EXTENSIONS + LATENT_EXTENSIONS + (".png",)
HF_TOKEN_ENV_KEYS = ("HF_API_KEY", "HUGGINGFACE_HUB_TOKEN", "HF_TOKEN")
HF_REPO_ENV_KEY = "FASTVIDEO_SSIM_REFERENCE_HF_REPO"
HF_REPO_TYPE_ENV_KEY = "FASTVIDEO_SSIM_REFERENCE_HF_REPO_TYPE"
@@ -51,10 +51,10 @@ def _default_repo_type() -> str:
def _iter_reference_files(root: Path) -> Iterable[Path]:
"""Yield video and latent (.pt) references under `root`.
"""Yield supported references under `root`.
Used by copy-local and the "has local references" marker probe so that
latent-only tests (no mp4) still satisfy readiness checks.
image- and latent-only tests (no mp4) still satisfy readiness checks.
"""
for path in root.rglob("*"):
if path.is_file() and path.suffix.lower() in REFERENCE_EXTENSIONS:
@@ -44,6 +44,22 @@ def _fake_snapshot_download(*, allow_patterns, cache_dir, **_kwargs):
return str(snapshot_root)
def test_png_references_are_copied_and_mark_local_cache_ready(tmp_path):
generated_dir = tmp_path / "generated"
generated = generated_dir / "model-a" / "flash" / "sample.png"
generated.parent.mkdir(parents=True)
generated.write_bytes(b"image")
reference_dir = tmp_path / "reference_videos" / "default" / "L40S_reference_videos"
assert reference_videos_cli.copy_generated_to_reference(
generated_dir,
reference_dir,
) == 1
marker = reference_dir.parent / ".download_complete_default"
marker.touch()
assert reference_videos_cli._has_local_reference_videos(tmp_path, "default")
@pytest.fixture(autouse=True)
def _fake_hf(monkeypatch):
_FakeHfApi.instances = []