Install the whole backend from one script; queue log; UI fixes

install_comfyui.sh becomes install_backend.sh and now builds everything the app
needs, not just the speech half:

- Step 7 runs normalizer/setup.sh --model, which fetches both models: the open
  inflection model first, so the install gets as far as it can before anything
  can ask for credentials, then the gated fine-tune.
- A missing Hugging Face account is no longer fatal. Accepting a licence is the
  one thing an installer cannot do, so the rest installs, the verification
  reports "fallback only (gated model missing)", and the summary prints the
  three commands that finish it.
- --skip-normalizer, disk requirement 35 -> 55 GB, removal instructions and the
  step list updated to match.

Queue logging — queue.log in the first queued video's job folder, which for a
single-video run is its own:

- Records what went wrong rather than what happened: warnings, tracebacks,
  ffmpeg errors, guard rejections, clips cut off mid-word or that crashed the
  backend, and the --regen line carrying their numbers.
- ComfyUI failures *and* restarts, so the log shows the recovery rather than
  reading as though the run simply stopped. GUI-initiated backend actions go in
  too; they never pass through a job's pipe.
- A failure also dumps the job's last 15 lines. Keyword matching alone is not
  enough — ffmpeg says "Invalid data found when processing input" and nothing
  that looks like an error.

UI:

- The output pane follows new output only while already at the bottom. Scroll up
  and it stays there; scroll back down and it resumes. Reading an earlier
  warning during a run was impossible while every ffmpeg progress frame yanked
  the view to the end.
- The ComfyUI button's status dot is drawn as its own canvas item, so it can be
  green (answering) or amber (holds the port, does not answer). A "." inside the
  label could only ever be the same grey as the words.

comfyui.log is capped at 120,000 lines, trimmed on backend start and every five
minutes. Rewritten in place, never replaced: tee holds it open in append mode,
so swapping the inode would leave the backend writing to an unlinked file.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-13 09:48:20 +02:00
co-authored by Claude Opus 5
parent e201aadc3e
commit 97866e6623
8 changed files with 421 additions and 69 deletions
+35 -22
View File
@@ -5,16 +5,17 @@ and the **script** (which needs nothing installed at all).
## Automated install
`install_comfyui.sh` in the project root reproduces the exact working
`install_backend.sh` in the project root reproduces the exact working
environment. It is idempotent — safe to re-run, and it skips any step already
satisfied.
```bash
cd ~/Programy/lektor_ai
./install_comfyui.sh
./install_backend.sh
```
Roughly 30–60 minutes, mostly downloading. Expect ~22 GB.
Roughly 45–90 minutes, almost all of it downloading. Expect ~39 GB: ~22 GB for
the speech backend and ~17 GB for the normalizer's own environment and models.
### Options
@@ -22,14 +23,15 @@ Roughly 30–60 minutes, mostly downloading. Expect ~22 GB.
|---|---|
| *(none)* | Pinned versions — ComfyUI `7cb784e0`, suite `v5.3.0`. Recommended. |
| `--latest` | Newest ComfyUI and suite instead. You are on your own for breakage. |
| `--skip-model` | Skip the 8.7 GB download; it happens on first generation anyway. |
| `--skip-model` | Skip the 8.7 GB TTS download; it happens on first generation anyway. |
| `--skip-normalizer` | ComfyUI only. Digits then reach the TTS as digits, which it misreads. |
| `--lock FILE` | Restore an exact package set from a `pip freeze` lockfile. |
| `--help` | Usage summary. |
### Changing where things go
```bash
CONDA_ROOT=/opt/miniforge3 COMFY_ROOT=/data/comfy ./install_comfyui.sh
CONDA_ROOT=/opt/miniforge3 COMFY_ROOT=/data/comfy ./install_backend.sh
```
| Variable | Default |
@@ -49,7 +51,7 @@ see [Configuring the script](#configuring-the-script).
byte-identical environment:
```bash
./install_comfyui.sh --lock comfyui-requirements.lock.txt
./install_backend.sh --lock comfyui-requirements.lock.txt
```
Regenerate it after intentional changes:
@@ -78,9 +80,13 @@ its own.
pip install (see [requirements.md](requirements.md#dependency-surface)).
7. **Model** — `bosonai/higgs-audio-v3-tts-4b` into
`ComfyUI/models/TTS/higgs_audio_v3/`.
8. **Launcher** written to `$COMFY_ROOT/start_comfyui.sh`.
9. **Verification** — imports torch, torchaudio, transformers, safetensors,
soundfile, librosa and reports CUDA availability.
8. **Number normalizer** — `normalizer/setup.sh --model`: its own venv with
`transformers>=5`, the open inflection model, and the gated fine-tune if you
have credentials. Failure here is reported, not fatal.
9. **Launcher** written to `$COMFY_ROOT/start_comfyui.sh`.
10. **Verification** — imports torch, torchaudio, transformers, safetensors,
soundfile, librosa, reports CUDA availability, and prints whether the
normalizer came up neural or on the fallback.
## Manual install
@@ -184,25 +190,32 @@ conda install -n comfy-tts -c conda-forge ffmpeg
Note that this puts ffmpeg inside the conda env, so the script must then be run
with that env active.
## Number normalizer (optional, recommended)
## Number normalizer
Digits reach the TTS as words rather than figures, in the correct Polish case.
It has its own venv on purpose — the model needs `transformers >= 5`, which must
not be forced on the ComfyUI environment installed above.
`install_backend.sh` installs this too — its own venv, the 8 GB inflection
model, and the 1.1 GB fine-tune. Nothing further is needed unless the script
says otherwise.
It gets its own venv on purpose: it needs `transformers >= 5`, which must not be
forced on the ComfyUI environment installed above. They talk over a pipe.
**The one thing the installer cannot do for you** is accept a licence. The
fine-tune is gated, so if you have no Hugging Face credentials the script
installs everything else, reports `fallback only (gated model missing)`, and
prints these three steps:
```bash
cd ~/Programy/lektor_ai
normalizer/setup.sh # venv + torch (cu128) + transformers
HF_TOKEN=hf_... normalizer/setup.sh --model # the weights, ~1.1 GB
# 1. accept the terms while signed in:
# https://huggingface.co/Folx/qwen3-0.6b-pl-text-normalization
normalizer/venv/bin/hf auth login
normalizer/setup.sh --model
```
The weights are gated: accept the terms at
<https://huggingface.co/Folx/qwen3-0.6b-pl-text-normalization> while signed in,
then take a token from <https://huggingface.co/settings/tokens>. This is the only
step that touches the network; runs are offline afterwards.
`HF_TOKEN=hf_...` in the environment works instead of `hf auth login`, and the
installer picks up either automatically if you set it up beforehand.
Skipping this is fine — the pipeline falls back to `num2words` (nominative case
only) and says so. Turn the whole stage off with `numbers = no` under
Until then the pipeline runs with `num2words` for times, dates and identifiers,
and says so on every run. Turn the stage off entirely with `numbers = no` under
`[normalize]` in `settings.ini`. See [normalizer/README.md](../normalizer/README.md).
## Verifying