tests(mm): add tests for control adapter probe default settings

This commit is contained in:
psychedelicious 2024-03-08 20:39:26 +11:00 committed by Brandon
parent a10dccdd43
commit 2410ed689a

View File

@ -3,7 +3,7 @@ from pathlib import Path
import pytest
from invokeai.backend.model_manager import BaseModelType, ModelRepoVariant
from invokeai.backend.model_manager.probe import VaeFolderProbe
from invokeai.backend.model_manager.probe import ControlAdapterProbe, VaeFolderProbe
@pytest.mark.parametrize(
@ -28,3 +28,17 @@ def test_repo_variant(datadir: Path):
probe = VaeFolderProbe(datadir / "vae" / "taesdxl-fp16")
repo_variant = probe.get_repo_variant()
assert repo_variant == ModelRepoVariant.FP16
def test_controlnet_t2i_default_settings():
should_be_canny = ControlAdapterProbe.get_default_settings("some_canny_model")
assert should_be_canny and should_be_canny.preprocessor == "canny_image_processor"
should_be_depth_anything = ControlAdapterProbe.get_default_settings("some_depth_model")
assert should_be_depth_anything and should_be_depth_anything.preprocessor == "depth_anything_image_processor"
should_be_dw_openpose = ControlAdapterProbe.get_default_settings("some_pose_model")
assert should_be_dw_openpose and should_be_dw_openpose.preprocessor == "dw_openpose_image_processor"
should_be_none = ControlAdapterProbe.get_default_settings("i like turtles")
assert should_be_none is None