Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
brycedrennan committed Nov 22, 2023
1 parent 0af6c4a commit 1705fff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
run: |
black --diff --fast .
test:
runs-on: ubuntu-latest
runs-on: macos-13-xlarge
strategy:
fail-fast: false
matrix:
Expand Down
13 changes: 8 additions & 5 deletions imaginairy/api_refiners.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)
Expand All @@ -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]
Expand Down

0 comments on commit 1705fff

Please sign in to comment.