2023-09-20 19:48:59 +00:00
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
2024-02-06 03:56:32 +00:00
|
|
|
from invokeai.backend.model_manager import BaseModelType, ModelRepoVariant
|
2024-01-22 19:37:23 +00:00
|
|
|
from invokeai.backend.model_manager.probe import VaeFolderProbe
|
2023-09-20 19:48:59 +00:00
|
|
|
|
|
|
|
|
2023-09-20 19:53:25 +00:00
|
|
|
@pytest.mark.parametrize(
|
|
|
|
"vae_path,expected_type",
|
|
|
|
[
|
|
|
|
("sd-vae-ft-mse", BaseModelType.StableDiffusion1),
|
|
|
|
("sdxl-vae", BaseModelType.StableDiffusionXL),
|
|
|
|
("taesd", BaseModelType.StableDiffusion1),
|
|
|
|
("taesdxl", BaseModelType.StableDiffusionXL),
|
|
|
|
],
|
|
|
|
)
|
2023-09-20 19:48:59 +00:00
|
|
|
def test_get_base_type(vae_path: str, expected_type: BaseModelType, datadir: Path):
|
|
|
|
sd1_vae_path = datadir / "vae" / vae_path
|
|
|
|
probe = VaeFolderProbe(sd1_vae_path)
|
|
|
|
base_type = probe.get_base_type()
|
|
|
|
assert base_type == expected_type
|
2024-01-22 19:37:23 +00:00
|
|
|
repo_variant = probe.get_repo_variant()
|
2024-03-05 06:37:17 +00:00
|
|
|
assert repo_variant == ModelRepoVariant.Default
|
2024-02-01 04:37:59 +00:00
|
|
|
|
2024-01-22 19:37:23 +00:00
|
|
|
|
|
|
|
def test_repo_variant(datadir: Path):
|
|
|
|
probe = VaeFolderProbe(datadir / "vae" / "taesdxl-fp16")
|
|
|
|
repo_variant = probe.get_repo_variant()
|
2024-02-06 03:56:32 +00:00
|
|
|
assert repo_variant == ModelRepoVariant.FP16
|