Cosmos3 action policy improvements (#6460)
Signed-off-by: Maciej Bala <mbala@nvidia.com> Signed-off-by: MaciejBalaNV <mbala@nvidia.com> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
1 parent
c8bef008eb
commit
05ab509269
21 files changed
+863
-105
No files matched your search
@@ -197,6 +197,25 @@ class TestStageConfig:
|
||||
omega_config = config.to_omegaconf()
|
||||
assert omega_config.engine_args.max_num_seqs == 32
|
||||
|
||||
def test_to_omegaconf_dict_override_deep_merges_yaml_dict(self):
|
||||
"""A partial dict CLI override (e.g. --no-guardrails riding on
|
||||
model_config) must layer onto the YAML dict, not clobber siblings."""
|
||||
config = StageConfig(
|
||||
stage_id=0,
|
||||
model_stage="diffusion",
|
||||
stage_type=StageType.DIFFUSION,
|
||||
yaml_engine_args={
|
||||
"model_config": {
|
||||
"guardrails": True,
|
||||
"policy_server_config": {"action_space": "joint_position"},
|
||||
}
|
||||
},
|
||||
runtime_overrides={"model_config": {"guardrails": False}},
|
||||
)
|
||||
omega_config = config.to_omegaconf()
|
||||
assert omega_config.engine_args.model_config.guardrails is False
|
||||
assert omega_config.engine_args.model_config.policy_server_config.action_space == "joint_position"
|
||||
|
||||
def test_to_omegaconf_diffusion_parallel_overrides_replace_nested_values(self):
|
||||
config = StageConfig(
|
||||
stage_id=1,
|
||||
@@ -623,6 +642,58 @@ class TestPipelineDiscovery:
|
||||
assert p.hf_architectures == ("SomeCollidingArch",)
|
||||
|
||||
|
||||
class TestCosmos3PolicyPipeline:
|
||||
"""Cosmos3 policy serving resolves via deploy yaml selection (π0 precedent)."""
|
||||
|
||||
def test_registered_without_capturing_base_cosmos3_checkpoints(self):
|
||||
assert "cosmos3_policy" in OMNI_PIPELINES
|
||||
# T2I/video Cosmos3 checkpoints report model_type=cosmos3_omni and the
|
||||
# same model_index.json _class_name as policy checkpoints; they must
|
||||
# keep resolving through the single-stage diffusion fallback, so the
|
||||
# policy pipeline must not be reachable by auto-detection.
|
||||
assert "cosmos3_omni" not in OMNI_PIPELINES
|
||||
pipeline = OMNI_PIPELINES["cosmos3_policy"]
|
||||
assert pipeline.hf_architectures == ()
|
||||
assert pipeline.diffusers_class_name is None
|
||||
|
||||
def test_droid_deploy_yaml_carries_policy_server_config(self):
|
||||
deploy = load_deploy_config(get_deploy_config_path("cosmos3_policy_droid.yaml"))
|
||||
assert deploy.pipeline == "cosmos3_policy"
|
||||
|
||||
stages = merge_pipeline_deploy(OMNI_PIPELINES["cosmos3_policy"], deploy)
|
||||
assert len(stages) == 1
|
||||
stage = stages[0].to_omegaconf()
|
||||
|
||||
assert stage.stage_type == "diffusion"
|
||||
assert stage.final_output_type == "action"
|
||||
assert stage.engine_args.model_class_name == "Cosmos3OmniDiffusersPipeline"
|
||||
# OpenPI websocket handshake metadata must reach the serving layer via
|
||||
# engine_args.model_config (ServingRealtimeRobotOpenPI reads it there).
|
||||
psc = stage.engine_args.model_config.policy_server_config
|
||||
assert list(psc.image_resolution) == [540, 640]
|
||||
assert psc.n_external_cameras == 2
|
||||
assert psc.needs_wrist_camera is True
|
||||
assert psc.needs_stereo_camera is False
|
||||
assert psc.needs_session_id is True
|
||||
assert psc.action_space == "joint_position"
|
||||
# The DROID checkpoint's training recipe expects JSON-formatted prompts.
|
||||
assert stage.default_sampling_params.extra_args.format_prompt_as_json is True
|
||||
|
||||
def test_no_guardrails_cli_flag_keeps_policy_server_config(self):
|
||||
"""--no-guardrails becomes a partial model_config CLI override; it must
|
||||
deep-merge with the deploy yaml's model_config, not clobber the
|
||||
policy_server_config the OpenPI handshake depends on."""
|
||||
deploy = load_deploy_config(get_deploy_config_path("cosmos3_policy_droid.yaml"))
|
||||
stages, _ = StageConfigFactory._create_legacy_from_registry(
|
||||
OMNI_PIPELINES["cosmos3_policy"],
|
||||
{"model_config": {"guardrails": False}},
|
||||
user_deploy_config=deploy,
|
||||
)
|
||||
stage = stages[0].to_omegaconf()
|
||||
assert stage.engine_args.model_config.guardrails is False
|
||||
assert stage.engine_args.model_config.policy_server_config.action_space == "joint_position"
|
||||
|
||||
|
||||
class TestStagePipelineConfig:
|
||||
def test_frozen(self):
|
||||
s = StagePipelineConfig(stage_id=0, model_stage="a")
|
||||
|
||||
Reference in new issue
Block a user