From 78e69c7da0b16e17c0fdd08b9364ef8bd4b117c3 Mon Sep 17 00:00:00 2001 From: Pierre Chapuis Date: Thu, 7 Sep 2023 14:49:13 +0200 Subject: [PATCH] fix typo + skip test if weights are not available --- .../latent_diffusion/test_sdxl_double_encoder.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/foundationals/latent_diffusion/test_sdxl_double_encoder.py b/tests/foundationals/latent_diffusion/test_sdxl_double_encoder.py index 3ffdada..8caef45 100644 --- a/tests/foundationals/latent_diffusion/test_sdxl_double_encoder.py +++ b/tests/foundationals/latent_diffusion/test_sdxl_double_encoder.py @@ -55,10 +55,18 @@ def double_text_encoder(test_weights_path: Path) -> DoubleTextEncoder: text_encoder_g_with_projection.append(module=fl.Linear(in_features=1280, out_features=1280, bias=False)) text_encoder_l_path = test_weights_path / "CLIPTextEncoderL.safetensors" - text_encdoer_g_path = test_weights_path / "CLIPTextEncoderGWithProjection.safetensors" + text_encoder_g_path = test_weights_path / "CLIPTextEncoderGWithProjection.safetensors" + + if not text_encoder_l_path.is_file(): + warn(f"could not find weights at {text_encoder_l_path}, skipping") + pytest.skip(allow_module_level=True) + + if not text_encoder_g_path.is_file(): + warn(f"could not find weights at {text_encoder_g_path}, skipping") + pytest.skip(allow_module_level=True) text_encoder_l.load_from_safetensors(tensors_path=text_encoder_l_path) - text_encoder_g_with_projection.load_from_safetensors(tensors_path=text_encdoer_g_path) + text_encoder_g_with_projection.load_from_safetensors(tensors_path=text_encoder_g_path) linear = text_encoder_g_with_projection.pop(index=-1) assert isinstance(linear, fl.Linear)