From 1705fffa7ac6f4767810251ad2bef8d62a7d711f Mon Sep 17 00:00:00 2001 From: Bryce Date: Wed, 22 Nov 2023 12:20:37 -0800 Subject: [PATCH] wip --- .github/workflows/ci.yaml | 2 +- imaginairy/api_refiners.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7add0ea1..711b0e12 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -54,7 +54,7 @@ jobs: run: | black --diff --fast . test: - runs-on: ubuntu-latest + runs-on: macos-13-xlarge strategy: fail-fast: false matrix: diff --git a/imaginairy/api_refiners.py b/imaginairy/api_refiners.py index 97e4b4b7..80f9f926 100644 --- a/imaginairy/api_refiners.py +++ b/imaginairy/api_refiners.py @@ -126,7 +126,7 @@ def latent_logger(latents): init_latent = None if prompt.init_image: starting_image = prompt.init_image - first_step = int(prompt.steps * prompt.init_image_strength) + first_step = int((prompt.steps - 1) * prompt.init_image_strength) if prompt.mask_prompt: mask_image, mask_grayscale = get_img_mask( @@ -272,10 +272,10 @@ def latent_logger(latents): result_images["composition-upscaled"] = comp_image # noise = noise[:, :, : comp_image.height, : comp_image.shape[3]] comp_cutoff = 0.60 - first_step = int(prompt.steps * comp_cutoff) - noise_step = int(prompt.steps * max(comp_cutoff - 0.05, 0)) - noise_step = max(noise_step, 0) - noise_step = min(noise_step, prompt.steps - 1) + first_step = int((prompt.steps - 1) * comp_cutoff) + # noise_step = int(prompt.steps * max(comp_cutoff - 0.05, 0)) + # noise_step = max(noise_step, 0) + # noise_step = min(noise_step, prompt.steps - 1) log_img(comp_image, "comp_image") comp_image_t = pillow_img_to_torch_image(comp_image) comp_image_t = comp_image_t.to(sd.device, dtype=sd.dtype) @@ -302,6 +302,9 @@ def latent_logger(latents): ) if init_latent is not None: + print( + f"noise step: {noise_step} first step: {first_step} len steps: {len(sd.steps)}" + ) noise_step = noise_step if noise_step is not None else first_step noised_latent = sd.scheduler.add_noise( x=init_latent, noise=noise, step=sd.steps[noise_step]