diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f4c804e4..4d44a2f09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ But there's more than SD3: - support for quantized **T5** text encoder in all models that use T5: FP4/FP8/FP16/INT8 (SD3, PixArt-Σ, etc) - support for **PixArt-Sigma** in small/medium/large variants - support for **HunyuanDiT 1.1** +- additional **NNCF weights compression** support: SD3, PixArt, ControlNet, Lora - (finally) new release of **Torch-DirectML** - additional efficiencies for users with low vram gpus - over 20 overall fixes @@ -47,6 +48,7 @@ But there's more than SD3: - support for `torch-directml` **0.2.2**, thanks @lshqqytiger! *note*: new directml is finally based on modern `torch` 2.3.1! - xyz grid: add support for LoRA selector +- vae load: store original vae so it can be restored when set to none - extra networks: info display now contains link to source url if model if its known works for civitai and huggingface models - force gc for lowvram users and improve gc logging @@ -56,11 +58,11 @@ But there's more than SD3: - additional torch gc checks, thanks @Disty0! **Improvements: NNCF**, thanks @Disty0! - - SD3 and PixArt support - - moved the first compression step to CPU - - sequential cpu offload (lowvram) support - - Lora support without reloading the model - - ControlNet compression support +- SD3 and PixArt support +- moved the first compression step to CPU +- sequential cpu offload (lowvram) support +- Lora support without reloading the model +- ControlNet compression support ### Fixes diff --git a/modules/sd_vae.py b/modules/sd_vae.py index 94a6c6b49..53b89161f 100644 --- a/modules/sd_vae.py +++ b/modules/sd_vae.py @@ -259,6 +259,11 @@ def reload_vae_weights(sd_model=None, vae_file=unspecified): vae_file, vae_source = resolve_vae(checkpoint_file) else: vae_source = "function-argument" + if vae_file is None or vae_file == 'None': + if hasattr(sd_model, 'original_vae'): + sd_models.set_diffuser_options(sd_model, vae=sd_model.original_vae, op='vae') + shared.log.info("VAE restored") + return None if loaded_vae_file == vae_file: return None if not shared.native and (shared.cmd_opts.lowvram or shared.cmd_opts.medvram): @@ -276,11 +281,14 @@ def reload_vae_weights(sd_model=None, vae_file=unspecified): if vae_file is not None: shared.log.info(f"VAE weights loaded: {vae_file}") else: - if hasattr(shared.sd_model, "vae") and hasattr(shared.sd_model, "sd_checkpoint_info"): - vae = load_vae_diffusers(shared.sd_model.sd_checkpoint_info.filename, vae_file, vae_source) + if hasattr(sd_model, "vae") and hasattr(sd_model, "sd_checkpoint_info"): + vae = load_vae_diffusers(sd_model.sd_checkpoint_info.filename, vae_file, vae_source) if vae is not None: + if not hasattr(sd_model, 'original_vae'): + sd_model.original_vae = sd_model.vae + sd_models.move_model(sd_model.original_vae, devices.cpu) sd_models.set_diffuser_options(sd_model, vae=vae, op='vae') - apply_vae_config(shared.sd_model.sd_checkpoint_info.filename, vae_file, sd_model) + apply_vae_config(sd_model.sd_checkpoint_info.filename, vae_file, sd_model) if not shared.cmd_opts.lowvram and not shared.cmd_opts.medvram: sd_models.move_model(sd_model, devices.device)