Skip to content

Commit 387d48d

Browse files
affromerohlky
andauthored
Update src/diffusers/pipelines/flux/pipeline_flux_control_inpaint.py
Co-authored-by: hlky <[email protected]>
1 parent 7eaec16 commit 387d48d

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/diffusers/pipelines/flux/pipeline_flux_control_inpaint.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,35 @@ def _unpack_latents(latents, height, width, vae_scale_factor):
574574

575575
return latents
576576

577+
def enable_vae_slicing(self):
578+
r"""
579+
Enable sliced VAE decoding. When this option is enabled, the VAE will split the input tensor in slices to
580+
compute decoding in several steps. This is useful to save some memory and allow larger batch sizes.
581+
"""
582+
self.vae.enable_slicing()
583+
584+
def disable_vae_slicing(self):
585+
r"""
586+
Disable sliced VAE decoding. If `enable_vae_slicing` was previously enabled, this method will go back to
587+
computing decoding in one step.
588+
"""
589+
self.vae.disable_slicing()
590+
591+
def enable_vae_tiling(self):
592+
r"""
593+
Enable tiled VAE decoding. When this option is enabled, the VAE will split the input tensor into tiles to
594+
compute decoding and encoding in several steps. This is useful for saving a large amount of memory and to allow
595+
processing larger images.
596+
"""
597+
self.vae.enable_tiling()
598+
599+
def disable_vae_tiling(self):
600+
r"""
601+
Disable tiled VAE decoding. If `enable_vae_tiling` was previously enabled, this method will go back to
602+
computing decoding in one step.
603+
"""
604+
self.vae.disable_tiling()
605+
577606
# Copied from diffusers.pipelines.flux.pipeline_flux_img2img.FluxImg2ImgPipeline.prepare_latents
578607
def prepare_latents(
579608
self,

0 commit comments

Comments
 (0)