From 259641a12c6e7df6119080e9acc0eed76d83c510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20L=C3=B6wenfels?= <282+dfl@users.noreply.github.com> Date: Fri, 8 Mar 2024 10:58:17 +0000 Subject: [PATCH 1/2] add submodule for StreamDiffusion --- .gitmodules | 3 +++ README.md | 7 +++---- StreamDiffusion | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 .gitmodules create mode 160000 StreamDiffusion diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..240a12b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "StreamDiffusion"] + path = StreamDiffusion + url = https://github.com/cumulo-autumn/StreamDiffusion.git diff --git a/README.md b/README.md index 6c227c2..41f588c 100644 --- a/README.md +++ b/README.md @@ -27,18 +27,17 @@ The execution looks like this: ![Workflow3demo](img/workflow3demo.gif) - ## Usage Run the following command inside ComfyUI/custom_nodes. ```cmd -git clone https://github.com/Limitex/ComfyUI-Diffusers.git +git clone --recurse-submodules https://github.com/Limitex/ComfyUI-Diffusers.git cd ComfyUI-Diffusers pip install -r requirements.txt -git clone https://github.com/cumulo-autumn/StreamDiffusion.git python -m streamdiffusion.tools.install-tensorrt ``` + ## Recommended Custom Nodes https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite.git @@ -69,6 +68,6 @@ https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite.git ### StreamDiffusion Fast Sampler (StreamDiffusionFastSampler) -## Reference +## Reference https://github.com/cumulo-autumn/StreamDiffusion diff --git a/StreamDiffusion b/StreamDiffusion new file mode 160000 index 0000000..83eb14e --- /dev/null +++ b/StreamDiffusion @@ -0,0 +1 @@ +Subproject commit 83eb14e8dc7a644f525de836f78332a70d69e48c From 2249ee5b16bf20ed924605ebfc7c8f9b35917409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20L=C3=B6wenfels?= <282+dfl@users.noreply.github.com> Date: Fri, 8 Mar 2024 10:28:36 +0000 Subject: [PATCH 2/2] install script and patch for Mac --- README.md | 3 +-- ignore_cuda_for_mac.patch | 17 +++++++++++++++++ install.sh | 16 ++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 ignore_cuda_for_mac.patch create mode 100755 install.sh diff --git a/README.md b/README.md index 41f588c..b4aba5e 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,7 @@ Run the following command inside ComfyUI/custom_nodes. ```cmd git clone --recurse-submodules https://github.com/Limitex/ComfyUI-Diffusers.git cd ComfyUI-Diffusers -pip install -r requirements.txt -python -m streamdiffusion.tools.install-tensorrt +./install.sh ``` ## Recommended Custom Nodes diff --git a/ignore_cuda_for_mac.patch b/ignore_cuda_for_mac.patch new file mode 100644 index 0000000..dc9697b --- /dev/null +++ b/ignore_cuda_for_mac.patch @@ -0,0 +1,17 @@ +diff --git a/src/streamdiffusion/pipeline.py b/src/streamdiffusion/pipeline.py +index 66c08c8..33df7ea 100644 +--- a/src/streamdiffusion/pipeline.py ++++ b/src/streamdiffusion/pipeline.py +@@ -440,9 +440,9 @@ class StreamDiffusion: + def __call__( + self, x: Union[torch.Tensor, PIL.Image.Image, np.ndarray] = None + ) -> torch.Tensor: +- start = torch.cuda.Event(enable_timing=True) +- end = torch.cuda.Event(enable_timing=True) +- start.record() ++ # start = torch.cuda.Event(enable_timing=True) ++ # end = torch.cuda.Event(enable_timing=True) ++ # start.record() + if x is not None: + x = self.image_processor.preprocess(x, self.height, self.width).to( + device=self.device, dtype=self.dtype diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..e8970a5 --- /dev/null +++ b/install.sh @@ -0,0 +1,16 @@ +#!/bin/bash +source ../../venv/bin/activate + +pip install -r requirements.txt +python python -m streamdiffusion.tools.install-tensorrt + +git clone https://github.com/cumulo-autumn/StreamDiffusion.git +python -m streamdiffusion.tools.install-tensorrt + +if [[ $(uname) == "Darwin" ]]; then # for MacOS / MPS + cd StreamDiffusion + git apply ../ignore_cuda_for_mac.patch + pip install . +else + python -m streamdiffusion.tools.install-tensorrt # for PC / CUDA +fi