Skip to content

Commit 10dfa9b

Browse files
committed
up
1 parent 262ce19 commit 10dfa9b

3 files changed

Lines changed: 6 additions & 69 deletions

File tree

src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage.py

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from ..activations import get_activation
2828
from ..modeling_outputs import AutoencoderKLOutput
2929
from ..modeling_utils import ModelMixin
30-
from .vae import DecoderOutput, DiagonalGaussianDistribution
30+
from .vae import AutoencoderMixin, DecoderOutput, DiagonalGaussianDistribution
3131

3232

3333
logger = logging.get_logger(__name__) # pylint: disable=invalid-name
@@ -410,7 +410,7 @@ def forward(self, x: torch.Tensor) -> torch.Tensor:
410410
return h
411411

412412

413-
class AutoencoderKLHunyuanImage(ModelMixin, ConfigMixin, FromOriginalModelMixin):
413+
class AutoencoderKLHunyuanImage(ModelMixin, AutoencoderMixin, ConfigMixin, FromOriginalModelMixin):
414414
r"""
415415
A VAE model for 2D images with spatial tiling support.
416416
@@ -486,27 +486,6 @@ def enable_tiling(
486486
self.tile_overlap_factor = tile_overlap_factor or self.tile_overlap_factor
487487
self.tile_latent_min_size = self.tile_sample_min_size // self.config.spatial_compression_ratio
488488

489-
def disable_tiling(self) -> None:
490-
r"""
491-
Disable tiled VAE decoding. If `enable_tiling` was previously enabled, this method will go back to computing
492-
decoding in one step.
493-
"""
494-
self.use_tiling = False
495-
496-
def enable_slicing(self) -> None:
497-
r"""
498-
Enable sliced VAE decoding. When this option is enabled, the VAE will split the input tensor in slices to
499-
compute decoding in several steps. This is useful to save some memory and allow larger batch sizes.
500-
"""
501-
self.use_slicing = True
502-
503-
def disable_slicing(self) -> None:
504-
r"""
505-
Disable sliced VAE decoding. If `enable_slicing` was previously enabled, this method will go back to computing
506-
decoding in one step.
507-
"""
508-
self.use_slicing = False
509-
510489
def _encode(self, x: torch.Tensor):
511490

512491
batch_size, num_channels, height, width = x.shape

src/diffusers/models/autoencoders/autoencoder_kl_hunyuanimage_refiner.py

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from ..activations import get_activation
2727
from ..modeling_outputs import AutoencoderKLOutput
2828
from ..modeling_utils import ModelMixin
29-
from .vae import DecoderOutput, DiagonalGaussianDistribution
29+
from .vae import AutoencoderMixin, DecoderOutput, DiagonalGaussianDistribution
3030

3131

3232
logger = logging.get_logger(__name__) # pylint: disable=invalid-name
@@ -584,7 +584,7 @@ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
584584
return hidden_states
585585

586586

587-
class AutoencoderKLHunyuanImageRefiner(ModelMixin, ConfigMixin):
587+
class AutoencoderKLHunyuanImageRefiner(ModelMixin, AutoencoderMixin, ConfigMixin):
588588
r"""
589589
A VAE model with KL loss for encoding videos into latents and decoding latent representations into videos. Used for
590590
HunyuanImage-2.1 Refiner.
@@ -685,27 +685,6 @@ def enable_tiling(
685685
self.tile_sample_stride_width = tile_sample_stride_width or self.tile_sample_stride_width
686686
self.tile_overlap_factor = tile_overlap_factor or self.tile_overlap_factor
687687

688-
def disable_tiling(self) -> None:
689-
r"""
690-
Disable tiled VAE decoding. If `enable_tiling` was previously enabled, this method will go back to computing
691-
decoding in one step.
692-
"""
693-
self.use_tiling = False
694-
695-
def enable_slicing(self) -> None:
696-
r"""
697-
Enable sliced VAE decoding. When this option is enabled, the VAE will split the input tensor in slices to
698-
compute decoding in several steps. This is useful to save some memory and allow larger batch sizes.
699-
"""
700-
self.use_slicing = True
701-
702-
def disable_slicing(self) -> None:
703-
r"""
704-
Disable sliced VAE decoding. If `enable_slicing` was previously enabled, this method will go back to computing
705-
decoding in one step.
706-
"""
707-
self.use_slicing = False
708-
709688
def _encode(self, x: torch.Tensor) -> torch.Tensor:
710689
_, _, _, height, width = x.shape
711690

src/diffusers/models/autoencoders/autoencoder_kl_hunyuanvideo15.py

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from ..activations import get_activation
2727
from ..modeling_outputs import AutoencoderKLOutput
2828
from ..modeling_utils import ModelMixin
29-
from .vae import DecoderOutput, DiagonalGaussianDistribution
29+
from .vae import AutoencoderMixin, DecoderOutput, DiagonalGaussianDistribution
3030

3131

3232
logger = logging.get_logger(__name__) # pylint: disable=invalid-name
@@ -625,7 +625,7 @@ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
625625
return hidden_states
626626

627627

628-
class AutoencoderKLHunyuanVideo15(ModelMixin, ConfigMixin):
628+
class AutoencoderKLHunyuanVideo15(ModelMixin, AutoencoderMixin, ConfigMixin):
629629
r"""
630630
A VAE model with KL loss for encoding videos into latents and decoding latent representations into videos. Used for
631631
HunyuanVideo-1.5.
@@ -723,27 +723,6 @@ def enable_tiling(
723723
self.tile_latent_min_width = tile_latent_min_width or self.tile_latent_min_width
724724
self.tile_overlap_factor = tile_overlap_factor or self.tile_overlap_factor
725725

726-
def disable_tiling(self) -> None:
727-
r"""
728-
Disable tiled VAE decoding. If `enable_tiling` was previously enabled, this method will go back to computing
729-
decoding in one step.
730-
"""
731-
self.use_tiling = False
732-
733-
def enable_slicing(self) -> None:
734-
r"""
735-
Enable sliced VAE decoding. When this option is enabled, the VAE will split the input tensor in slices to
736-
compute decoding in several steps. This is useful to save some memory and allow larger batch sizes.
737-
"""
738-
self.use_slicing = True
739-
740-
def disable_slicing(self) -> None:
741-
r"""
742-
Disable sliced VAE decoding. If `enable_slicing` was previously enabled, this method will go back to computing
743-
decoding in one step.
744-
"""
745-
self.use_slicing = False
746-
747726
def _encode(self, x: torch.Tensor) -> torch.Tensor:
748727
_, _, _, height, width = x.shape
749728

0 commit comments

Comments
 (0)