Skip to content

Commit

Permalink
Merge pull request #1143 from bghira/feature/vae-tiling-trainer-call
Browse files Browse the repository at this point in the history
trainer: enable vae tiling when enabled
  • Loading branch information
bghira authored Nov 11, 2024
2 parents 3bcba75 + 2f227f8 commit ff8cbcf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions helpers/training/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,9 @@ def init_vae(self, move_to_accelerator: bool = True):
)
self.config.vae_kwargs["subfolder"] = None
self.vae = AutoencoderKL.from_pretrained(**self.config.vae_kwargs)
if self.vae is not None and self.config.vae_enable_tiling and hasattr(self.vae, 'enable_tiling'):
logger.warning("Enabling VAE tiling for greatly reduced memory consumption due to --vae_enable_tiling which may result in VAE tiling artifacts in encoded latents.")
self.vae.enable_tiling()
if not move_to_accelerator:
logger.debug("Not moving VAE to accelerator.")
return
Expand Down

0 comments on commit ff8cbcf

Please sign in to comment.