Repository navigation
Make field-voiced work against the actual model - #64
Conversation
Five merged pull requests built this worker and every one of them said, accurately, that nothing had loaded Chatterbox yet. Generating creek's line is the first time anything did, and it found three things — two of them mine. `chatterbox-tts` needs `pkg_resources` and nothing in the graph asks for it. Chatterbox watermarks every generation through `perth`, whose `perth_net/__init__.py` imports `pkg_resources`; Python 3.12 no longer ships it and uv does not install it unasked. perth catches that ImportError and sets `PerthImplicitWatermarker = None`, so the failure surfaced one layer up as `'NoneType' object is not callable` from Chatterbox's constructor, naming neither perth nor setuptools. Declared as `setuptools>=70,<81` — the upper bound is not decoration, since setuptools removed `pkg_resources` itself and 83.0.0 satisfies a bare `>=70` while leaving perth exactly as broken. The #60 leak fix never worked. Restoring the builtin voice before each unreferenced variant went through `copy.deepcopy(model.conds)`, and torch refuses: "Only Tensors created explicitly by the user (graph leaves) support the deepcopy protocol." Some of those tensors come out of a forward pass. The fix was right about the leak and inoperative against the model, and it was verified by reading `chatterbox/tts.py` rather than by running it — which is precisely the distinction that review round could not make, because loading the model was the one thing the harness existed to avoid. `clone_conds` rebuilds the dataclass field by field with each tensor detached, which is the same shape Chatterbox's own `save`/`load` round-trip uses. A model-side failure left no trace. The lifecycle turned every exception into a one-line protocol error and logged nothing, so the first of these presented as a single sentence with no stack anywhere, and diagnosing it meant rebuilding the whole model load by hand outside the daemon. The wire still carries one line; the daemon's log now also carries the traceback that explains it. The regression test for that last one gets its own interpreter rather than the shared harness's. The existing one prefers `python/voiced/.venv` when it exists, which after a real `field setup voiced` contains Chatterbox — so a test wanting the backend to fail on import would instead load a 2 GB model, and would do so only on machines where setup had been run. Stating the precondition beats inheriting it; that is the same ambient-state trap the environment gate hit twice in #61 and #62.
|
Starting review of b520227. |
ninjudd
left a comment
There was a problem hiding this comment.
Reviewed b520227. One finding, P3 and documentation-only — the fix itself is correct and I verified it against the real Conditionals.
What I checked, since most of this PR is a claim about a model nothing had loaded. clone_conds reconstructs correctly: T3Cond.__dict__ keys are exactly its five dataclass fields, so type(t3)(**vars(t3)) round-trips, and Conditionals is a @dataclass whose (t3, gen) order matches the positional call — the same shape Conditionals.load uses at tts.py:103, as the docstring says. Loading the cached conds.pt and cloning it gives equal values with no shared storage in either t3 or gen, and replaying the mutation generate performs at tts.py:225-227 on the clone leaves the builtin's emotion_adv untouched, so the #60 leak is genuinely closed this time. _detached also handles gen.prompt_feat_len, which is None rather than a tensor.
The logging change works and the new test earns its keep. _log_exception is called before _send, so the client cannot observe the error before the traceback has been flushed — the test's read-after-reject is race-free rather than lucky. Generation failures cannot double-log, since _run_generation runs on its own thread and _dispatch has already returned. pnpm typecheck passes, pyright src is clean in both python/worker and python/voiced, and the file runs 8/8 locally with the new block executing rather than skipping.
The setuptools pin is corroborated from an unexpected direction: importing perth prints its own deprecation notice ending "Refrain from using this package or pin to Setuptools<81", so <81 is the bound upstream itself names.
The clone is right and the reason given for it was not. `clone_conds` is only ever handed conditionals loaded from `conds.pt`, which arrive as graph leaves — no forward pass is involved, so "some of these tensors come out of a forward pass" pointed at a mechanism that is not there.
What actually happens: `gen.embedding` is stored with `requires_grad=True`, and `from_local` finishes with `.to(device)`. A device copy of a `requires_grad` tensor carries a `grad_fn` and is no longer a leaf, which is what deepcopy refuses. Verified against the cached `conds.pt`: as loaded and after `.to('cpu')` every tensor is a leaf and deepcopy succeeds; after `.to('mps')` `gen.embedding` is not, and it raises.
That makes the failure device-dependent, and the old wording hid it. `device_preference()` defaults to `"mps"`, so the default path is the broken one — but `.to('cpu')` is a no-op, so the original code passes on CPU and on any runner without MPS. Someone reverting to deepcopy and checking with `FIELD_VOICE_DEVICE=cpu` would watch it pass and conclude the clone was unnecessary. No test can catch that on the runners we have, which is precisely why the comment has to point at the device.
Stacked on #64. creek's take reads its line at one fixed pace and there was no way to change it: the voice job was text, seed, variants and `voice_ref`, so the only lever was the words. Chatterbox has six sampling parameters; two are exposed here and four are not, because a field added to the recipe is a permanent part of the committed format. Measured before naming anything, same seed and text as the committed take. Lowering `cfg_weight` from 0.5 to 0.3 changed the delivery and not the pacing at all — different audio, identical 72 tokens. Only at 0.2 did the model start taking longer to say the same sentence (2.90 s of speech against 2.58 s), and `exaggeration` at 0.3 was stronger still at 3.10 s. The extra length is speech rather than silence: leading and trailing silence stay within 0.12–0.20 s throughout. So pacing moves by up to about a fifth, and `exaggeration` is the better lever, which makes sense — it is a conditioning input the model receives, where `cfg_weight` only reweights sampling. `cfg_weight` is called `conviction` here. The name is the whole of the classifier-free guidance step: each token, the model predicts once knowing the text and voice and once deliberately ignorant of them, and the weight says how far past the informed prediction to push — `logits = cond + w * (cond - uncond)`. Higher commits harder to the on-text reading and hurries; lower lingers. `speed` would promise what the measurement shows it does not deliver, and `looseness` would invert the scale so a value copied from Chatterbox's docs meant its opposite. The direction is kept identical to Chatterbox's, and `adapter.py` does the translation, which is what a quarantined boundary module is for. Absent means the model's default rather than a default we chose: neither field is written unless it was asked for, and the adapter passes only what it was given. Recording 0.5 explicitly would look identical today and silently pin it if Chatterbox ever moved. The bounds are narrower than the model's and enforced three times — CLI parser, worker job spec, schema — because widening a range later leaves every committed recipe valid and narrowing one does not. One thing worth recording that fell out of the measurement: the default run reproduced the committed take byte for byte, matching the sha256 the recipe already pins. §1.1 commits outputs because inference does not reproduce across GPU and framework versions, and that stands — but within one fixed environment the seed does exactly what the recipe implies.
|
Starting review of acd80e9. |
|
Reviewed acd80e9 — no findings. The docstring finding from b520227 is addressed, and I checked the fix rather than assuming it. It is genuinely comment-only. Parsing Every claim in the new paragraph holds against the installed 0.1.7. One imprecision, not worth changing on its own: "a regression test would pass on the runners we have" is right in conclusion and slightly off in mechanism. Such a test could not run at all in CI rather than passing there — Reviewing the finding a second time, the wording you landed on is stronger than what I asked for: telling the next reader to leave the cause pointing at the device, and naming I have not resolved the thread — that stays yours. |
Stacked on #64. creek's take reads its line at one fixed pace and there was no way to change it: the voice job was text, seed, variants and `voice_ref`, so the only lever was the words. Chatterbox has six sampling parameters; two are exposed here and four are not, because a field added to the recipe is a permanent part of the committed format. Measured before naming anything, same seed and text as the committed take. Lowering `cfg_weight` from 0.5 to 0.3 changed the delivery and not the pacing at all — different audio, identical 72 tokens. Only at 0.2 did the model start taking longer to say the same sentence (2.90 s of speech against 2.58 s), and `exaggeration` at 0.3 was stronger still at 3.10 s. The extra length is speech rather than silence: leading and trailing silence stay within 0.12–0.20 s throughout. So pacing moves by up to about a fifth, and `exaggeration` is the better lever, which makes sense — it is a conditioning input the model receives, where `cfg_weight` only reweights sampling. `cfg_weight` is called `conviction` here. The name is the whole of the classifier-free guidance step: each token, the model predicts once knowing the text and voice and once deliberately ignorant of them, and the weight says how far past the informed prediction to push — `logits = cond + w * (cond - uncond)`. Higher commits harder to the on-text reading and hurries; lower lingers. `speed` would promise what the measurement shows it does not deliver, and `looseness` would invert the scale so a value copied from Chatterbox's docs meant its opposite. The direction is kept identical to Chatterbox's, and `adapter.py` does the translation, which is what a quarantined boundary module is for. Absent means the model's default rather than a default we chose: neither field is written unless it was asked for, and the adapter passes only what it was given. Recording 0.5 explicitly would look identical today and silently pin it if Chatterbox ever moved. The bounds are narrower than the model's and enforced three times — CLI parser, worker job spec, schema — because widening a range later leaves every committed recipe valid and narrowing one does not. One thing worth recording that fell out of the measurement: the default run reproduced the committed take byte for byte, matching the sha256 the recipe already pins. §1.1 commits outputs because inference does not reproduce across GPU and framework versions, and that stands — but within one fixed environment the seed does exactly what the recipe implies.
Give a voice recipe two knobs for how the line is delivered Stacked on #64. creek's take reads its line at one fixed pace and there was no way to change it: the voice job was text, seed, variants and `voice_ref`, so the only lever was the words. Chatterbox has six sampling parameters; two are exposed here and four are not, because a field added to the recipe is a permanent part of the committed format. Measured before naming anything, same seed and text as the committed take. Lowering `cfg_weight` from 0.5 to 0.3 changed the delivery and not the pacing at all — different audio, identical 72 tokens. Only at 0.2 did the model start taking longer to say the same sentence (2.90 s of speech against 2.58 s), and `exaggeration` at 0.3 was stronger still at 3.10 s. The extra length is speech rather than silence: leading and trailing silence stay within 0.12–0.20 s throughout. So pacing moves by up to about a fifth, and `exaggeration` is the better lever, which makes sense — it is a conditioning input the model receives, where `cfg_weight` only reweights sampling. `cfg_weight` is called `conviction` here. The name is the whole of the classifier-free guidance step: each token, the model predicts once knowing the text and voice and once deliberately ignorant of them, and the weight says how far past the informed prediction to push — `logits = cond + w * (cond - uncond)`. Higher commits harder to the on-text reading and hurries; lower lingers. `speed` would promise what the measurement shows it does not deliver, and `looseness` would invert the scale so a value copied from Chatterbox's docs meant its opposite. The direction is kept identical to Chatterbox's, and `adapter.py` does the translation, which is what a quarantined boundary module is for. Absent means the model's default rather than a default we chose: neither field is written unless it was asked for, and the adapter passes only what it was given. Recording 0.5 explicitly would look identical today and silently pin it if Chatterbox ever moved. The bounds are narrower than the model's and enforced three times — CLI parser, worker job spec, schema — because widening a range later leaves every committed recipe valid and narrowing one does not. One thing worth recording that fell out of the measurement: the default run reproduced the committed take byte for byte, matching the sha256 the recipe already pins. §1.1 commits outputs because inference does not reproduce across GPU and framework versions, and that stands — but within one fixed environment the seed does exactly what the recipe implies. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes the permanent generative recipe format and the voice generation path, but validation is layered and absent knobs preserve backward compatibility for existing recipes. > > **Overview** > Voice generation can now tune **how a line is delivered**, not just the text and reference. **`field generate`** accepts **`--exaggeration`** (0.25–2) and **`--conviction`** (0.1–1); both are **voice-only** and rejected on music prompts like **`--voice-ref`**. > > **`conviction`** is the recipe and wire name for Chatterbox’s **`cfg_weight`**; **`adapter.py`** maps it at the model boundary so committed YAML and the protocol stay musician-facing. Unset knobs are **omitted** from the job, recipe, and **`model.generate`** call so defaults are not silently pinned if the library changes. > > Bounds are enforced in the CLI parsers, worker **`optional_number`**, and **`generativeSoundSchema`** (narrower than the model’s range). Tests cover end-to-end stub wiring, schema kind-split, and live daemon rejection of out-of-range values. > > **`docs/projects/all/voice-generation.md`** §8 records the measurement rationale and naming decision. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f92ee53. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
nested-tracks is Active — chunk 4 is revived by #123 and the soak holds either way; Shipped was the one indefensible value. The three stale prose lines are updated to what actually happened (voice generation through #64/#65 and the #113 fold, effects through #14/#15 with the §6 executor move, musical time through #24), so the keyword and the prose agree on day one. The README claims adoption, not sharing, while agent-config#15 is still open.
Make field-voiced work against the actual model
Five merged pull requests built this worker and every one of them said, accurately, that nothing had loaded Chatterbox yet. Generating creek's line is the first time anything did, and it found three things — two of them mine.
chatterbox-ttsneedspkg_resourcesand nothing in the graph asks for it. Chatterbox watermarks every generation throughperth, whoseperth_net/__init__.pyimportspkg_resources; Python 3.12 no longer ships it and uv does not install it unasked. perth catches that ImportError and setsPerthImplicitWatermarker = None, so the failure surfaced one layer up as'NoneType' object is not callablefrom Chatterbox's constructor, naming neither perth nor setuptools. Declared assetuptools>=70,<81— the upper bound is not decoration, since setuptools removedpkg_resourcesitself and 83.0.0 satisfies a bare>=70while leaving perth exactly as broken.The #60 leak fix never worked. Restoring the builtin voice before each unreferenced variant went through
copy.deepcopy(model.conds), and torch refuses: "Only Tensors created explicitly by the user (graph leaves) support the deepcopy protocol." Some of those tensors come out of a forward pass. The fix was right about the leak and inoperative against the model, and it was verified by readingchatterbox/tts.pyrather than by running it — which is precisely the distinction that review round could not make, because loading the model was the one thing the harness existed to avoid.clone_condsrebuilds the dataclass field by field with each tensor detached, which is the same shape Chatterbox's ownsave/loadround-trip uses.A model-side failure left no trace. The lifecycle turned every exception into a one-line protocol error and logged nothing, so the first of these presented as a single sentence with no stack anywhere, and diagnosing it meant rebuilding the whole model load by hand outside the daemon. The wire still carries one line; the daemon's log now also carries the traceback that explains it.
The regression test for that last one gets its own interpreter rather than the shared harness's. The existing one prefers
python/voiced/.venvwhen it exists, which after a realfield setup voicedcontains Chatterbox — so a test wanting the backend to fail on import would instead load a 2 GB model, and would do so only on machines where setup had been run. Stating the precondition beats inheriting it; that is the same ambient-state trap the environment gate hit twice in #61 and #62.Note
Medium Risk
Changes voice worker runtime dependencies, conditional cloning on every default-voice variant, and error logging; no auth surface, but incorrect cond cloning could still affect voice provenance.
Overview
Fixes field-voiced so the first real Chatterbox load works:
setuptools>=70,<81is declared soperthcan importpkg_resources(otherwise'NoneType' object is not callablewith no useful name on the wire).Replaces
copy.deepcopy(model.conds)withclone_conds, which rebuilds conditionals field-by-field with detached tensor clones—the prior #60 leak fix failed on real tensors from the forward pass.The shared worker daemon now logs full tracebacks to stderr (the voiced log) on request and generation failures while clients still get one-line protocol errors.
Adds a Vitest block that uses a bare Python (no Chatterbox) so a backend import failure is asserted to appear in
voiced.log, avoiding the main harness’s venv that would load the model.Reviewed by Cursor Bugbot for commit b520227. Configure here.