Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a4c564d
removing max frameRate fixes error on Safari (#8)
llandau Mar 17, 2025
2a89781
Combobox support for control panel (#18)
JJassonn69 Mar 19, 2025
119537f
fix: temporarily disable sam-2 node (#46)
eliteprox Mar 21, 2025
ac02e2e
fix comfystream preview js error (#47)
eliteprox Mar 21, 2025
1bfcfd8
workflow: Add workflow for testing/linting (#36)
hjpotter92 Mar 28, 2025
f3f5d1a
workflows: Build more of comfyui-base docker image (#66)
hjpotter92 Mar 28, 2025
670a997
add librosa, remove requirements.txt (#37)
eliteprox Mar 28, 2025
6755be2
changes the branch to master for ComfyUI-StreamPack (#67)
eliteprox Mar 29, 2025
79f6775
Revert "fix: temporarily disable sam-2 node (#46)" (#68)
eliteprox Mar 29, 2025
0c564ba
update ver to 0.0.5 (#69)
eliteprox Mar 29, 2025
1f837fa
feat(server): make ComfyUI log level configurable (#16)
rickstaa Apr 1, 2025
91d897c
chore(deps): bump next from 15.1.6 to 15.2.4 in /ui (#58)
dependabot[bot] Apr 1, 2025
d92a6f5
changes supporting ai-runner upgrade to comfystream 0.0.4 (#56)
eliteprox Apr 1, 2025
e53eed2
fix conda env activation (#78)
eliteprox Apr 2, 2025
a9080db
disable automatic env activation (#81)
eliteprox Apr 2, 2025
d7c096f
feat(models): add Depth Anything V2 Large model (#79)
rickstaa Apr 4, 2025
9ff4b39
Support for super-resolution node with opencv-cuda (#65)
JJassonn69 Apr 4, 2025
1375def
update script with with min/max width/height (#107)
pschroedl Apr 9, 2025
15ddda2
Feat/dynamic resolution (#38)
ryanontheinside Apr 10, 2025
dd0c709
don't use GPU for comfyui-base workflow (#110)
pwilczynskiclearcode Apr 11, 2025
4ac3649
update icon for comfyui registry (#115)
eliteprox Apr 11, 2025
e70b88c
update to ver 0.0.6 (#113)
eliteprox Apr 11, 2025
9ab0b0d
Revert "don't use GPU for comfyui-base workflow (#110)" (#117)
eliteprox Apr 11, 2025
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": true,
"python.terminal.activateEnvironment": false,
"terminal.integrated.shellIntegration.enabled": true
},
"extensions": [
Expand Down
17 changes: 15 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ 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_style = tab
indent_size = 8
indent_size = 4

[*.{md,txt,mkdn}]
indent_size = 4
indent_size = unset
trim_trailing_whitespace = false
2 changes: 2 additions & 0 deletions .github/codeql-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
paths-ignore:
- "docker/"
14 changes: 4 additions & 10 deletions .github/workflows/comfyui-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,13 @@ name: Build and push comfyui-base docker image

on:
pull_request:
paths:
- docker/Dockerfile.base
- src/comfystream/scripts/
- configs/
- .github/workflows/comfyui-base.yaml
paths-ignore:
- "ui/*"
branches:
- main
push:
paths:
- docker/Dockerfile.base
- src/comfystream/scripts/
- configs/
- .github/workflows/comfyui-base.yaml
paths-ignore:
- "ui/*"
branches:
- main
tags:
Expand Down
86 changes: 86 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Test project

on:
pull_request:
branches:
- "main"
push:
branches:
- "main"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
codeql:
name: Perform CodeQL analysis
if: ${{ github.repository == 'livepeer/comfystream' }}
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: typescript,javascript,python
config-file: ./.github/codeql-config.yaml

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3


editorconfig:
name: Run editorconfig checker
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
# Check https://github.com/livepeer/go-livepeer/pull/1891
# for ref value discussion
ref: ${{ github.event.pull_request.head.sha }}

- name: Install editorconfig-checker
uses: editorconfig-checker/action-editorconfig-checker@main

- name: Run editorconfig checker against the repo
if: false
# disabled editorconfig lint rule for now
run: editorconfig-checker --format github-actions

test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
# Check https://github.com/livepeer/go-livepeer/pull/1891
# for ref value discussion
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: pip

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install '.[dev]'

- name: Run tests
run: pytest --cov --verbose --showlocals

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CI_CODECOV_TOKEN }}
name: ${{ github.event.repository.name }}
7 changes: 5 additions & 2 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,3 +22,6 @@ launch.json
nodes/web/static/*
.cursor/
!nodes/web/static/.gitkeep

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

# Depth Anything ONNX model
# 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"
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 @@ -68,4 +72,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: 4 additions & 3 deletions configs/nodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ nodes:

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

# Ryan's nodes
Expand Down Expand Up @@ -73,5 +74,5 @@ nodes:
comfyui-stream-pack:
name: "ComfyUI Stream Pack"
url: "https://github.com/livepeer/ComfyUI-Stream-Pack"
branch: "expose_feature_bank_to_comfyui"
type: "utility"
branch: "main"
type: "utility"
1 change: 0 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ 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: 17 additions & 11 deletions docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,15 @@ 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}" -y && \
rm /tmp/miniconda.sh && \
conda run -n comfystream --no-capture-output pip install aiortc aiohttp requests tqdm pyyaml --root-user-action=ignore
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

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

# Copy only files needed for setup
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 ./src/comfystream/scripts /workspace/comfystream/src/comfystream/scripts
COPY ./configs /workspace/comfystream/configs

# Copy ComfyStream files into ComfyUI
COPY . /workspace/comfystream
Expand All @@ -52,14 +48,24 @@ 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: 70 additions & 1 deletion docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ 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 @@ -49,7 +50,18 @@ 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 Engine for DepthAnything2
# 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"
Expand All @@ -59,9 +71,66 @@ 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: 0 additions & 15 deletions nodes/web/js/comfystream_ui_preview_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,25 +111,10 @@ 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: 1 addition & 0 deletions opencv_contrib
Submodule opencv_contrib added at 0e5254
Loading