From ffeda47fd221963ce382b969cba5a62958964052 Mon Sep 17 00:00:00 2001 From: kami Date: Tue, 11 Aug 2026 03:28:26 +0400 Subject: [PATCH] Restore runtime deps: models, dots.tts, torchvision shadow Rebuild the venv half of the reconstruction. Adds the two CPU onnx detectors back under models/ (comic-text-detector, deepghs anime face, both gitignored), re-clones the dots.tts checkout, and records both recipes in requirements.txt so the next rebuild skips the archaeology. Two pre-existing environment breakages had to be cleared: - Arch's torchvision 0.25 is too old for torch 2.13, so every transformers model import died with "operator torchvision::nms does not exist". Shadowed with 0.28.0+rocm7.2 inside the venv only, so the system copy stays put. - dots_tts refuses to import when torch and torchaudio minors differ, and that pair is unsatisfiable here: 2.11 is the newest torchaudio ROCm wheel there is. Verified 2.11 loads and resamples against 2.13, then scoped a bypass around the import in both call sites. Self-checks 13/14. worker_layers still needs the ComfyUI workflow json, which legacy/ took with it. Co-Authored-By: Claude Opus 5 --- .gitignore | 1 + requirements.txt | 13 +++++++++++++ scripts/pick_tts_voice.py | 13 ++++++++++++- worker_tts.py | 12 +++++++++++- 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 5906d58..3ecd73d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ __pycache__/ dots.tts/ /dev/shm/ *.gguf +models/ diff --git a/requirements.txt b/requirements.txt index 39b9212..6ad55fd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,3 +13,16 @@ transformers accelerate soundfile # system deps (not pip): ffmpeg, comfyui (external server) +# +# dots.tts (gitignored checkout, needed by worker_tts + scripts/pick_tts_voice). venv is built +# --system-site-packages so it inherits Arch's rocm torch: +# git clone https://github.com/rednote-hilab/dots.tts.git dots.tts +# pip install -e ./dots.tts --no-deps --ignore-requires-python # py3.14 > its <3.13 pin, skips gradio +# pip install librosa loguru einops torchdiffeq 'langcodes[data]' lingua-language-detector WeTextProcessing +# pip install --no-deps --index-url https://download.pytorch.org/whl/rocm7.2 torchvision==0.28.0+rocm7.2 +# that last one is not optional: Arch's torchvision 0.25 is too old for torch 2.13, and every +# transformers model import dies with "operator torchvision::nms does not exist" until it is shadowed. +# +# models/ (gitignored, CPU onnx for set-of-mark): +# comictextdetector.pt.onnx <- github.com/zyddnys/manga-image-translator releases/beta-0.3 +# anime_face_v1.4_s.onnx <- huggingface.co/deepghs/anime_face_detection face_detect_v1.4_s/model.onnx diff --git a/scripts/pick_tts_voice.py b/scripts/pick_tts_voice.py index 5027f94..f438fa6 100644 --- a/scripts/pick_tts_voice.py +++ b/scripts/pick_tts_voice.py @@ -25,7 +25,18 @@ def load_model(model_name: str): cls, *args, **{"fix_mistral_regex": True, **kwargs} ) ) - from dots_tts.runtime import DotsTtsRuntime + # Match worker_tts.py's torch/torchaudio minor-mismatch bypass too. + import torch + import importlib.metadata as metadata + + real_version = metadata.version + metadata.version = ( + lambda name: torch.__version__ if name == "torchaudio" else real_version(name) + ) + try: + from dots_tts.runtime import DotsTtsRuntime + finally: + metadata.version = real_version return DotsTtsRuntime.from_pretrained(model_name, precision="bfloat16") diff --git a/worker_tts.py b/worker_tts.py index 50d5e0d..ad0ff32 100644 --- a/worker_tts.py +++ b/worker_tts.py @@ -36,7 +36,17 @@ def _load_tts(): transformers.AutoTokenizer.from_pretrained = classmethod( lambda cls, *a, **kw: _orig(cls, *a, **{"fix_mistral_regex": True, **kw}) ) - from dots_tts.runtime import DotsTtsRuntime + # dots_tts/__init__.py refuses to import when torch and torchaudio minors differ. workpc runs + # Arch's torch 2.13 but pytorch.org ships no torchaudio past 2.11 for ROCm, so the pair can't + # be satisfied; 2.11 loads and resamples fine against 2.13. Lie to the guard for the import. + # ponytail: drop this once a torchaudio matching torch's minor exists for ROCm. + import torch, importlib.metadata as _md + _ver = _md.version + _md.version = lambda n: torch.__version__ if n == "torchaudio" else _ver(n) + try: + from dots_tts.runtime import DotsTtsRuntime + finally: + _md.version = _ver _tts = DotsTtsRuntime.from_pretrained(DOTS_MODEL, precision="bfloat16") return _tts