Skip to content

Commit c73fc68

Browse files
authored
refactor: improve the example setup (#62)
This commit adds a new `prepare_examples` alias to the dev container that users can use to setup all the dependencies for the examples. It also updates the documentation.
1 parent 67d8aab commit c73fc68

File tree

2 files changed

+54
-38
lines changed

2 files changed

+54
-38
lines changed

.devcontainer/README.md

+48-36
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,54 @@ Replace `/path/to/your/model-files` and `path/to/your/output-files` with the pat
6565
2. From VS Code, reload the folder as a devcontainer:
6666
- Open the Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P` on macOS).
6767
- Select `Remote-Containers: Reopen in Container`.
68+
3. Wait for the container to build and start.
6869

69-
### Download models
70+
### Starting ComfyUI
71+
72+
Start ComfyUI:
73+
74+
```sh
75+
cd /workspace/comfystream/ComfyUI
76+
conda activate comfyui
77+
python main.py --listen
78+
```
79+
80+
When using TensorRT engine enabled workflows, you should include the `---disable-cuda-malloc` flag as shown below:
81+
82+
```sh
83+
cd /workspace/comfystream/ComfyUI
84+
conda activate comfyui
85+
python main.py --listen --disable-cuda-malloc
86+
```
87+
88+
### Starting ComfyStream
89+
90+
Start ComfyStream:
91+
92+
```sh
93+
cd /workspace/comfystream
94+
conda activate comfystream
95+
python server/app.py --workspace /workspace/ComfyUI --media-ports=5678 --host=0.0.0.0 --port 8889
96+
```
97+
98+
Optionally, you can also start the [ComfyStream UI](../README.md#run-ui) to view the stream:
99+
100+
```sh
101+
cd /workspace/comfystream/ui
102+
npm run dev:https
103+
```
104+
105+
### Running Example Workflows
106+
107+
To run example workflows, you need to download models and build TensorRT engines. You can do this from within the dev container by running the following command in the terminal:
108+
109+
```sh
110+
prepare_examples
111+
```
112+
113+
Alternatively, you can follow the steps below.
114+
115+
#### Download models
70116

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

@@ -80,7 +126,7 @@ For more info about configuring model downloads, see [src/comfystream/scripts/RE
80126

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

83-
### Building the DepthAnything Engine
129+
#### Building the DepthAnything Engine
84130

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

@@ -113,40 +159,6 @@ Alternatively, you may activate an environment manually with `conda activate com
113159

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

116-
### Starting ComfyUI
117-
118-
Start ComfyUI:
119-
120-
```sh
121-
cd /workspace/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 /workspace/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 /workspace/comfystream
140-
conda activate comfystream
141-
python server/app.py --workspace /workspace/ComfyUI --media-ports=5678 --host=0.0.0.0 --port 8889
142-
```
143-
144-
Optionally, you can also start the [ComfyStream UI](../README.md#run-ui) to view the stream:
145-
146-
```sh
147-
cd /workspace/comfystream/ui
148-
npm run dev:https
149-
```
150162

151163
## Additional Resources
152164

.devcontainer/post-create.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
#!/bin/bash
2-
2+
chmod +x /workspace/comfystream/docker/entrypoint.sh
33
cd /workspace/comfystream
4-
/bin/bash
4+
5+
echo 'alias prepare_examples="/workspace/comfystream/docker/entrypoint.sh --download-models --build-engines"' >> ~/.bashrc
6+
echo -e "\e[32mContainer ready! Run 'prepare_examples' to download models and build engines for example workflows.\e[0m"
7+
8+
/bin/bash

0 commit comments

Comments
 (0)