[fix]: disambiguate Cosmos3 registry detection

This commit is contained in:
SolitaryThinker
2026-07-21 15:45:38 -07:00
parent a913c7dd46
commit f046b85db3
2 changed files with 20 additions and 2 deletions
+3 -2
View File
@@ -881,8 +881,9 @@ def _register_configs() -> None:
"nvidia/Cosmos-Predict2-2B-Video2World",
],
model_detectors=[
lambda path: "cosmos" in path.lower() and ("2.5" not in path.lower() and "2_5" not in path.lower() and "25"
not in path.lower() and "gen3c" not in path.lower()),
lambda path: "cosmos" in path.lower() and
("2.5" not in path.lower() and "2_5" not in path.lower() and "25" not in path.lower() and "gen3c" not in
path.lower() and "cosmos3" not in path.lower() and "cosmos-3" not in path.lower()),
],
model_family="cosmos",
default_preset="cosmos_predict2_2b",
@@ -128,3 +128,20 @@ def test_cosmos3_registry_exposes_both_video_workloads() -> None:
for workload in ("t2v", "i2v"):
registered = get_registered_models_with_workloads(workload)
assert any(model["id"] == "nvidia/Cosmos3-Nano" for model in registered)
def test_cosmos3_local_snapshot_registry_is_unambiguous(tmp_path: Path, caplog: pytest.LogCaptureFixture) -> None:
from fastvideo.registry import get_preset_selection
model_dir = tmp_path / "snapshot"
(model_dir / "transformer").mkdir(parents=True)
(model_dir / "model_index.json").write_text(
json.dumps({
"_class_name": "Cosmos3OmniDiffusersPipeline",
"_diffusers_version": "0.39.0",
}),
encoding="utf-8",
)
assert get_preset_selection(str(model_dir)) == ("cosmos3_nano", "cosmos3")
assert "Multiple models matched" not in caplog.text