Skip to content

Commit

Permalink
tests/fix: check flux n_iter same as other n_iter tests
Browse files Browse the repository at this point in the history
The first in a batch should match the generation with a same payload but with `n: 1`.
  • Loading branch information
tazlin committed Oct 1, 2024
1 parent 9233925 commit 8e90948
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 36 additions & 36 deletions tests/test_horde_inference_flux.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,42 @@

class TestHordeInferenceFlux:

# @pytest.mark.default_flux1_model
# def test_flux_dev_fp8_text_to_image(
# self,
# hordelib_instance: HordeLib,
# flux1_dev_fp8_base_model_name: str,
# ):
# data = {
# "sampler_name": "k_euler",
# "cfg_scale": 1,
# "denoising_strength": 1.0,
# "seed": 13122,
# "height": 1024,
# "width": 1024,
# "karras": False,
# "tiling": False,
# "hires_fix": False,
# "clip_skip": 1,
# "control_type": None,
# "image_is_control": False,
# "return_control_map": False,
# "prompt": 'a steampunk text that says "Horde Engine" floating',
# "ddim_steps": 20,
# "n_iter": 1,
# "model": flux1_dev_fp8_base_model_name,
# }
# pil_image = hordelib_instance.basic_inference_single_image(data).image
# assert pil_image is not None
# assert isinstance(pil_image, Image.Image)
@pytest.mark.default_flux1_model
def test_flux_schnell_fp8_text_to_image(
self,
hordelib_instance: HordeLib,
flux1_schnell_fp8_base_model_name: str,
):
data = {
"sampler_name": "k_euler",
"cfg_scale": 1,
"denoising_strength": 1.0,
"seed": 13122,
"height": 1024,
"width": 1024,
"karras": False,
"tiling": False,
"hires_fix": False,
"clip_skip": 1,
"control_type": None,
"image_is_control": False,
"return_control_map": False,
"prompt": 'a steampunk text that says "Horde Engine" floating',
"ddim_steps": 4,
"n_iter": 1,
"model": flux1_schnell_fp8_base_model_name,
}
pil_image = hordelib_instance.basic_inference_single_image(data).image
assert pil_image is not None
assert isinstance(pil_image, Image.Image)

# img_filename = "flux_dev_fp8_text_to_image.png"
# pil_image.save(f"images/{img_filename}", quality=100)
img_filename = "flux_schnell_fp8_text_to_image.png"
pil_image.save(f"images/{img_filename}", quality=100)

# assert check_single_inference_image_similarity(
# f"images_expected/{img_filename}",
# pil_image,
# )
assert check_single_inference_image_similarity(
f"images_expected/{img_filename}",
pil_image,
)

@pytest.mark.default_flux1_model
def test_flux_schnell_fp8_text_to_image_n_iter(
Expand Down Expand Up @@ -91,8 +91,8 @@ def test_flux_schnell_fp8_text_to_image_n_iter(
img_pairs_to_check.append((f"images_expected/{img_filename}", image_result.image))

assert check_single_inference_image_similarity(
"images_expected/text_to_image.png",
"images/text_to_image_n_iter_0.png",
"images_expected/flux_schnell_fp8_text_to_image.png",
"images/flux_schnell_fp8_text_to_image_n_iter_0.png",
)

assert check_list_inference_images_similarity(img_pairs_to_check)
Expand Down

0 comments on commit 8e90948

Please sign in to comment.