Skip to content

Commit 214cfec

Browse files
authored
Merge branch 'main' into feat/audio_support
2 parents a0ed6f8 + 6f54863 commit 214cfec

36 files changed

+2638
-718
lines changed

.devcontainer/Dockerfile

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM livepeer/comfyui-base:latest
2+
ENV PATH="/miniconda3/bin:${PATH}"
3+
EXPOSE 8188
4+
EXPOSE 8888
5+
EXPOSE 3000
6+
EXPOSE 1024-65535/udp
7+
8+
WORKDIR /
9+
10+
# Install NVM
11+
ENV NVM_DIR=/root/.nvm
12+
ENV NODE_VERSION=18.18.0
13+
RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
14+
15+
# Install node and npm
16+
RUN bash -c "source $NVM_DIR/nvm.sh \
17+
&& nvm install $NODE_VERSION \
18+
&& nvm alias default $NODE_VERSION \
19+
&& nvm use default"
20+
21+
# Add node and npm to path so the commands are available
22+
ENV NODE_PATH=$NVM_DIR/v$NODE_VERSION/lib/node_modules
23+
ENV PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
24+
RUN conda init bash

.devcontainer/README.md

+154
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# Dev Container Setup for ComfyStream
2+
3+
This guide will help you set up and run a development container for ComfyStream using Visual Studio Code (VS Code).
4+
5+
## Prerequisites
6+
7+
- [Docker](https://www.docker.com/get-started)
8+
- [Visual Studio Code](https://code.visualstudio.com/)
9+
- [VS Code Remote - Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
10+
11+
## Host Setup
12+
13+
### Clone the Repository
14+
15+
First, clone the `comfystream` repository:
16+
17+
```sh
18+
git clone https://github.com/yondonfu/comfystream.git
19+
cd comfystream
20+
```
21+
22+
### Download or Build Base Docker Image
23+
24+
The `livepeer/comfyui-base:latest` image provides a ComfyUI workspace for ComfyStream development. You may either pull the base docker image or build it:
25+
26+
- Pull from Dockerhub:
27+
28+
```sh
29+
docker pull livepeer/comfyui-base:latest
30+
```
31+
32+
- Build the base image:
33+
34+
```sh
35+
docker build -f docker/Dockerfile.base -t livepeer/comfyui-base:latest .
36+
```
37+
38+
### Host Configuration
39+
40+
On your **host** system, create directories to store models and engines:
41+
42+
```sh
43+
mkdir -p ~/models/ComfyUI--models && mkdir -p ~/models/ComfyUI--output
44+
```
45+
46+
> [!NOTE]
47+
> This step should be ran on your host machine before attempting to start the container.
48+
49+
If you would like to use a different path to store models, open `.devcontainer/devcontainer.json` file and update the `source` to map to the correct paths to your host system. Here is an example configuration:
50+
51+
```json
52+
{
53+
"mounts": [
54+
"source=/path/to/your/model-files,target=/ComfyUI/models/ComfyUI--models,type=bind",
55+
"source=/path/to/your/output-files,target=/ComfyUI/models/ComfyUI--output,type=bind"
56+
]
57+
}
58+
```
59+
60+
Replace `/path/to/your/model-files` and `path/to/your/output-files` with the path to your `models` and `output` folders on your host machine.
61+
62+
## Dev Container Setup
63+
64+
1. Open the `comfystream` repository in VS Code.
65+
2. From VS Code, reload the folder as a devcontainer:
66+
- Open the Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P` on macOS).
67+
- Select `Remote-Containers: Reopen in Container`.
68+
69+
### Download models
70+
71+
From within the **dev container**, download models to run the example workflows:
72+
73+
```sh
74+
cd /comfystream
75+
conda activate comfystream
76+
python src/comfystream/scripts/setup_models.py --workspace /ComfyUI
77+
```
78+
79+
For more info about configuring model downloads, see [src/comfystream/scripts/README.md](../src/comfystream/scripts/README.md)
80+
81+
By following these steps, you should be able to set up and run your development container for ComfyStream efficiently.
82+
83+
### Building the DepthAnything Engine
84+
85+
After downloading models, it is necessary to compile TensorRT engines for the example workflow.
86+
87+
> [!NOTE]
88+
> Engine files must be compiled on the same GPU hardware/architecture that they will be used on. This step must be run manually after starting the devcontainer. You may use either conda environment for this step.
89+
90+
1. Run the **export_trt.py** script from the directory of the onnx file:
91+
92+
```sh
93+
cd /ComfyUI/models/tensorrt/depth-anything
94+
python /ComfyUI/custom_nodes/ComfyUI-Depth-Anything-Tensorrt/export_trt.py
95+
```
96+
97+
## Debugging ComfyStream and ComfyUI
98+
99+
The `launch.json` includes sample launch configurations for ComfyStream and ComfyUI.
100+
101+
## Setting the Python Environment
102+
103+
Conda is initialized in the bash shell with no environment activated to provide better interoperability with VS Code Shell Integration.
104+
105+
VS Code will automatically activate the `comfystream` environment, unless you change it:
106+
107+
1. From VSCode, press `Ctrl-Shift-P`.
108+
2. Choose `Python: Select Interpreter`.
109+
3. Select `comfystream` or `comfyui`.
110+
4. Open a new terminal, you will see the environment name to the left of the bash terminal.
111+
112+
Alternatively, you may activate an environment manually with `conda activate comfyui` or `conda activate comfystream`
113+
114+
> [!NOTE] For more information, see [Python environments in VS Code](https://code.visualstudio.com/docs/python/environments)
115+
116+
### Starting ComfyUI
117+
118+
Start ComfyUI:
119+
120+
```sh
121+
cd /comfystream/ComfyUI
122+
conda activate comfyui
123+
python main.py --listen
124+
```
125+
126+
When using TensorRT engine enabled workflows, you should include the `---disable-cuda-malloc` flag as shown below:
127+
128+
```sh
129+
cd /comfystream/ComfyUI
130+
conda activate comfyui
131+
python main.py --listen --disable-cuda-malloc
132+
```
133+
134+
### Starting ComfyStream
135+
136+
Start ComfyStream:
137+
138+
```sh
139+
cd /comfystream
140+
conda activate comfystream
141+
python server/app.py --workspace /ComfyUI --media-ports=5678 --host=0.0.0.0 --port 8888
142+
```
143+
144+
Optionally, you can also start the [ComfyStream UI](../README.md#run-ui) to view the stream:
145+
146+
```sh
147+
cd /comfystream/ui
148+
npm run dev:https
149+
```
150+
151+
## Additional Resources
152+
153+
- [Developing inside a Container](https://code.visualstudio.com/docs/remote/containers)
154+
- [Docker Documentation](https://docs.docker.com/)

.devcontainer/devcontainer.json

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
3+
{
4+
"name": "ComfyStream",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"context": "../"
8+
},
9+
"runArgs": [
10+
"--gpus=all"
11+
],
12+
// Features to add to the dev container. More info: https://containers.dev/features.
13+
// Configure tool-specific properties.
14+
"customizations": {
15+
"vscode": {
16+
"settings": {
17+
"python.defaultInterpreterPath": "/miniconda3/envs/comfystream/bin/python",
18+
"python.venvPath": "/miniconda3/envs",
19+
"python.terminal.activateEnvInCurrentTerminal": false,
20+
"python.terminal.activateEnvironment": true,
21+
"terminal.integrated.shellIntegration.enabled": true
22+
},
23+
"extensions": [
24+
"ms-python.python",
25+
"ms-python.black-formatter",
26+
"ms-python.vscode-pylance",
27+
"ms-python.debugpy"
28+
]
29+
}
30+
},
31+
"appPort": [
32+
"8188:8188", // ComfyUI
33+
"8888:8888", // ComfyStream
34+
"3000:3000" // ComfyStream UI (optional)
35+
],
36+
"forwardPorts": [8188, 8888, 3000],
37+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
38+
// Use 'mounts' to make a list of local folders available inside the container.
39+
"workspaceFolder": "/comfystream",
40+
"workspaceMount": "source=${localWorkspaceFolder},target=/comfystream,type=bind",
41+
"mounts": [
42+
// Use 'mounts' to map to comfyui models on the host
43+
"source=${localEnv:HOME}/models/ComfyUI--models,target=/ComfyUI/models,type=bind,consistency=cached",
44+
"source=${localEnv:HOME}/models/ComfyUI--output,target=/ComfyUI/output,type=bind,consistency=cached"
45+
],
46+
"postCreateCommand": ".devcontainer/post-create.sh"
47+
}

.devcontainer/post-create.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
# Install npm packages if needed
4+
cd /comfystream/ui
5+
if [ ! -d "node_modules" ]; then
6+
npm install --legacy-peer-deps
7+
fi
8+
9+
# Create a symlink to the ComfyUI workspace
10+
if [ ! -d "/comfystream/ComfyUI" ]; then
11+
ln -s /ComfyUI /comfystream/ComfyUI
12+
fi
13+
14+
cd /comfystream
15+
/bin/bash

.github/ISSUE_TEMPLATE/bug_report.yml

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Bug report
2+
description: Create a report to help us improve
3+
title: "[BUG] "
4+
labels: [bug]
5+
assignees: []
6+
body:
7+
- type: markdown
8+
attributes:
9+
value: |
10+
Thanks for taking the time to fill out this bug report!
11+
12+
- type: input
13+
id: bug_description
14+
attributes:
15+
label: Describe the bug
16+
description: A clear and concise description of what the bug is.
17+
placeholder: Describe the bug here
18+
validations:
19+
required: true
20+
21+
- type: textarea
22+
id: bug_reproduction
23+
attributes:
24+
label: To Reproduce
25+
description: |
26+
Steps to reproduce the behavior:
27+
1. Go to '...'
28+
2. Click on '....'
29+
3. Scroll down to '....'
30+
4. See error
31+
placeholder: Steps to reproduce the behavior
32+
validations:
33+
required: true
34+
35+
- type: input
36+
id: expected_behavior
37+
attributes:
38+
label: Expected behavior
39+
description: A clear and concise description of what you expected to happen.
40+
placeholder: Describe the expected behavior here
41+
validations:
42+
required: true
43+
44+
- type: textarea
45+
id: screenshots
46+
attributes:
47+
label: Screenshots
48+
description: If applicable, add screenshots to help explain your problem.
49+
placeholder: Add screenshots here
50+
51+
- type: input
52+
id: desktop_info
53+
attributes:
54+
label: Desktop (please complete the following information)
55+
description: |
56+
- OS: [e.g. iOS]
57+
- Browser [e.g. chrome, safari]
58+
- Version [e.g. 22]
59+
placeholder: Add desktop information here
60+
61+
- type: input
62+
id: smartphone_info
63+
attributes:
64+
label: Smartphone (please complete the following information)
65+
description: |
66+
- Device: [e.g. iPhone6]
67+
- OS: [e.g. iOS8.1]
68+
- Browser [e.g. stock browser, safari]
69+
- Version [e.g. 22]
70+
placeholder: Add smartphone information here
71+
72+
- type: textarea
73+
id: additional_context
74+
attributes:
75+
label: Additional context
76+
description: Add any other context about the problem here
77+
placeholder: Add additional context here
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Feature request
2+
description: Suggest an idea for this project
3+
title: "[FEATURE] "
4+
labels: [enhancement]
5+
assignees: []
6+
body:
7+
- type: markdown
8+
attributes:
9+
value: |
10+
Thanks for suggesting a feature! Please fill out the following details.
11+
12+
- type: dropdown
13+
id: feature_type
14+
attributes:
15+
label: Feature type
16+
description: Is this feature related to the UI or the server?
17+
options:
18+
- UI
19+
- Server
20+
validations:
21+
required: true
22+
23+
- type: input
24+
id: feature_description
25+
attributes:
26+
label: Describe the feature
27+
description: A clear and concise description of what you want to happen.
28+
placeholder: Describe the feature here
29+
validations:
30+
required: true
31+
32+
- type: textarea
33+
id: feature_motivation
34+
attributes:
35+
label: Motivation
36+
description: Explain why this feature would be useful.
37+
placeholder: Explain the motivation here
38+
validations:
39+
required: true
40+
41+
- type: textarea
42+
id: additional_context
43+
attributes:
44+
label: Additional context
45+
description: Add any other context or screenshots about the feature request here
46+
placeholder: Add additional context here

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ __pycache__
33
build
44
.DS_STORE
55
comfyui*
6+
ComfyUI*
67

78
# VS Code settings
89
.vscode/

0 commit comments

Comments
 (0)