diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f49388a6..7ecde280c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ - explict clear caches on model load - lock adetailer commit: `#a89c01d` - xyzgrid fix progress calculation + - vae tiling use default value if not set ## Update for 2024-12-31 diff --git a/modules/sd_models.py b/modules/sd_models.py index 46463a85a..c401ae6b7 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -246,9 +246,11 @@ def set_vae_options(sd_model, vae = None, op: str = 'model'): if hasattr(sd_model, "enable_vae_tiling"): if shared.opts.diffusers_vae_tiling: if hasattr(sd_model, 'vae') and hasattr(sd_model.vae, 'config') and hasattr(sd_model.vae.config, 'sample_size') and isinstance(sd_model.vae.config.sample_size, int): - sd_model.vae.tile_sample_min_size = int(shared.opts.diffusers_vae_tile_size) - sd_model.vae.tile_latent_min_size = int(sd_model.vae.config.sample_size / (2 ** (len(sd_model.vae.config.block_out_channels) - 1))) - sd_model.vae.tile_overlap_factor = float(shared.opts.diffusers_vae_tile_overlap) + if shared.opts.diffusers_vae_tile_size > 0: + sd_model.vae.tile_sample_min_size = int(shared.opts.diffusers_vae_tile_size) + sd_model.vae.tile_latent_min_size = int(sd_model.vae.config.sample_size / (2 ** (len(sd_model.vae.config.block_out_channels) - 1))) + if shared.opts.diffusers_vae_tile_overlap != 0.25: + sd_model.vae.tile_overlap_factor = float(shared.opts.diffusers_vae_tile_overlap) shared.log.debug(f'Setting {op}: component=VAE tiling=True tile={sd_model.vae.tile_sample_min_size} overlap={sd_model.vae.tile_overlap_factor}') else: shared.log.debug(f'Setting {op}: component=VAE tiling=True') diff --git a/modules/shared.py b/modules/shared.py index 719200ed6..2ccb1e0a9 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -505,7 +505,7 @@ def get_default_modes(): "no_half_vae": OptionInfo(False if not cmd_opts.use_openvino else True, "Full precision (--no-half-vae)"), "diffusers_vae_slicing": OptionInfo(True, "VAE slicing", gr.Checkbox, {"visible": native}), "diffusers_vae_tiling": OptionInfo(cmd_opts.lowvram or cmd_opts.medvram, "VAE tiling", gr.Checkbox, {"visible": native}), - "diffusers_vae_tile_size": OptionInfo(1024, "VAE tile size", gr.Slider, {"minimum": 256, "maximum": 4096, "step": 8 }), + "diffusers_vae_tile_size": OptionInfo(0, "VAE tile size", gr.Slider, {"minimum": 0, "maximum": 4096, "step": 8 }), "diffusers_vae_tile_overlap": OptionInfo(0.25, "VAE tile overlap", gr.Slider, {"minimum": 0, "maximum": 0.95, "step": 0.05 }), "sd_vae_sliced_encode": OptionInfo(False, "VAE sliced encode", gr.Checkbox, {"visible": not native}), "nan_skip": OptionInfo(False, "Skip Generation if NaN found in latents", gr.Checkbox),