Skip to content

Commit

Permalink
Merge branch 'main' into feat/audio_support
Browse files Browse the repository at this point in the history
  • Loading branch information
varshith15 authored Feb 11, 2025
2 parents a0ed6f8 + 6f54863 commit 214cfec
Show file tree
Hide file tree
Showing 36 changed files with 2,638 additions and 718 deletions.
24 changes: 24 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM livepeer/comfyui-base:latest
ENV PATH="/miniconda3/bin:${PATH}"
EXPOSE 8188
EXPOSE 8888
EXPOSE 3000
EXPOSE 1024-65535/udp

WORKDIR /

# Install NVM
ENV NVM_DIR=/root/.nvm
ENV NODE_VERSION=18.18.0
RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash

# Install node and npm
RUN bash -c "source $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default"

# Add node and npm to path so the commands are available
ENV NODE_PATH=$NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
RUN conda init bash
154 changes: 154 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# Dev Container Setup for ComfyStream

This guide will help you set up and run a development container for ComfyStream using Visual Studio Code (VS Code).

## Prerequisites

- [Docker](https://www.docker.com/get-started)
- [Visual Studio Code](https://code.visualstudio.com/)
- [VS Code Remote - Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)

## Host Setup

### Clone the Repository

First, clone the `comfystream` repository:

```sh
git clone https://github.com/yondonfu/comfystream.git
cd comfystream
```

### Download or Build Base Docker Image

The `livepeer/comfyui-base:latest` image provides a ComfyUI workspace for ComfyStream development. You may either pull the base docker image or build it:

- Pull from Dockerhub:

```sh
docker pull livepeer/comfyui-base:latest
```

- Build the base image:

```sh
docker build -f docker/Dockerfile.base -t livepeer/comfyui-base:latest .
```

### Host Configuration

On your **host** system, create directories to store models and engines:

```sh
mkdir -p ~/models/ComfyUI--models && mkdir -p ~/models/ComfyUI--output
```

> [!NOTE]
> This step should be ran on your host machine before attempting to start the container.
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:

```json
{
"mounts": [
"source=/path/to/your/model-files,target=/ComfyUI/models/ComfyUI--models,type=bind",
"source=/path/to/your/output-files,target=/ComfyUI/models/ComfyUI--output,type=bind"
]
}
```

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.

## Dev Container Setup

1. Open the `comfystream` repository in VS Code.
2. From VS Code, reload the folder as a devcontainer:
- Open the Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P` on macOS).
- Select `Remote-Containers: Reopen in Container`.

### Download models

From within the **dev container**, download models to run the example workflows:

```sh
cd /comfystream
conda activate comfystream
python src/comfystream/scripts/setup_models.py --workspace /ComfyUI
```

For more info about configuring model downloads, see [src/comfystream/scripts/README.md](../src/comfystream/scripts/README.md)

By following these steps, you should be able to set up and run your development container for ComfyStream efficiently.

### Building the DepthAnything Engine

After downloading models, it is necessary to compile TensorRT engines for the example workflow.

> [!NOTE]
> 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.
1. Run the **export_trt.py** script from the directory of the onnx file:

```sh
cd /ComfyUI/models/tensorrt/depth-anything
python /ComfyUI/custom_nodes/ComfyUI-Depth-Anything-Tensorrt/export_trt.py
```

## Debugging ComfyStream and ComfyUI

The `launch.json` includes sample launch configurations for ComfyStream and ComfyUI.

## Setting the Python Environment

Conda is initialized in the bash shell with no environment activated to provide better interoperability with VS Code Shell Integration.

VS Code will automatically activate the `comfystream` environment, unless you change it:

1. From VSCode, press `Ctrl-Shift-P`.
2. Choose `Python: Select Interpreter`.
3. Select `comfystream` or `comfyui`.
4. Open a new terminal, you will see the environment name to the left of the bash terminal.

Alternatively, you may activate an environment manually with `conda activate comfyui` or `conda activate comfystream`

> [!NOTE] For more information, see [Python environments in VS Code](https://code.visualstudio.com/docs/python/environments)

### Starting ComfyUI

Start ComfyUI:

```sh
cd /comfystream/ComfyUI
conda activate comfyui
python main.py --listen
```

When using TensorRT engine enabled workflows, you should include the `---disable-cuda-malloc` flag as shown below:

```sh
cd /comfystream/ComfyUI
conda activate comfyui
python main.py --listen --disable-cuda-malloc
```

### Starting ComfyStream

Start ComfyStream:

```sh
cd /comfystream
conda activate comfystream
python server/app.py --workspace /ComfyUI --media-ports=5678 --host=0.0.0.0 --port 8888
```

Optionally, you can also start the [ComfyStream UI](../README.md#run-ui) to view the stream:

```sh
cd /comfystream/ui
npm run dev:https
```

## Additional Resources

- [Developing inside a Container](https://code.visualstudio.com/docs/remote/containers)
- [Docker Documentation](https://docs.docker.com/)
47 changes: 47 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "ComfyStream",
"build": {
"dockerfile": "Dockerfile",
"context": "../"
},
"runArgs": [
"--gpus=all"
],
// Features to add to the dev container. More info: https://containers.dev/features.
// Configure tool-specific properties.
"customizations": {
"vscode": {
"settings": {
"python.defaultInterpreterPath": "/miniconda3/envs/comfystream/bin/python",
"python.venvPath": "/miniconda3/envs",
"python.terminal.activateEnvInCurrentTerminal": false,
"python.terminal.activateEnvironment": true,
"terminal.integrated.shellIntegration.enabled": true
},
"extensions": [
"ms-python.python",
"ms-python.black-formatter",
"ms-python.vscode-pylance",
"ms-python.debugpy"
]
}
},
"appPort": [
"8188:8188", // ComfyUI
"8888:8888", // ComfyStream
"3000:3000" // ComfyStream UI (optional)
],
"forwardPorts": [8188, 8888, 3000],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// Use 'mounts' to make a list of local folders available inside the container.
"workspaceFolder": "/comfystream",
"workspaceMount": "source=${localWorkspaceFolder},target=/comfystream,type=bind",
"mounts": [
// Use 'mounts' to map to comfyui models on the host
"source=${localEnv:HOME}/models/ComfyUI--models,target=/ComfyUI/models,type=bind,consistency=cached",
"source=${localEnv:HOME}/models/ComfyUI--output,target=/ComfyUI/output,type=bind,consistency=cached"
],
"postCreateCommand": ".devcontainer/post-create.sh"
}
15 changes: 15 additions & 0 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# Install npm packages if needed
cd /comfystream/ui
if [ ! -d "node_modules" ]; then
npm install --legacy-peer-deps
fi

# Create a symlink to the ComfyUI workspace
if [ ! -d "/comfystream/ComfyUI" ]; then
ln -s /ComfyUI /comfystream/ComfyUI
fi

cd /comfystream
/bin/bash
77 changes: 77 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Bug report
description: Create a report to help us improve
title: "[BUG] "
labels: [bug]
assignees: []
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: input
id: bug_description
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is.
placeholder: Describe the bug here
validations:
required: true

- type: textarea
id: bug_reproduction
attributes:
label: To Reproduce
description: |
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
placeholder: Steps to reproduce the behavior
validations:
required: true

- type: input
id: expected_behavior
attributes:
label: Expected behavior
description: A clear and concise description of what you expected to happen.
placeholder: Describe the expected behavior here
validations:
required: true

- type: textarea
id: screenshots
attributes:
label: Screenshots
description: If applicable, add screenshots to help explain your problem.
placeholder: Add screenshots here

- type: input
id: desktop_info
attributes:
label: Desktop (please complete the following information)
description: |
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
placeholder: Add desktop information here

- type: input
id: smartphone_info
attributes:
label: Smartphone (please complete the following information)
description: |
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
placeholder: Add smartphone information here

- type: textarea
id: additional_context
attributes:
label: Additional context
description: Add any other context about the problem here
placeholder: Add additional context here
46 changes: 46 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Feature request
description: Suggest an idea for this project
title: "[FEATURE] "
labels: [enhancement]
assignees: []
body:
- type: markdown
attributes:
value: |
Thanks for suggesting a feature! Please fill out the following details.
- type: dropdown
id: feature_type
attributes:
label: Feature type
description: Is this feature related to the UI or the server?
options:
- UI
- Server
validations:
required: true

- type: input
id: feature_description
attributes:
label: Describe the feature
description: A clear and concise description of what you want to happen.
placeholder: Describe the feature here
validations:
required: true

- type: textarea
id: feature_motivation
attributes:
label: Motivation
description: Explain why this feature would be useful.
placeholder: Explain the motivation here
validations:
required: true

- type: textarea
id: additional_context
attributes:
label: Additional context
description: Add any other context or screenshots about the feature request here
placeholder: Add additional context here
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ __pycache__
build
.DS_STORE
comfyui*
ComfyUI*

# VS Code settings
.vscode/
Expand Down
Loading

0 comments on commit 214cfec

Please sign in to comment.