Skip to content

Commit fc5017b

Browse files
author
Xiangyu Lu
committed
Allow config aliases as public targets
1 parent efb5f75 commit fc5017b

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

cosmos_framework/inference/common/public_model_config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
"projects.cosmos3.vfm.configs.base.defaults.vlm.VLMConfig": "vlm_config",
4242
}
4343

44+
# Config objects can be serialized as either `_type` or `_target_` depending on
45+
# whether they came from structured config metadata or LazyCall construction.
46+
_TARGET_ALIASES.update(_TYPE_ALIASES)
47+
4448
_ALIAS_TARGETS = {alias: target for target, alias in _TARGET_ALIASES.items()}
4549
_ALIAS_TYPES = {alias: target for target, alias in _TYPE_ALIASES.items()}
4650

cosmos_framework/inference/common/public_model_config_test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ def test_public_model_config_round_trip_removes_internal_metadata():
2828
"_type": "cosmos_framework.configs.base.defaults.activation_checkpointing.ActivationCheckpointingConfig",
2929
"mode": "full",
3030
},
31+
"compile": {
32+
"_target_": "cosmos_framework.configs.base.defaults.compile.CompileConfig",
33+
"enabled": False,
34+
},
3135
"tokenizer": {
3236
"_target_": "cosmos_framework.model.vfm.tokenizers.wan2pt2_vae_4x16x16.Wan2pt2VAEInterface",
3337
"vae_path": "pretrained/tokenizers/video/wan2pt2/Wan2.2_VAE.pth",
@@ -56,6 +60,7 @@ def test_public_model_config_round_trip_removes_internal_metadata():
5660
assert not _has_key(public_model_config, "config_name")
5761
assert public_model_config["_target"] == "omni_mot_model"
5862
assert public_model_config["config"]["_type"] == "omni_mot_model_config"
63+
assert public_model_config["config"]["compile"]["_target"] == "compile_config"
5964
assert "projects.cosmos3" not in text
6065
assert "projects/cosmos3" not in text
6166
assert "cosmos3._src" not in text

0 commit comments

Comments
 (0)