|
32 | 32 | ) |
33 | 33 | from ..modeling_outputs import AutoencoderKLOutput |
34 | 34 | from ..modeling_utils import ModelMixin |
35 | | -from .vae import Decoder, DecoderOutput, DiagonalGaussianDistribution, Encoder |
| 35 | +from .vae import AutoencoderMixin, Decoder, DecoderOutput, DiagonalGaussianDistribution, Encoder |
36 | 36 |
|
37 | 37 |
|
38 | | -class AutoencoderKL(ModelMixin, ConfigMixin, FromOriginalModelMixin, PeftAdapterMixin): |
| 38 | +class AutoencoderKL(ModelMixin, AutoencoderMixin, ConfigMixin, FromOriginalModelMixin, PeftAdapterMixin): |
39 | 39 | r""" |
40 | 40 | A VAE model with KL loss for encoding images into latents and decoding latent representations into images. |
41 | 41 |
|
@@ -138,35 +138,6 @@ def __init__( |
138 | 138 | self.tile_latent_min_size = int(sample_size / (2 ** (len(self.config.block_out_channels) - 1))) |
139 | 139 | self.tile_overlap_factor = 0.25 |
140 | 140 |
|
141 | | - def enable_tiling(self, use_tiling: bool = True): |
142 | | - r""" |
143 | | - Enable tiled VAE decoding. When this option is enabled, the VAE will split the input tensor into tiles to |
144 | | - compute decoding and encoding in several steps. This is useful for saving a large amount of memory and to allow |
145 | | - processing larger images. |
146 | | - """ |
147 | | - self.use_tiling = use_tiling |
148 | | - |
149 | | - def disable_tiling(self): |
150 | | - r""" |
151 | | - Disable tiled VAE decoding. If `enable_tiling` was previously enabled, this method will go back to computing |
152 | | - decoding in one step. |
153 | | - """ |
154 | | - self.enable_tiling(False) |
155 | | - |
156 | | - def enable_slicing(self): |
157 | | - r""" |
158 | | - Enable sliced VAE decoding. When this option is enabled, the VAE will split the input tensor in slices to |
159 | | - compute decoding in several steps. This is useful to save some memory and allow larger batch sizes. |
160 | | - """ |
161 | | - self.use_slicing = True |
162 | | - |
163 | | - def disable_slicing(self): |
164 | | - r""" |
165 | | - Disable sliced VAE decoding. If `enable_slicing` was previously enabled, this method will go back to computing |
166 | | - decoding in one step. |
167 | | - """ |
168 | | - self.use_slicing = False |
169 | | - |
170 | 141 | @property |
171 | 142 | # Copied from diffusers.models.unets.unet_2d_condition.UNet2DConditionModel.attn_processors |
172 | 143 | def attn_processors(self) -> Dict[str, AttentionProcessor]: |
|
0 commit comments