Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if [ ! -d "/workspace/comfystream/nodes/web/static" ]; then
fi

# Create a symlink to the entrypoint script.
echo 'alias prepare_examples="/workspace/comfystream/docker/entrypoint.sh --download-models --build-engines"' >> ~/.bashrc
echo 'alias prepare_examples="/workspace/comfystream/docker/entrypoint.sh --download-models"' >> ~/.bashrc
echo -e "\e[32mContainer ready! Run 'prepare_examples' to download models and build engines for example workflows.\e[0m"

cd /workspace/comfystream
Expand Down
54 changes: 53 additions & 1 deletion configs/models.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,68 @@ models:
extra_files:
- url: "https://huggingface.co/aaronb/dreamshaper-8-dmd-1kstep/raw/main/config.json"
path: "unet/dreamshaper-8-dmd-1kstep.json"

tensorrt:
build: true
## These engine files needs to be on the output directory for the TensorRT Loader to find them
## ------------------------------------------------------------------------------------------------------------------------------ ##
engines:
- script: "src/comfystream/scripts/build_trt.py"
engine_path: "output/tensorrt/static-dreamshaper8_SD15_$stat-b-1-h-512-w-512_00001_.engine"
args:
- "--model"
- "{model_path}"
- "--out-engine"
- "{engine_path}"
- script: "src/comfystream/scripts/build_trt.py"
engine_path: "output/tensorrt/dynamic-dreamshaper8_SD15_$dyn-b-1-4-2-h-448-704-512-w-448-704-512_00001_.engine"
args:
- "--model"
- "{model_path}"
- "--out-engine"
- "{engine_path}"
- "--width"
- "512"
- "--height"
- "512"
- "--min-width"
- "448"
- "--min-height"
- "448"
- "--max-width"
- "704"
- "--max-height"
- "704"
## ------------------------------------------------------------------------------------------------------------------------------ ##
# Depth Anything V2 ONNX models
depthanything-onnx:
name: "DepthAnything ONNX"
url: "https://huggingface.co/yuvraj108c/Depth-Anything-2-Onnx/resolve/main/depth_anything_v2_vitb.onnx?download=true"
path: "tensorrt/depth-anything/depth_anything_vitl14.onnx"
tensorrt:
build: true
engines:
- script: "custom_nodes/ComfyUI-Depth-Anything-Tensorrt/export_trt.py"
engine_path: "tensorrt/depth-anything/depth_anything_vitl14-fp16.engine"
args:
- "--trt-path"
- "{engine_path}"
- "--onnx-path"
- "{model_path}"

depth-anything-v2-large-onnx:
name: "DepthAnything V2 Large ONNX"
url: "https://huggingface.co/yuvraj108c/Depth-Anything-2-Onnx/resolve/main/depth_anything_v2_vitl.onnx?download=true"
path: "tensorrt/depth-anything/depth_anything_v2_vitl.onnx"
tensorrt:
build: true
engines:
- script: "custom_nodes/ComfyUI-Depth-Anything-Tensorrt/export_trt.py"
engine_path: "tensorrt/depth-anything/depth_anything_v2_vitl-fp16.engine"
args:
- "--trt-path"
- "{engine_path}"
- "--onnx-path"
- "{model_path}"

# TAESD models
taesd:
Expand Down
48 changes: 4 additions & 44 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ show_help() {
echo "Usage: entrypoint.sh [OPTIONS]"
echo ""
echo "Options:"
echo " --download-models Download default models"
echo " --build-engines Build TensorRT engines for default models"
echo " --download-models Download default models and build required TensorRT engines"
echo " --opencv-cuda Setup OpenCV with CUDA support"
echo " --server Start the Comfystream server, UI and ComfyUI"
echo " --help Show this help message"
Expand All @@ -37,48 +36,9 @@ fi
if [ "$1" = "--download-models" ]; then
cd /workspace/comfystream
conda activate comfystream
python src/comfystream/scripts/setup_models.py --workspace /workspace/ComfyUI
shift
fi

DEPTH_ANYTHING_DIR="/workspace/ComfyUI/models/tensorrt/depth-anything"

if [ "$1" = "--build-engines" ]; then
cd /workspace/comfystream
conda activate comfystream

# Build Static Engine for Dreamshaper
python src/comfystream/scripts/build_trt.py --model /workspace/ComfyUI/models/unet/dreamshaper-8-dmd-1kstep.safetensors --out-engine /workspace/ComfyUI/output/tensorrt/static-dreamshaper8_SD15_\$stat-b-1-h-512-w-512_00001_.engine

# Build Dynamic Engine for Dreamshaper
python src/comfystream/scripts/build_trt.py \
--model /workspace/ComfyUI/models/unet/dreamshaper-8-dmd-1kstep.safetensors \
--out-engine /workspace/ComfyUI/output/tensorrt/dynamic-dreamshaper8_SD15_\$dyn-b-1-4-2-h-448-704-512-w-448-704-512_00001_.engine \
--width 512 \
--height 512 \
--min-width 448 \
--min-height 448 \
--max-width 704 \
--max-height 704

# Build Engine for Depth Anything V2
if [ ! -f "$DEPTH_ANYTHING_DIR/depth_anything_vitl14-fp16.engine" ]; then
if [ ! -d "$DEPTH_ANYTHING_DIR" ]; then
mkdir -p "$DEPTH_ANYTHING_DIR"
fi
cd "$DEPTH_ANYTHING_DIR"
python /workspace/ComfyUI/custom_nodes/ComfyUI-Depth-Anything-Tensorrt/export_trt.py
else
echo "Engine for DepthAnything2 already exists, skipping..."
fi

# Build Engine for Depth Anything2 (large)
if [ ! -f "$DEPTH_ANYTHING_DIR/depth_anything_v2_vitl-fp16.engine" ]; then
cd "$DEPTH_ANYTHING_DIR"
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"
else
echo "Engine for DepthAnything2 (large) already exists, skipping..."
fi

# Now also builds engines configured in models.yaml
python src/comfystream/scripts/setup_models.py --workspace /workspace/ComfyUI --build-engines
shift
fi

Expand Down
Loading
Loading