@@ -43,7 +43,7 @@ if [ "$1" = "--download-models" ]; then
4343 shift
4444fi
4545
46- DEPTH_ANYTHING_DIR =" /workspace/ComfyUI/models/tensorrt/depth-anything "
46+ TENSORRT_DIR =" /workspace/ComfyUI/models/tensorrt/"
4747
4848if [ " $1 " = " --build-engines" ]; then
4949 cd /workspace/comfystream
@@ -64,24 +64,42 @@ if [ "$1" = "--build-engines" ]; then
6464 --max-height 704
6565
6666 # Build Engine for Depth Anything V2
67- if [ ! -f " $DEPTH_ANYTHING_DIR /depth_anything_vitl14-fp16.engine" ]; then
68- if [ ! -d " $DEPTH_ANYTHING_DIR " ]; then
69- mkdir -p " $DEPTH_ANYTHING_DIR "
67+ if [ ! -f " $TENSORRT_DIR /depth-anything /depth_anything_vitl14-fp16.engine" ]; then
68+ if [ ! -d " $TENSORRT_DIR /depth-anything " ]; then
69+ mkdir -p " $TENSORRT_DIR /depth-anything "
7070 fi
71- cd " $DEPTH_ANYTHING_DIR "
71+ cd " $TENSORRT_DIR /depth-anything "
7272 python /workspace/ComfyUI/custom_nodes/ComfyUI-Depth-Anything-Tensorrt/export_trt.py
7373 else
7474 echo " Engine for DepthAnything2 already exists, skipping..."
7575 fi
7676
7777 # Build Engine for Depth Anything2 (large)
78- if [ ! -f " $DEPTH_ANYTHING_DIR /depth_anything_v2_vitl-fp16.engine" ]; then
79- cd " $DEPTH_ANYTHING_DIR "
80- python /workspace/ComfyUI/custom_nodes/ComfyUI-Depth-Anything-Tensorrt/export_trt.py --trt-path " ${DEPTH_ANYTHING_DIR} / depth_anything_v2_vitl-fp16.engine" --onnx-path " ${DEPTH_ANYTHING_DIR} /depth_anything_v2_vitl.onnx"
78+ if [ ! -f " $TENSORRT_DIR /depth-anything /depth_anything_v2_vitl-fp16.engine" ]; then
79+ cd " $TENSORRT_DIR /depth-anything "
80+ python /workspace/ComfyUI/custom_nodes/ComfyUI-Depth-Anything-Tensorrt/export_trt.py --trt-path " ${TENSORRT_DIR} /depth-anything/ depth_anything_v2_vitl-fp16.engine" --onnx-path " ${TENSORRT_DIR} /depth-anything /depth_anything_v2_vitl.onnx"
8181 else
8282 echo " Engine for DepthAnything2 (large) already exists, skipping..."
8383 fi
8484 shift
85+
86+ # Build Engine for StreamDiffusion
87+ if [ ! -f " $TENSORRT_DIR /StreamDiffusion-engines/stream_diffusion_v2_1_fp16.engine" ]; then # TODO: fix relevant file to check
88+ cd /workspace/ComfyUI/custom_nodes/ComfyUI-StreamDiffusion
89+ MODELS=" stabilityai/sd-turbo KBlueLeaf/kohaku-v2.1"
90+ TIMESTEPS=" 3"
91+ for model in $MODELS ; do
92+ for timestep in $TIMESTEPS ; do
93+ echo " Building model=$model with timestep=$timestep "
94+ python build_tensorrt.py \
95+ --model-id " $model " \
96+ --timesteps " $timestep " \
97+ --engine-dir $TENSORRT_DIR /StreamDiffusion-engines
98+ done
99+ done
100+ else
101+ echo " Engine for StreamDiffusion already exists, skipping..."
102+ fi
85103fi
86104
87105if [ " $1 " = " --opencv-cuda" ]; then
0 commit comments