mirror of
https://github.com/jags111/efficiency-nodes-comfyui.git
synced 2026-05-07 17:16:44 -03:00
Compare commits
4 Commits
copilot/fi
...
copilot/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40105e68f0 | ||
|
|
c819d6135a | ||
|
|
b0e2632310 | ||
|
|
d79e4bc801 |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1,8 +1,10 @@
|
|||||||
# Python
|
# Python cache
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
*$py.class
|
*$py.class
|
||||||
*.so
|
*.so
|
||||||
|
|
||||||
|
# Distribution / packaging
|
||||||
.Python
|
.Python
|
||||||
build/
|
build/
|
||||||
develop-eggs/
|
develop-eggs/
|
||||||
@@ -25,7 +27,7 @@ venv/
|
|||||||
ENV/
|
ENV/
|
||||||
env/
|
env/
|
||||||
|
|
||||||
# IDE
|
# IDEs
|
||||||
.vscode/
|
.vscode/
|
||||||
.idea/
|
.idea/
|
||||||
*.swp
|
*.swp
|
||||||
|
|||||||
@@ -99,6 +99,16 @@ def encode_prompts(positive_prompt, negative_prompt, token_normalization, weight
|
|||||||
elif return_type == "both":
|
elif return_type == "both":
|
||||||
return positive_encoded, negative_encoded, clip, refiner_positive_encoded, refiner_negative_encoded, refiner_clip
|
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
|
# TSC Efficient Loader
|
||||||
class TSC_EfficientLoader:
|
class TSC_EfficientLoader:
|
||||||
@@ -166,6 +176,9 @@ class TSC_EfficientLoader:
|
|||||||
f"{warning('Efficiency Nodes:')} Baked VAE not found in cache, loading checkpoint to extract VAE...")
|
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,
|
_, _, vae = load_checkpoint(ckpt_name, my_unique_id, output_vae=True, cache=ckpt_cache,
|
||||||
cache_overwrite=True)
|
cache_overwrite=True)
|
||||||
|
# Check if VAE extraction was successful
|
||||||
|
if vae is None:
|
||||||
|
raise ValueError(get_missing_vae_error(ckpt_name))
|
||||||
else:
|
else:
|
||||||
model, clip, vae = load_checkpoint(ckpt_name, my_unique_id, cache=ckpt_cache, cache_overwrite=True)
|
model, clip, vae = load_checkpoint(ckpt_name, my_unique_id, cache=ckpt_cache, cache_overwrite=True)
|
||||||
lora_params = None
|
lora_params = None
|
||||||
@@ -195,6 +208,9 @@ class TSC_EfficientLoader:
|
|||||||
# Check for custom VAE
|
# Check for custom VAE
|
||||||
if vae_name != "Baked VAE":
|
if vae_name != "Baked VAE":
|
||||||
vae = load_vae(vae_name, my_unique_id, cache=vae_cache, cache_overwrite=True)
|
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(get_missing_vae_error(ckpt_name))
|
||||||
|
|
||||||
# Data for XY Plot
|
# Data for XY Plot
|
||||||
dependencies = (vae_name, ckpt_name, clip, clip_skip, refiner_name, refiner_clip, refiner_clip_skip,
|
dependencies = (vae_name, ckpt_name, clip, clip_skip, refiner_name, refiner_clip, refiner_clip_skip,
|
||||||
@@ -3958,12 +3974,6 @@ class TSC_ImageOverlay:
|
|||||||
overlay_image = comfy.utils.common_upscale(samples, overlay_image_size[0], overlay_image_size[1], resize_method, False)
|
overlay_image = comfy.utils.common_upscale(samples, overlay_image_size[0], overlay_image_size[1], resize_method, False)
|
||||||
overlay_image = overlay_image.movedim(1, -1)
|
overlay_image = overlay_image.movedim(1, -1)
|
||||||
|
|
||||||
# Handle batch dimension - use first image if overlay_image is a batch
|
|
||||||
if len(overlay_image.shape) == 4:
|
|
||||||
if overlay_image.shape[0] > 1:
|
|
||||||
print(f"{warning('Image Overlay Warning:')} Multiple overlay images detected ({overlay_image.shape[0]}), using only the first image.")
|
|
||||||
overlay_image = overlay_image[0]
|
|
||||||
|
|
||||||
overlay_image = tensor2pil(overlay_image)
|
overlay_image = tensor2pil(overlay_image)
|
||||||
|
|
||||||
# Add Alpha channel to overlay
|
# Add Alpha channel to overlay
|
||||||
|
|||||||
Reference in New Issue
Block a user