Skip to content

Commit 0c3cff5

Browse files
authored
Add comfyui-streamdiffusion node and trt engine build to entrypoint (yondonfu#208)
* add comfyui-streamdiffusion to nodes config * add stanza to build streamdiffusion engines
1 parent fb3af4f commit 0c3cff5

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

configs/nodes.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ nodes:
1414
url: "https://github.com/yuvraj108c/ComfyUI-Depth-Anything-Tensorrt"
1515
type: "tensorrt"
1616

17+
comfyui-streamdiffusion:
18+
name: "ComfyUI StreamDiffusion"
19+
url: "https://github.com/pschroedl/ComfyUI-StreamDiffusion"
20+
branch: "main"
21+
type: "tensorrt"
22+
1723
# Ryan's nodes
1824
comfyui-ryanontheinside:
1925
name: "ComfyUI RyanOnTheInside"

docker/entrypoint.sh

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ if [ "$1" = "--download-models" ]; then
4343
shift
4444
fi
4545

46-
DEPTH_ANYTHING_DIR="/workspace/ComfyUI/models/tensorrt/depth-anything"
46+
TENSORRT_DIR="/workspace/ComfyUI/models/tensorrt/"
4747

4848
if [ "$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
85103
fi
86104

87105
if [ "$1" = "--opencv-cuda" ]; then

0 commit comments

Comments
 (0)