Compare commits

...
2 Commits
4 changed files with 17 additions and 11 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
import importlib
import logging
version_code = [1, 3, 3]
version_code = [1, 3, 4]
version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
logging.info(f"### Loading: ComfyUI-Impact-Subpack ({version_str})")
+9 -9
View File
@@ -87,9 +87,9 @@ def load_whitelist(filepath):
except FileNotFoundError:
# This block now runs only if the directory was created successfully but the file is missing
logging.warning(f"[Impact Pack/Subpack] Model whitelist file not found at: {filepath}. ")
logging.warning(f" >> An empty whitelist file will be created.")
logging.warning(f" >> To allow unsafe loading for specific trusted legacy models (e.g., older .pt),")
logging.warning(f" >> add their base filenames (one per line) to this file.")
logging.warning(" >> An empty whitelist file will be created.")
logging.warning(" >> To allow unsafe loading for specific trusted legacy models (e.g., older .pt),")
logging.warning(" >> add their base filenames (one per line) to this file.")
try:
# Attempt to create the file with comments since it wasn't found
# This should now succeed because os.makedirs created the directory
@@ -139,7 +139,7 @@ def restricted_getattr(obj, name, *args):
if name != "forward":
logging.error(f"Access to potentially dangerous attribute '{obj.__module__}.{obj.__name__}.{name}' is blocked.\nIf you believe the use of this code is genuinely safe, please report it.\nhttps://github.com/ltdrdata/ComfyUI-Impact-Subpack/issues")
raise RuntimeError(f"Access to potentially dangerous attribute '{obj.__module__}.{obj.__name__}.{name}' is blocked.")
return getattr(obj, name, *args)
restricted_getattr.__module__ = 'builtins'
@@ -313,7 +313,7 @@ def torch_wrapper(*args, **kwargs):
if filename and filename in _MODEL_WHITELIST:
logging.warning("##############################################################################")
logging.warning(f"[Impact Pack/Subpack] SUCCESS: File '{filename}' FOUND in reloaded whitelist.")
logging.warning(f" >> Proceeding with whitelisted unsafe load (weights_only=False).")
logging.warning(" >> Proceeding with whitelisted unsafe load (weights_only=False).")
logging.warning(f" >> Ensure you recently added this file to: {whitelist_path_msg}")
logging.warning(" >> SECURITY RISK: Ensure you trust its source.")
logging.warning("##############################################################################")
@@ -332,15 +332,15 @@ def torch_wrapper(*args, **kwargs):
# --- Blocked: Not Whitelisted (Original Logic - runs if reload failed or file still not found) ---
logging.error("##############################################################################")
logging.error(f"[Impact Pack/Subpack] ERROR: Safe load failed for '{filename_arg_source}' (Reason: {e}).")
logging.error(f" >> This model likely uses legacy Python features blocked by default for security.")
logging.error(" >> This model likely uses legacy Python features blocked by default for security.")
# Updated log message here:
logging.error(f" >> UNSAFE LOAD BLOCKED because the file ('{filename or 'unknown'}') is NOT in the whitelist (even after reload attempt).")
logging.error(f" >> Whitelist path: {whitelist_path_msg}")
if filename:
logging.error(f" >> To allow loading this specific file (IF YOU TRUST IT), ensure its base name")
logging.error(" >> To allow loading this specific file (IF YOU TRUST IT), ensure its base name")
logging.error(f" >> ('{filename}') is correctly added to the whitelist file (one name per line) and saved.")
else:
logging.error(f" >> Cannot determine filename to check against whitelist.")
logging.error(" >> Cannot determine filename to check against whitelist.")
logging.error(" >> SECURITY RISK: Only whitelist files from sources you absolutely trust.")
logging.error(" >> Prefer using .safetensors files whenever available.")
logging.error("##############################################################################")
@@ -596,4 +596,4 @@ class UltraSegmDetector:
return utils.combine_masks(segmasks)
def setAux(self, x):
pass
pass
+6
View File
@@ -31,6 +31,12 @@ class UltralyticsDetectorProvider:
def doit(self, model_name):
model_path = folder_paths.get_full_path("ultralytics", model_name)
if model_path is None:
if model_name.startswith('bbox/'):
model_path = folder_paths.get_full_path("ultralytics_bbox", model_name[5:])
elif model_name.startswith('segm/'):
model_path = folder_paths.get_full_path("ultralytics_segm", model_name[5:])
if model_path is None:
logging.error(f"[Impact Subpack] model file '{model_name}' is not found in one of the following directories:")
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui-impact-subpack"
description = "This node pack provides nodes that complement the Impact Pack, such as the UltralyticsDetectorProvider."
version = "1.3.3"
version = "1.3.4"
license = { file = "LICENSE.txt" }
dependencies = ["matplotlib", "ultralytics"]