From f647a24988a71b4d886cf787067c0f8f5f9e5d9d Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Sun, 5 Apr 2026 14:53:33 +0200 Subject: [PATCH] fix: add install.py to prevent omnivoice from overwriting ComfyUI's torch --- README.md | 7 +++---- install.py | 32 ++++++++++++++++++++++++++++++++ requirements.txt | 4 +++- 3 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 install.py diff --git a/README.md b/README.md index 4c1b824..276091a 100644 --- a/README.md +++ b/README.md @@ -18,15 +18,14 @@ A ComfyUI custom node for [OmniVoice](https://github.com/k2-fsa/OmniVoice) — a git clone https://github.com/ethanfel/ComfyUI-Omnivoice.git ``` -2. Install dependencies: +2. Install dependencies **without overwriting ComfyUI's torch**: ```bash - pip install omnivoice + python install.py ``` + > **Warning:** Do NOT run `pip install omnivoice` directly — it pins `torch==2.8.*` from a CUDA 12.8 index and will overwrite ComfyUI's torch installation. 3. Restart ComfyUI. The nodes will appear under the **OmniVoice** category. -> **Note:** OmniVoice requires PyTorch 2.8+ and a CUDA-capable GPU (or Apple Silicon). - ## Nodes ### OmniVoice Model Loader diff --git a/install.py b/install.py new file mode 100644 index 0000000..1f2fa24 --- /dev/null +++ b/install.py @@ -0,0 +1,32 @@ +""" +Installation script for ComfyUI-Omnivoice. + +ComfyUI Manager runs this file instead of pip-installing requirements.txt directly. +We install omnivoice with --no-deps to avoid overwriting ComfyUI's torch installation. +omnivoice pins torch==2.8.* from a CUDA 12.8 custom index which would break ComfyUI. +""" +import subprocess +import sys + + +def pip(*args): + subprocess.check_call([sys.executable, "-m", "pip", "install", *args]) + + +# Install omnivoice itself without pulling in its torch/torchaudio pins. +# ComfyUI ships its own torch build — let it manage torch. +pip("omnivoice", "--no-deps") + +# Install omnivoice's runtime inference dependencies (excludes torch, torchaudio, +# gradio, tensorboardX, webdataset which are training/demo-only tools). +pip( + "transformers>=5.0.0", + "accelerate", + "pydub", + "soundfile", + "numpy", +) + +print("\n[ComfyUI-Omnivoice] Installation complete.") +print("[ComfyUI-Omnivoice] NOTE: omnivoice was installed without its pinned torch.") +print("[ComfyUI-Omnivoice] If you encounter errors, ensure torch>=2.0 is installed.") diff --git a/requirements.txt b/requirements.txt index 3c5bc9a..59d015d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,3 @@ -omnivoice +# Dependencies are managed by install.py to avoid overwriting ComfyUI's torch. +# omnivoice pins torch==2.8.* (CUDA 12.8) which would break ComfyUI's torch build. +# Do not add omnivoice here — install.py handles it with --no-deps.