From 33a1bde64787dcca957d6909f95ee888721d0106 Mon Sep 17 00:00:00 2001 From: Qing Date: Wed, 1 Feb 2023 21:36:37 +0800 Subject: [PATCH] fix test --- ...verture-creations-5sI6fQgYIuo_all_mask.png | 0 lama_cleaner/tests/test_instruct_pix2pix.py | 26 ++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 lama_cleaner/tests/overture-creations-5sI6fQgYIuo_all_mask.png diff --git a/lama_cleaner/tests/overture-creations-5sI6fQgYIuo_all_mask.png b/lama_cleaner/tests/overture-creations-5sI6fQgYIuo_all_mask.png new file mode 100644 index 0000000..e69de29 diff --git a/lama_cleaner/tests/test_instruct_pix2pix.py b/lama_cleaner/tests/test_instruct_pix2pix.py index 1b2c728..9780cf3 100644 --- a/lama_cleaner/tests/test_instruct_pix2pix.py +++ b/lama_cleaner/tests/test_instruct_pix2pix.py @@ -24,7 +24,7 @@ def test_instruct_pix2pix(disable_nsfw, cpu_offload): disable_nsfw=disable_nsfw, sd_cpu_textencoder=False, cpu_offload=cpu_offload) - cfg = get_config(strategy=HDStrategy.ORIGINAL, prompt='make it good', p2p_steps=sd_steps, sd_scale=1.1) + cfg = get_config(strategy=HDStrategy.ORIGINAL, prompt='What if it were snowing?', p2p_steps=sd_steps, sd_scale=1.1) name = f"device_{device}_disnsfw_{disable_nsfw}_cpu_offload_{cpu_offload}" @@ -36,3 +36,27 @@ def test_instruct_pix2pix(disable_nsfw, cpu_offload): mask_p=current_dir / "overture-creations-5sI6fQgYIuo_mask.png", fx=1.3 ) + + +@pytest.mark.parametrize("disable_nsfw", [False]) +@pytest.mark.parametrize("cpu_offload", [False]) +def test_instruct_pix2pix_snow(disable_nsfw, cpu_offload): + sd_steps = 50 if device == 'cuda' else 1 + model = ModelManager(name="instruct_pix2pix", + device=torch.device(device), + hf_access_token="", + sd_run_local=True, + disable_nsfw=disable_nsfw, + sd_cpu_textencoder=False, + cpu_offload=cpu_offload) + cfg = get_config(strategy=HDStrategy.ORIGINAL, prompt='What if it were snowing?', p2p_steps=sd_steps) + + name = f"snow" + + assert_equal( + model, + cfg, + f"instruct_pix2pix_{name}.png", + img_p=current_dir / "overture-creations-5sI6fQgYIuo.png", + mask_p=current_dir / "overture-creations-5sI6fQgYIuo_mask.png", + )