[diffusion][bugfix] Separate Diffusers hooks from model metadata (#6749)
Signed-off-by: david6666666 <530634352@qq.com> Signed-off-by: Gao Han <hgaoaf@connect.ust.hk> Co-authored-by: Gao Han <hgaoaf@connect.ust.hk>
This commit is contained in:
1 parent
73893e73ea
commit
9a88d2d21d
11 files changed
+232
-12
No files matched your search
@@ -1,5 +1,5 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
|
||||
|
||||
"""
|
||||
Unit tests for diffusion engine plugin extensibility hooks.
|
||||
@@ -20,6 +20,8 @@ from vllm_omni.diffusion.registry import (
|
||||
_DIFFUSION_MODELS,
|
||||
_DIFFUSION_POST_PROCESS_FUNCS,
|
||||
_DIFFUSION_PRE_PROCESS_FUNCS,
|
||||
get_diffusion_post_process_func,
|
||||
get_diffusion_pre_process_func,
|
||||
register_diffusion_model,
|
||||
)
|
||||
from vllm_omni.platforms.interface import OmniPlatform, OmniPlatformEnum
|
||||
@@ -112,6 +114,49 @@ class TestRegisterDiffusionModel:
|
||||
assert _DIFFUSION_POST_PROCESS_FUNCS["LegacyActionPipeline"] == "test_post_process"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("model_class_name", "get_process_func"),
|
||||
[
|
||||
("QwenImagePipeline", get_diffusion_post_process_func),
|
||||
("WanImageToVideoPipeline", get_diffusion_post_process_func),
|
||||
("WanImageToVideoPipeline", get_diffusion_pre_process_func),
|
||||
],
|
||||
)
|
||||
def test_diffusers_backend_skips_native_process_hooks(model_class_name, get_process_func):
|
||||
od_config = SimpleNamespace(
|
||||
model_class_name=model_class_name,
|
||||
custom_pipeline_args=None,
|
||||
diffusion_load_format="diffusers",
|
||||
)
|
||||
|
||||
with patch("vllm_omni.diffusion.registry._load_process_func") as load_process_func:
|
||||
assert get_process_func(od_config) is None
|
||||
|
||||
load_process_func.assert_not_called()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("model_class_name", "get_process_func"),
|
||||
[
|
||||
("QwenImagePipeline", get_diffusion_post_process_func),
|
||||
("WanImageToVideoPipeline", get_diffusion_post_process_func),
|
||||
("WanImageToVideoPipeline", get_diffusion_pre_process_func),
|
||||
],
|
||||
)
|
||||
def test_custom_pipeline_preserves_native_process_hooks(model_class_name, get_process_func):
|
||||
process_func = Mock()
|
||||
od_config = SimpleNamespace(
|
||||
model_class_name=model_class_name,
|
||||
custom_pipeline_args={"pipeline_class": "custom.Pipeline"},
|
||||
diffusion_load_format="diffusers",
|
||||
)
|
||||
|
||||
with patch("vllm_omni.diffusion.registry._load_process_func", return_value=process_func) as load_process_func:
|
||||
assert get_process_func(od_config) is process_func
|
||||
|
||||
load_process_func.assert_called_once()
|
||||
|
||||
|
||||
class TestWorkerUsesHook:
|
||||
"""Test that DiffusionWorker resolves model runner via platform hook."""
|
||||
|
||||
|
||||
Reference in new issue
Block a user