[Config] Return VllmOmniConfig from create_from_model (#4818)
Signed-off-by: zwhzzz0821 <2831474076@qq.com> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
1 parent
907f932b72
commit
793d3e9ab7
56 files changed
+865
-282
No files matched your search
@@ -355,6 +355,7 @@ def test_resolve_stage_configs_injects_additional_config_into_diffusion_stage(mo
|
||||
"stage_configs_path": "dummy.yaml",
|
||||
"additional_config": {"torchair_graph_config": {"enabled": True}},
|
||||
},
|
||||
trust_remote_code=False,
|
||||
)
|
||||
|
||||
assert not hasattr(stage_configs[0].engine_args, "additional_config")
|
||||
@@ -392,6 +393,7 @@ def test_resolve_stage_configs_injects_quantization_config_into_diffusion_stage(
|
||||
"stage_configs_path": "dummy.yaml",
|
||||
"quantization_config": {"method": "bitsandbytes"},
|
||||
},
|
||||
trust_remote_code=False,
|
||||
)
|
||||
|
||||
assert stage_configs[0].engine_args.quantization_config == {"method": "bitsandbytes"}
|
||||
@@ -28,11 +28,18 @@ def test_dreamzero_config_sets_model_class_and_policy_config(monkeypatch):
|
||||
classmethod(lambda _cls, model, trust_remote_code=True: "vla"),
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
"vllm_omni.diffusion.utils.hf_utils._looks_like_dreamzero",
|
||||
"vllm_omni.config.config_factory.StageConfigFactory.get_hf_config",
|
||||
classmethod(lambda _cls, model, trust_remote_code=True: None),
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
"vllm_omni.config.config_factory._looks_like_dreamzero",
|
||||
lambda _model: True,
|
||||
)
|
||||
|
||||
stage_configs, _ = load_stage_configs_from_model("GEAR-Dreams/DreamZero-DROID")
|
||||
stage_configs, _ = load_stage_configs_from_model(
|
||||
"GEAR-Dreams/DreamZero-DROID",
|
||||
trust_remote_code=False,
|
||||
)
|
||||
engine_args = stage_configs[0].engine_args
|
||||
|
||||
assert engine_args.model_class_name == "DreamZeroPipeline"
|
||||
|
||||
@@ -315,13 +315,17 @@ class TestResolveModelConfigPath:
|
||||
|
||||
|
||||
class TestLoadAndResolveStageConfigs:
|
||||
def test_load_and_resolve_with_kwargs(self):
|
||||
def test_load_and_resolve_with_kwargs(self, mocker: MockerFixture):
|
||||
"""Ensure that dtype survives default stage creation."""
|
||||
kwargs = {"dtype": torch.float32}
|
||||
mocker.patch("vllm_omni.entrypoints.utils.resolve_model_config_path", return_value=None)
|
||||
mocker.patch("vllm_omni.entrypoints.utils.load_stage_configs_from_model", return_value=([], None))
|
||||
|
||||
config_path, stage_configs, _ = load_and_resolve_stage_configs(
|
||||
model="black-forest-labs/FLUX.2-klein-4B",
|
||||
stage_configs_path=None,
|
||||
kwargs=kwargs,
|
||||
trust_remote_code=False,
|
||||
default_stage_cfg_factory=lambda: AsyncOmniEngine._create_default_diffusion_stage_cfg(kwargs),
|
||||
)
|
||||
assert config_path is None
|
||||
@@ -356,10 +360,12 @@ class TestLoadAndResolveStageConfigs:
|
||||
model="dummy-model",
|
||||
stage_configs_path=str(deploy_path),
|
||||
kwargs={},
|
||||
trust_remote_code=True,
|
||||
)
|
||||
|
||||
load_stage_configs.assert_called_once_with(
|
||||
"dummy-model",
|
||||
trust_remote_code=True,
|
||||
base_engine_args={},
|
||||
deploy_config_path=str(deploy_path),
|
||||
stage_overrides=None,
|
||||
|
||||
Reference in new issue
Block a user