@@ -138,17 +138,40 @@ if [ "$1" = "--build-engines" ]; then
138138 echo " Engines for FasterLivePortrait already exists, skipping..."
139139 fi
140140
141- # Build Engine for StreamDiffusion using trt script and config
142- ENGINE_SCRIPT=" /workspace/ComfyUI/custom_nodes/ComfyUI-StreamDiffusion/scripts/build_tensorrt_engines.py"
143- CONFIGS=(
144- " /workspace/ComfyUI/custom_nodes/ComfyUI-StreamDiffusion/configs/sd15_singlecontrol.yaml"
145- " /workspace/ComfyUI/custom_nodes/ComfyUI-StreamDiffusion/configs/sdturbo_multicontrol.yaml"
146- )
147- cd /workspace/ComfyUI/custom_nodes/ComfyUI-StreamDiffusion/scripts
148- for ENGINE_CONFIG in " ${CONFIGS[@]} " ; do
149- echo " Building StreamDiffusion TensorRT engines using config: $ENGINE_CONFIG "
150- python " $ENGINE_SCRIPT " --config " $ENGINE_CONFIG "
151- done
141+ # Build Engine for StreamDiffusion using build_targets.yaml (dynamic, robust)
142+ BUILD_TARGETS_FILE=" /workspace/comfystream/configs/build_targets.yaml"
143+ if [ ! -f " $BUILD_TARGETS_FILE " ]; then
144+ echo " build_targets.yaml not found at $BUILD_TARGETS_FILE . Skipping StreamDiffusion engine builds."
145+ else
146+ python3 - << 'EOF '
147+ import os
148+ import yaml
149+ import subprocess
150+
151+ with open("/workspace/comfystream/configs/build_targets.yaml", "r") as f:
152+ targets = yaml.safe_load(f)
153+
154+ info = targets.get("streamdiffusion")
155+ if info:
156+ folder = info.get("folder")
157+ script = info.get("script")
158+ configs = info.get("configs", [])
159+ if folder and os.path.isdir(folder) and script and os.path.isfile(script):
160+ for config in configs:
161+ if os.path.isfile(config):
162+ print(f"Building streamdiffusion engine with config: {config}")
163+ try:
164+ subprocess.run(["python", script, "--config", config], check=True)
165+ except subprocess.CalledProcessError as e:
166+ print(f"Error building engine for config {config}: {e}")
167+ else:
168+ print(f"Warning: Config {config} for streamdiffusion not found, skipping...")
169+ else:
170+ print(f"Skipping streamdiffusion: required folder or script not found.")
171+ else:
172+ print("streamdiffusion not found in build_targets.yaml, skipping...")
173+ EOF
174+ fi
152175 shift
153176fi
154177
@@ -218,4 +241,6 @@ if [ "$START_COMFYUI" = true ] || [ "$START_API" = true ] || [ "$START_UI" = tru
218241 tail -f /var/log/supervisord.log
219242fi
220243
244+
245+
221246exec " $@ "
0 commit comments