mirror of
https://github.com/jags111/efficiency-nodes-comfyui.git
synced 2026-03-21 21:22:13 -03:00
Refactor: Extract VAE error message into helper function
Co-authored-by: jags111 <5968619+jags111@users.noreply.github.com>
This commit is contained in:
@@ -99,6 +99,16 @@ def encode_prompts(positive_prompt, negative_prompt, token_normalization, weight
|
||||
elif return_type == "both":
|
||||
return positive_encoded, negative_encoded, clip, refiner_positive_encoded, refiner_negative_encoded, refiner_clip
|
||||
|
||||
########################################################################################################################
|
||||
# Helper function for VAE error message
|
||||
def get_missing_vae_error(ckpt_name):
|
||||
"""Generate error message for checkpoints without embedded VAE"""
|
||||
return (
|
||||
f"Checkpoint '{ckpt_name}' does not contain an embedded VAE. "
|
||||
f"This checkpoint (likely an AIO model) requires an external VAE. "
|
||||
f"Please select a VAE file instead of 'Baked VAE'."
|
||||
)
|
||||
|
||||
########################################################################################################################
|
||||
# TSC Efficient Loader
|
||||
class TSC_EfficientLoader:
|
||||
@@ -168,11 +178,7 @@ class TSC_EfficientLoader:
|
||||
cache_overwrite=True)
|
||||
# Check if VAE extraction was successful
|
||||
if vae is None:
|
||||
raise ValueError(
|
||||
f"Checkpoint '{ckpt_name}' does not contain an embedded VAE. "
|
||||
f"This checkpoint (likely an AIO model) requires an external VAE. "
|
||||
f"Please select a VAE file instead of 'Baked VAE'."
|
||||
)
|
||||
raise ValueError(get_missing_vae_error(ckpt_name))
|
||||
else:
|
||||
model, clip, vae = load_checkpoint(ckpt_name, my_unique_id, cache=ckpt_cache, cache_overwrite=True)
|
||||
lora_params = None
|
||||
@@ -204,11 +210,7 @@ class TSC_EfficientLoader:
|
||||
vae = load_vae(vae_name, my_unique_id, cache=vae_cache, cache_overwrite=True)
|
||||
elif vae is None:
|
||||
# If "Baked VAE" was selected but checkpoint has no embedded VAE
|
||||
raise ValueError(
|
||||
f"Checkpoint '{ckpt_name}' does not contain an embedded VAE. "
|
||||
f"This checkpoint (likely an AIO model) requires an external VAE. "
|
||||
f"Please select a VAE file instead of 'Baked VAE'."
|
||||
)
|
||||
raise ValueError(get_missing_vae_error(ckpt_name))
|
||||
|
||||
# Data for XY Plot
|
||||
dependencies = (vae_name, ckpt_name, clip, clip_skip, refiner_name, refiner_clip, refiner_clip_skip,
|
||||
|
||||
Reference in New Issue
Block a user