Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
from invokeai.backend.architectures import resolve_default_settings
from invokeai.backend.model_manager.taxonomy import BaseModelType
class TestErnieImageDefaultSettings:
def test_base_defaults(self) -> None:
s = resolve_default_settings(BaseModelType.ErnieImage, None, "ERNIE-Image")
assert s is not None
assert (s.steps, s.cfg_scale) == (50, 4.0)
def test_turbo_detected_from_name(self) -> None:
s = resolve_default_settings(BaseModelType.ErnieImage, None, "ERNIE-Image-Turbo")
assert s is not None
assert (s.steps, s.cfg_scale) == (8, 1.0)
def test_turbo_detected_from_path_when_renamed(self) -> None:
# The two checkpoints are architecturally identical, so detection falls back to the name.
# Renaming the model in the install dialog must not lose the Turbo defaults, hence the
# install path is consulted too.
s = resolve_default_settings(BaseModelType.ErnieImage, None, "my ernie", "main/ernie-image/ERNIE-Image-Turbo")
assert s is not None
assert (s.steps, s.cfg_scale) == (8, 1.0)
def test_no_turbo_hint_falls_back_to_base_defaults(self) -> None:
s = resolve_default_settings(BaseModelType.ErnieImage, None, "my ernie", "main/ernie-image/whatever")
assert s is not None
assert (s.steps, s.cfg_scale) == (50, 4.0)
def test_turbo_in_ancestor_directory_is_ignored(self) -> None:
# An in-place install records an absolute path, so an unrelated ancestor directory can
# contain "turbo". Only the install directory's own name may drive detection — otherwise the
# *base* model silently gets Turbo's 8 steps and CFG 1.0.
s = resolve_default_settings(BaseModelType.ErnieImage, None, "my ernie", "/mnt/turbo-nvme/models/ERNIE-Image")
assert s is not None
assert (s.steps, s.cfg_scale) == (50, 4.0)
def test_turbo_in_leaf_directory_still_detected(self) -> None:
s = resolve_default_settings(
BaseModelType.ErnieImage, None, "my ernie", "/mnt/turbo-nvme/models/ERNIE-Image-Turbo"
)
assert s is not None
assert (s.steps, s.cfg_scale) == (8, 1.0)