|
|
@ -266,6 +266,12 @@ def imagine(
|
|
|
|
# encode (scaled latent)
|
|
|
|
# encode (scaled latent)
|
|
|
|
seed_everything(prompt.seed)
|
|
|
|
seed_everything(prompt.seed)
|
|
|
|
noise = torch.randn_like(init_latent, device="cpu").to(get_device())
|
|
|
|
noise = torch.randn_like(init_latent, device="cpu").to(get_device())
|
|
|
|
|
|
|
|
if generation_strength >= 1:
|
|
|
|
|
|
|
|
# prompt strength gets converted to time encodings,
|
|
|
|
|
|
|
|
# which means you can't get to true 0 without this hack
|
|
|
|
|
|
|
|
# (or setting steps=1000)
|
|
|
|
|
|
|
|
z_enc = noise
|
|
|
|
|
|
|
|
else:
|
|
|
|
z_enc = sampler.stochastic_encode(
|
|
|
|
z_enc = sampler.stochastic_encode(
|
|
|
|
init_latent,
|
|
|
|
init_latent,
|
|
|
|
torch.tensor([t_enc - 1]).to(get_device()),
|
|
|
|
torch.tensor([t_enc - 1]).to(get_device()),
|
|
|
@ -275,9 +281,9 @@ def imagine(
|
|
|
|
|
|
|
|
|
|
|
|
# decode it
|
|
|
|
# decode it
|
|
|
|
samples = sampler.decode(
|
|
|
|
samples = sampler.decode(
|
|
|
|
z_enc,
|
|
|
|
x_latent=z_enc,
|
|
|
|
c,
|
|
|
|
cond=c,
|
|
|
|
t_enc,
|
|
|
|
t_start=t_enc,
|
|
|
|
unconditional_guidance_scale=prompt.prompt_strength,
|
|
|
|
unconditional_guidance_scale=prompt.prompt_strength,
|
|
|
|
unconditional_conditioning=uc,
|
|
|
|
unconditional_conditioning=uc,
|
|
|
|
img_callback=_img_callback,
|
|
|
|
img_callback=_img_callback,
|
|
|
|