diff --git a/hordelib/consts.py b/hordelib/consts.py index 8acd7771..68ebe703 100644 --- a/hordelib/consts.py +++ b/hordelib/consts.py @@ -6,7 +6,7 @@ from hordelib.config_path import get_hordelib_path -COMFYUI_VERSION = "dd116abfc48e8023bb425c2dd5bd954ee99d7a9c" +COMFYUI_VERSION = "3e0033ef30a111076af54a7a4e6b470cdc570886" """The exact version of ComfyUI version to load.""" REMOTE_PROXY = "" diff --git a/hordelib/model_manager/lora.py b/hordelib/model_manager/lora.py index 4f7fd604..c75376b3 100644 --- a/hordelib/model_manager/lora.py +++ b/hordelib/model_manager/lora.py @@ -334,7 +334,9 @@ def _download_thread(self, thread_number): response = requests.get(lora["url"], timeout=self.REQUEST_DOWNLOAD_TIMEOUT) response.raise_for_status() if "reason=download-auth" in response.url: - logger.error(f"Error downloading {lora['filename']}. CivitAI appears to be redirecting us to a login page. Aborting") + logger.error( + f"Error downloading {lora['filename']}. CivitAI appears to be redirecting us to a login page. Aborting" + ) break # Check the data hash hash_object = hashlib.sha256() @@ -567,7 +569,7 @@ def find_lora_trigger(self, model_name: str, trigger_search: str): def save_cached_reference_to_disk(self): with open(self.models_db_path, "w", encoding="utf-8", errors="ignore") as outfile: - outfile.write(json.dumps(self.model_reference, indent=4)) + outfile.write(json.dumps(self.model_reference.copy(), indent=4)) def calculate_downloaded_loras(self, mode=DOWNLOAD_SIZE_CHECK.everything): total_size = 0 diff --git a/images_expected/lora_blue_low_clip_strength.png b/images_expected/lora_blue_low_clip_strength.png new file mode 100644 index 00000000..1f3d6998 Binary files /dev/null and b/images_expected/lora_blue_low_clip_strength.png differ diff --git a/images_expected/lora_blue_low_model_and_clip_strength.png b/images_expected/lora_blue_low_model_and_clip_strength.png new file mode 100644 index 00000000..4b16e1ab Binary files /dev/null and b/images_expected/lora_blue_low_model_and_clip_strength.png differ diff --git a/images_expected/lora_blue_low_model_strength.png b/images_expected/lora_blue_low_model_strength.png new file mode 100644 index 00000000..ac3b206e Binary files /dev/null and b/images_expected/lora_blue_low_model_strength.png differ diff --git a/images_expected/lora_blue_negative_clip_strength.png b/images_expected/lora_blue_negative_clip_strength.png new file mode 100644 index 00000000..ebbf055f Binary files /dev/null and b/images_expected/lora_blue_negative_clip_strength.png differ diff --git a/images_expected/lora_blue_negative_model_and_clip_strength.png b/images_expected/lora_blue_negative_model_and_clip_strength.png new file mode 100644 index 00000000..b09b1384 Binary files /dev/null and b/images_expected/lora_blue_negative_model_and_clip_strength.png differ diff --git a/images_expected/lora_blue_negative_model_strength.png b/images_expected/lora_blue_negative_model_strength.png new file mode 100644 index 00000000..350f6abc Binary files /dev/null and b/images_expected/lora_blue_negative_model_strength.png differ diff --git a/images_expected/lora_character_hires_fix.png b/images_expected/lora_character_hires_fix.png index 5be40e83..c3a3156c 100644 Binary files a/images_expected/lora_character_hires_fix.png and b/images_expected/lora_character_hires_fix.png differ diff --git a/images_expected/lora_negative_strength.png b/images_expected/lora_negative_strength.png new file mode 100644 index 00000000..aa93588d Binary files /dev/null and b/images_expected/lora_negative_strength.png differ diff --git a/images_expected/sampler_30_steps_k_dpm_fast.png b/images_expected/sampler_30_steps_k_dpm_fast.png index 28fbeca5..b0c6c5f1 100644 Binary files a/images_expected/sampler_30_steps_k_dpm_fast.png and b/images_expected/sampler_30_steps_k_dpm_fast.png differ diff --git a/images_expected/sampler_30_steps_k_dpmpp_sde.png b/images_expected/sampler_30_steps_k_dpmpp_sde.png index 68cb1c35..f044a870 100644 Binary files a/images_expected/sampler_30_steps_k_dpmpp_sde.png and b/images_expected/sampler_30_steps_k_dpmpp_sde.png differ diff --git a/tests/test_horde_lora.py b/tests/test_horde_lora.py index 7ccfa82d..d314f99b 100644 --- a/tests/test_horde_lora.py +++ b/tests/test_horde_lora.py @@ -242,6 +242,10 @@ def test_text_to_image_lora_blue_low_strength( img_filename = "lora_blue_low_model_strength.png" pil_image.save(f"images/{img_filename}", quality=100) + assert check_single_lora_image_similarity( + f"images_expected/{img_filename}", + pil_image, + ) data["loras"] = [{"name": lora_name, "model": 1.0, "clip": 0.1}] pil_image = hordelib_instance.basic_inference_single_image(data) @@ -250,6 +254,10 @@ def test_text_to_image_lora_blue_low_strength( img_filename = "lora_blue_low_clip_strength.png" pil_image.save(f"images/{img_filename}", quality=100) + assert check_single_lora_image_similarity( + f"images_expected/{img_filename}", + pil_image, + ) data["loras"] = [{"name": lora_name, "model": 0.1, "clip": 0.1}] pil_image = hordelib_instance.basic_inference_single_image(data) @@ -258,6 +266,10 @@ def test_text_to_image_lora_blue_low_strength( img_filename = "lora_blue_low_model_and_clip_strength.png" pil_image.save(f"images/{img_filename}", quality=100) + assert check_single_lora_image_similarity( + f"images_expected/{img_filename}", + pil_image, + ) def test_text_to_image_lora_blue_negative_strength( self, @@ -295,22 +307,37 @@ def test_text_to_image_lora_blue_negative_strength( pil_image = hordelib_instance.basic_inference_single_image(data) assert pil_image is not None assert isinstance(pil_image, Image.Image) + img_filename = "lora_blue_negative_model_strength.png" pil_image.save(f"images/{img_filename}", quality=100) + assert check_single_lora_image_similarity( + f"images_expected/{img_filename}", + pil_image, + ) data["loras"] = [{"name": lora_name, "model": 1.0, "clip": -1.0}] pil_image = hordelib_instance.basic_inference_single_image(data) assert pil_image is not None assert isinstance(pil_image, Image.Image) + img_filename = "lora_blue_negative_clip_strength.png" pil_image.save(f"images/{img_filename}", quality=100) + assert check_single_lora_image_similarity( + f"images_expected/{img_filename}", + pil_image, + ) data["loras"] = [{"name": lora_name, "model": -1.0, "clip": -1.0}] pil_image = hordelib_instance.basic_inference_single_image(data) assert pil_image is not None assert isinstance(pil_image, Image.Image) + img_filename = "lora_blue_negative_model_and_clip_strength.png" pil_image.save(f"images/{img_filename}", quality=100) + assert check_single_lora_image_similarity( + f"images_expected/{img_filename}", + pil_image, + ) def test_text_to_image_lora_blue_hires_fix( self, @@ -815,6 +842,11 @@ def test_negative_model_power( img_filename = "lora_negative_strength.png" pil_image.save(f"images/{img_filename}", quality=100) + assert check_single_lora_image_similarity( + f"images_expected/{img_filename}", + pil_image, + ) + data = { "sampler_name": "k_euler", "cfg_scale": 8.0, diff --git a/tests/test_horde_samplers.py b/tests/test_horde_samplers.py index 0d7e8864..8164c37b 100644 --- a/tests/test_horde_samplers.py +++ b/tests/test_horde_samplers.py @@ -1,6 +1,7 @@ # test_horde.py from PIL import Image +from loguru import logger from hordelib.horde import HordeLib @@ -81,6 +82,7 @@ def test_samplers( images_to_compare.append((f"images_expected/{img_filename}", pil_image)) for img_filename, pil_image in images_to_compare: + logger.debug(f"Checking image {img_filename}") assert check_single_inference_image_similarity( img_filename, pil_image,