From b7fef4f116505ffabd64c0d92d759a361dc2c913 Mon Sep 17 00:00:00 2001 From: if Date: Mon, 8 Sep 2025 21:23:57 +0100 Subject: [PATCH] fix: Correct advanced generator call and add auto-download to loader - Fixes a TypeError in the advanced generator by removing the 'compiled_model' kwarg before the function call. - Adds automatic model downloading to the HunyuanVideoFoleyModelLoader, ensuring the advanced workflow can self-initialize. This resolves issue #22. --- nodes.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nodes.py b/nodes.py index 813e9ac..b148e2f 100644 --- a/nodes.py +++ b/nodes.py @@ -651,6 +651,14 @@ class HunyuanVideoFoleyModelLoader: current_dir = os.path.dirname(os.path.abspath(__file__)) model_path = os.path.join(current_dir, "pretrained_models") + # Auto-download models if the directory doesn't exist + if not os.path.exists(model_path): + logger.info(f"Model directory not found at '{model_path}'. Attempting to download...") + # Use the download method from the base node + success, message = HunyuanVideoFoleyNode.download_models("hunyuanvideo-foley-xxl", model_path) + if not success: + return (None, f"❌ Auto-download failed: {message}") + if not config_path or not config_path.strip(): current_dir = os.path.dirname(os.path.abspath(__file__)) config_path = os.path.join(current_dir, "configs", "hunyuanvideo-foley-xxl.yaml") @@ -910,6 +918,7 @@ class HunyuanVideoFoleyGeneratorAdvanced(HunyuanVideoFoleyNode): logger.info("No pre-loaded model detected. Clearing state to force fresh load.") self.__class__._model_dict, self.__class__._cfg, self.__class__._model_path = None, None, None + kwargs.pop('compiled_model', None) return self.generate_audio(**kwargs) # Node mappings for ComfyUI