From ef2e3d782cb1ec45fa3a311e2b0b932f1308bb71 Mon Sep 17 00:00:00 2001 From: Dominik Boller Date: Fri, 30 May 2025 05:16:17 +0200 Subject: [PATCH] Fix: AttributeError when switching between models with "Baked VAE" and LoRAs (#323) --- efficiency_nodes.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/efficiency_nodes.py b/efficiency_nodes.py index e74381b..59992db 100644 --- a/efficiency_nodes.py +++ b/efficiency_nodes.py @@ -155,11 +155,17 @@ class TSC_EfficientLoader: if lora_stack: lora_params.extend(lora_stack) - # Load LoRa(s) - model, clip = load_lora(lora_params, ckpt_name, my_unique_id, cache=lora_cache, ckpt_cache=ckpt_cache, cache_overwrite=True) + # Load LoRA(s) + model, clip = load_lora(lora_params, ckpt_name, my_unique_id, cache=lora_cache, ckpt_cache=ckpt_cache, + cache_overwrite=True) if vae_name == "Baked VAE": vae = get_bvae_by_ckpt_name(ckpt_name) + if vae is None: + print( + f"{warning('Efficiency Nodes:')} Baked VAE not found in cache, loading checkpoint to extract VAE...") + _, _, vae = load_checkpoint(ckpt_name, my_unique_id, output_vae=True, cache=ckpt_cache, + cache_overwrite=True) else: model, clip, vae = load_checkpoint(ckpt_name, my_unique_id, cache=ckpt_cache, cache_overwrite=True) lora_params = None