Skip to content
Merged
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/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"python.defaultInterpreterPath": "/workspace/miniconda3/envs/comfystream/bin/python",
"python.venvPath": "/workspace/miniconda3/envs",
"python.terminal.activateEnvInCurrentTerminal": false,
"python.terminal.activateEnvironment": false,
"python.terminal.activateEnvironment": true,
"terminal.integrated.shellIntegration.enabled": true
},
"extensions": [
Expand Down
17 changes: 2 additions & 15 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,6 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[.gitignore]
insert_final_newline = unset

[*.py]
indent_size = 4

[workflows/comfy*/*.json]
insert_final_newline = unset

[Dockerfile*]
indent_size = 4

[*.{md,txt,mkdn}]
indent_size = 4
indent_size = unset
trim_trailing_whitespace = false
indent_style = tab
indent_size = 8
2 changes: 0 additions & 2 deletions .github/codeql-config.yaml

This file was deleted.

14 changes: 10 additions & 4 deletions .github/workflows/comfyui-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ name: Build and push comfyui-base docker image

on:
pull_request:
paths-ignore:
- "ui/*"
paths:
- docker/Dockerfile.base
- src/comfystream/scripts/
- configs/
- .github/workflows/comfyui-base.yaml
branches:
- main
push:
paths-ignore:
- "ui/*"
paths:
- docker/Dockerfile.base
- src/comfystream/scripts/
- configs/
- .github/workflows/comfyui-base.yaml
branches:
- main
tags:
Expand Down
86 changes: 0 additions & 86 deletions .github/workflows/test.yaml

This file was deleted.

7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ __pycache__
*.egg-info
build
.DS_STORE
./comfyui/
./ComfyUI/
comfyui/
ComfyUI/
cuda_temp

# VS Code settings
Expand All @@ -22,6 +22,3 @@ launch.json
nodes/web/static/*
.cursor/
!nodes/web/static/.gitkeep

# opencv files
opencv
8 changes: 2 additions & 6 deletions configs/models.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@ models:
- url: "https://huggingface.co/aaronb/dreamshaper-8-dmd-1kstep/raw/main/config.json"
path: "unet/dreamshaper-8-dmd-1kstep.json"

# Depth Anything V2 ONNX models
# Depth Anything ONNX model
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"
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"

# TAESD models
taesd:
Expand Down Expand Up @@ -72,4 +68,4 @@ models:
name: "ClipTextModel"
url: "https://huggingface.co/Lykon/dreamshaper-8/resolve/main/text_encoder/model.fp16.safetensors"
path: "text_encoders/CLIPText/model.fp16.safetensors"
type: "text_encoder"
type: "text_encoder"
7 changes: 3 additions & 4 deletions configs/nodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ nodes:

comfyui-depthanything-tensorrt:
name: "ComfyUI DepthAnything TensorRT"
url: "https://github.com/rickstaa/ComfyUI-Depth-Anything-Tensorrt"
branch: "feature/add-export-trt-args"
url: "https://github.com/yuvraj108c/ComfyUI-Depth-Anything-Tensorrt"
type: "tensorrt"

# Ryan's nodes
Expand Down Expand Up @@ -74,5 +73,5 @@ nodes:
comfyui-stream-pack:
name: "ComfyUI Stream Pack"
url: "https://github.com/livepeer/ComfyUI-Stream-Pack"
branch: "main"
type: "utility"
branch: "expose_feature_bank_to_comfyui"
type: "utility"
1 change: 1 addition & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ RUN bash -c "source $NVM_DIR/nvm.sh && \
ENV NODE_PATH="$NVM_DIR/v$NODE_VERSION/lib/node_modules" \
PATH="$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH"

RUN conda init bash

# Create the supervisor configuration file for ComfyUI and ComfyStream
COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
Expand Down
28 changes: 11 additions & 17 deletions docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,19 @@ RUN mkdir -p /workspace/comfystream && \
wget "https://repo.anaconda.com/miniconda/Miniconda3-${CONDA_VERSION}-Linux-x86_64.sh" -O /tmp/miniconda.sh && \
bash /tmp/miniconda.sh -b -p /workspace/miniconda3 && \
eval "$(/workspace/miniconda3/bin/conda shell.bash hook)" && \
conda create -n comfystream python="${PYTHON_VERSION}" ffmpeg=6 -c conda-forge -y && \
rm /tmp/miniconda.sh && echo 'export LD_LIBRARY_PATH=/workspace/miniconda3/envs/comfystream/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
conda create -n comfystream python="${PYTHON_VERSION}" -y && \
rm /tmp/miniconda.sh && \
conda run -n comfystream --no-capture-output pip install aiortc aiohttp requests tqdm pyyaml --root-user-action=ignore

# Clone ComfyUI
RUN git clone https://github.com/comfyanonymous/ComfyUI.git /workspace/ComfyUI
ADD --link https://github.com/comfyanonymous/ComfyUI.git /workspace/ComfyUI

# Copy only files needed for setup
COPY ./src/comfystream/scripts /workspace/comfystream/src/comfystream/scripts
COPY ./configs /workspace/comfystream/configs
COPY --link ./src/comfystream/scripts /workspace/comfystream/src/comfystream/scripts
COPY --link ./configs /workspace/comfystream/configs

# Run setup_nodes (cached unless setup_nodes.py or nodes/ changes)
RUN conda run -n comfystream --no-capture-output --cwd /workspace/comfystream python src/comfystream/scripts/setup_nodes.py --workspace /workspace/ComfyUI

# Copy ComfyStream files into ComfyUI
COPY . /workspace/comfystream
Expand All @@ -48,24 +52,14 @@ COPY ./test/example-512x512.png /workspace/ComfyUI/input
RUN conda run -n comfystream --no-capture-output --cwd /workspace/ComfyUI pip install -r requirements.txt --root-user-action=ignore

# Install ComfyStream requirements
RUN conda run -n comfystream --no-capture-output --cwd /workspace/comfystream pip install -r requirements.txt --root-user-action=ignore
RUN conda run -n comfystream --no-capture-output --cwd /workspace/comfystream pip install . --root-user-action=ignore
RUN ln -s /workspace/comfystream /workspace/ComfyUI/custom_nodes/comfystream
RUN conda run -n comfystream --no-capture-output --cwd /workspace/comfystream pip install -e . --root-user-action=ignore
RUN conda run -n comfystream --no-capture-output --cwd /workspace/comfystream python install.py --workspace /workspace/ComfyUI

# Run setup_nodes
RUN conda run -n comfystream --no-capture-output --cwd /workspace/comfystream python src/comfystream/scripts/setup_nodes.py --workspace /workspace/ComfyUI

# Install additional dependencies
RUN conda run -n comfystream --no-capture-output pip install --upgrade tensorrt-cu12-bindings tensorrt-cu12-libs --root-user-action=ignore

# Setup opencv with CUDA support
RUN conda run -n comfystream --no-capture-output bash /workspace/comfystream/docker/entrypoint.sh --opencv-cuda

# Configure no environment activation by default
RUN conda config --set auto_activate_base false && \
conda init bash

# Set comfystream environment as default
RUN echo "conda activate comfystream" >> ~/.bashrc

WORKDIR /workspace/comfystream
71 changes: 1 addition & 70 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ show_help() {
echo "Options:"
echo " --download-models Download default models"
echo " --build-engines Build TensorRT engines for default models"
echo " --opencv-cuda Setup OpenCV with CUDA support"
echo " --server Start the Comfystream server, UI and ComfyUI"
echo " --help Show this help message"
echo ""
Expand All @@ -50,18 +49,7 @@ if [ "$1" = "--build-engines" ]; then
# 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
# Build Engine for DepthAnything2
if [ ! -f "$DEPTH_ANYTHING_DIR/depth_anything_vitl14-fp16.engine" ]; then
if [ ! -d "$DEPTH_ANYTHING_DIR" ]; then
mkdir -p "$DEPTH_ANYTHING_DIR"
Expand All @@ -71,66 +59,9 @@ if [ "$1" = "--build-engines" ]; then
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
shift
fi

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

# Check if OpenCV CUDA build already exists
if [ ! -f "/workspace/comfystream/opencv-cuda-release.tar.gz" ]; then
# Download and extract OpenCV CUDA build
DOWNLOAD_NAME="opencv-cuda-release.tar.gz"
wget -q -O "$DOWNLOAD_NAME" https://github.com/JJassonn69/ComfyUI-Stream-Pack/releases/download/v1.0/opencv-cuda-release.tar.gz
tar -xzf "$DOWNLOAD_NAME" -C /workspace/comfystream/
rm "$DOWNLOAD_NAME"
else
echo "OpenCV CUDA build already exists, skipping download."
fi

# Install required libraries
apt-get update && apt-get install -y \
libgflags-dev \
libgoogle-glog-dev \
libjpeg-dev \
libavcodec-dev \
libavformat-dev \
libavutil-dev \
libswscale-dev

# Remove existing cv2 package
SITE_PACKAGES_DIR="/workspace/miniconda3/envs/comfystream/lib/python3.11/site-packages"
rm -rf "${SITE_PACKAGES_DIR}/cv2"*

# Copy new cv2 package
cp -r /workspace/comfystream/cv2 "${SITE_PACKAGES_DIR}/"

# Handle library dependencies
CONDA_ENV_LIB="/workspace/miniconda3/envs/comfystream/lib"

# Remove existing libstdc++ and copy system one
rm -f "${CONDA_ENV_LIB}/libstdc++.so"*
cp /usr/lib/x86_64-linux-gnu/libstdc++.so* "${CONDA_ENV_LIB}/"

# Copy OpenCV libraries
cp /workspace/comfystream/opencv/build/lib/libopencv_* /usr/lib/x86_64-linux-gnu/

# remove the opencv-contrib and cv2 folders
rm -rf /workspace/comfystream/opencv_contrib
rm -rf /workspace/comfystream/cv2

echo "OpenCV CUDA installation completed"
shift
fi

if [ "$1" = "--server" ]; then
/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
Expand Down
15 changes: 15 additions & 0 deletions nodes/web/js/comfystream_ui_preview_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,25 @@ app.registerExtension({
});
});

// Update iframe size
this.updateIframeSize();

return result;
};

// Override the resize method to allow both expanding and shrinking
nodeType.prototype.onResize = function(size) {
// Update the size
this.size[0] = size[0];
this.size[1] = size[1];

// Update the iframe size
this.updateIframeSize();

// Force canvas update
this.setDirtyCanvas(true, true);
};

// Add a helper method to update iframe size
nodeType.prototype.updateIframeSize = function() {
if (this.iframeWidget) {
Expand Down
1 change: 0 additions & 1 deletion opencv_contrib
Submodule opencv_contrib deleted from 0e5254
Loading