diff options
author | Volpeon <git@volpeon.ink> | 2023-03-04 09:58:36 +0100 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2023-03-04 09:58:36 +0100 |
commit | 1139541b553d398dc080ddfd0d13045669853455 (patch) | |
tree | 8ac520e5ff196379f0ad33cbfe2165c5ad4a3440 /pipelines | |
parent | Pipeline: Perlin noise for init image (diff) | |
download | textual-inversion-diff-1139541b553d398dc080ddfd0d13045669853455.tar.gz textual-inversion-diff-1139541b553d398dc080ddfd0d13045669853455.tar.bz2 textual-inversion-diff-1139541b553d398dc080ddfd0d13045669853455.zip |
Update
Diffstat (limited to 'pipelines')
-rw-r--r-- | pipelines/stable_diffusion/vlpn_stable_diffusion.py | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/pipelines/stable_diffusion/vlpn_stable_diffusion.py b/pipelines/stable_diffusion/vlpn_stable_diffusion.py index a6b31d8..f02dd72 100644 --- a/pipelines/stable_diffusion/vlpn_stable_diffusion.py +++ b/pipelines/stable_diffusion/vlpn_stable_diffusion.py | |||
@@ -307,17 +307,10 @@ class VlpnStableDiffusion(DiffusionPipeline): | |||
307 | return timesteps, num_inference_steps - t_start | 307 | return timesteps, num_inference_steps - t_start |
308 | 308 | ||
309 | def prepare_image(self, batch_size, width, height, dtype, device, generator=None): | 309 | def prepare_image(self, batch_size, width, height, dtype, device, generator=None): |
310 | max = 0.4 | ||
311 | offset = max * (2 * torch.rand( | ||
312 | (batch_size, 1, 1, 1), | ||
313 | dtype=dtype, | ||
314 | device=device, | ||
315 | generator=generator | ||
316 | ) - 1) | ||
317 | noise = perlin_noise( | 310 | noise = perlin_noise( |
318 | batch_size, width, height, res=3, octaves=3, generator=generator, dtype=dtype, device=device | 311 | batch_size, width, height, res=1, octaves=4, generator=generator, dtype=dtype, device=device |
319 | ).expand(batch_size, 3, width, height) | 312 | ).expand(batch_size, 3, width, height) |
320 | return ((1 + max) * noise + max * offset).clamp(-1, 1) | 313 | return (1.4 * noise).clamp(-1, 1) |
321 | 314 | ||
322 | def prepare_latents(self, init_image, timestep, batch_size, dtype, device, generator=None): | 315 | def prepare_latents(self, init_image, timestep, batch_size, dtype, device, generator=None): |
323 | init_image = init_image.to(device=device, dtype=dtype) | 316 | init_image = init_image.to(device=device, dtype=dtype) |