summaryrefslogtreecommitdiffstats
path: root/pipelines
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2023-03-06 06:41:51 +0100
committerVolpeon <git@volpeon.ink>2023-03-06 06:41:51 +0100
commita254c9f7bf3172aff8385174d761fa8bba508db0 (patch)
treeec9179f992fda32745f351a51a18e94122b34892 /pipelines
parentMore flexible pipeline wrt init noise (diff)
downloadtextual-inversion-diff-a254c9f7bf3172aff8385174d761fa8bba508db0.tar.gz
textual-inversion-diff-a254c9f7bf3172aff8385174d761fa8bba508db0.tar.bz2
textual-inversion-diff-a254c9f7bf3172aff8385174d761fa8bba508db0.zip
Update
Diffstat (limited to 'pipelines')
-rw-r--r--pipelines/stable_diffusion/vlpn_stable_diffusion.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/pipelines/stable_diffusion/vlpn_stable_diffusion.py b/pipelines/stable_diffusion/vlpn_stable_diffusion.py
index f27be78..f426de1 100644
--- a/pipelines/stable_diffusion/vlpn_stable_diffusion.py
+++ b/pipelines/stable_diffusion/vlpn_stable_diffusion.py
@@ -307,10 +307,14 @@ 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 noise = perlin_noise( 310 return (1.4 * perlin_noise(
311 batch_size, 1, width, height, res=1, octaves=4, generator=generator, dtype=dtype, device=device 311 (batch_size, 1, width, height),
312 ).expand(batch_size, 3, width, height) 312 res=1,
313 return (1.4 * noise).clamp(-1, 1) 313 octaves=4,
314 generator=generator,
315 dtype=dtype,
316 device=device
317 )).clamp(-1, 1).expand(batch_size, 3, width, height)
314 318
315 def prepare_latents_from_image(self, init_image, timestep, batch_size, dtype, device, generator=None): 319 def prepare_latents_from_image(self, init_image, timestep, batch_size, dtype, device, generator=None):
316 init_image = init_image.to(device=device, dtype=dtype) 320 init_image = init_image.to(device=device, dtype=dtype)
@@ -390,7 +394,7 @@ class VlpnStableDiffusion(DiffusionPipeline):
390 sag_scale: float = 0.75, 394 sag_scale: float = 0.75,
391 eta: float = 0.0, 395 eta: float = 0.0,
392 generator: Optional[Union[torch.Generator, List[torch.Generator]]] = None, 396 generator: Optional[Union[torch.Generator, List[torch.Generator]]] = None,
393 image: Optional[Union[torch.FloatTensor, PIL.Image.Image, Literal["noise"]]] = None, 397 image: Optional[Union[torch.FloatTensor, PIL.Image.Image, Literal["noise"]]] = "noise",
394 output_type: str = "pil", 398 output_type: str = "pil",
395 return_dict: bool = True, 399 return_dict: bool = True,
396 callback: Optional[Callable[[int, int, torch.FloatTensor], None]] = None, 400 callback: Optional[Callable[[int, int, torch.FloatTensor], None]] = None,