diff options
Diffstat (limited to 'pipelines/stable_diffusion')
-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) |