Skip to content

Commit

Permalink
ruff fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
arrmansa committed Dec 29, 2024
1 parent cdaff4d commit c479eba
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions scripts/img2imgalt.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import k_diffusion as K

# Debugging notes - the original method apply_model is being called for sd1.5 is in modules.sd_hijack_utils and is ldm.models.diffusion.ddpm.LatentDiffusion
# For sdxl - OpenAIWrapper will be called, which will call the underlying diffusion_model
# For sdxl - OpenAIWrapper will be called, which will call the underlying diffusion_model


def find_noise_for_image(p, cond, uncond, cfg_scale, steps):
Expand Down Expand Up @@ -47,9 +47,9 @@ def find_noise_for_image(p, cond, uncond, cfg_scale, steps):

c_out, c_in = [K.utils.append_dims(k, x_in.ndim) for k in dnw.get_scalings(sigma_in)[skip:]]
t = dnw.sigma_to_t(sigma_in)

if shared.sd_model.is_sdxl:
eps = shared.sd_model.model(x_in * c_in, t, {"crossattn": cond_in["c_crossattn"][0]} )
eps = shared.sd_model.model(x_in * c_in, t, {"crossattn": cond_in["c_crossattn"][0]} )
else:
eps = shared.sd_model.apply_model(x_in * c_in, t, cond=cond_in)

Expand Down Expand Up @@ -104,7 +104,7 @@ def find_noise_for_image_sigma_adjustment(p, cond, uncond, cfg_scale, steps):
x_in = torch.cat([x] * 2)
sigma_in = torch.cat([sigmas[i - 1] * s_in] * 2)


if shared.sd_model.is_sdxl:
cond_tensor = cond['crossattn']
uncond_tensor = uncond['crossattn']
Expand All @@ -122,9 +122,9 @@ def find_noise_for_image_sigma_adjustment(p, cond, uncond, cfg_scale, steps):
else:
t = dnw.sigma_to_t(sigma_in)


if shared.sd_model.is_sdxl:
eps = shared.sd_model.model(x_in * c_in, t, {"crossattn": cond_in["c_crossattn"][0]} )
eps = shared.sd_model.model(x_in * c_in, t, {"crossattn": cond_in["c_crossattn"][0]} )
else:
eps = shared.sd_model.apply_model(x_in * c_in, t, cond=cond_in)

Expand Down

0 comments on commit c479eba

Please sign in to comment.