Repository navigation
feat(speech): redraw whole speech replies the silence guard ended - #1160
plotarmordev wants to merge 4 commits into
Conversation
--allowed-controls keeps listed delivery controls in a normalized form and strips other cue-only brackets before speech input validation; contextual and unknown brackets stay as written. The built-in cue word list holds only words from tags in Fish Audio's public sources.
Add --silence-floor-dbfs and --silence-seconds so native Drama speech can stop after a sustained run below an explicit frame-power floor, keeping the audio and reporting the finish as silence. The guard is off unless both flags are set and is refused for non-speech models.
Bring the opt-in --allowed-controls filter onto the silence guard so silence redraws can reuse its rules. The two changes touch separate flags; only the changelog and the flag parser needed joining.
Add --silence-redraws with an optional --silence-redraw-budget-s and --silence-redraw-controls so a whole reply that ends as silence is drawn again with a salted seed while the budget and X-Deadline-S allow. Streams are never redrawn, and enabled redraws report X-Silence-Redraws.
|
Thanks @plotarmordev for the opt-in redraw policy, the - Synthema, Ash's AI Assistant. |
|
@plotarmordev, one more question that came up while we carried the speech PRs together, about how #1159 and this one meet. With both - Synthema, Ash's AI Assistant. |
|
Thanks for checking how the two meet. A mid trip is meant to start a redraw. The redraw rule keys on the For the header, please keep it per sent take, 0 or 1 as documented, like |
…st.zig - Landed after #1158 and #1159, this PR takes zig/src/server/cli.zig to 606 lines, so its two remaining flag tests (--device and --segments, and the GPU engine's flags) move unchanged to zig/src/server/cli_test.zig, which reaches the private helpers through a test-only cli.Test, as log.zig's Test does.
|
Landed on main as b0e6b5b with a maintainer fix-up (2466035), thank you @plotarmordev. Whole speech replies the silence guard ended are redrawn. On a GB10, the default Drama output stayed byte-identical to main on six inputs with these options off, repeats were 6/6 equal, and concurrent equalled solo. The speech, Drama, server and golden host suites pass on current main. - Synthema, Ash's AI Assistant. |
|
This shipped in TensorFold 1.1.4: https://github.com/ashhart/TensorFold/releases/tag/v1.1.4 Thank you @plotarmordev for the contribution. - Synthema, Ash's AI Assistant. |
What this changes
Stacked on the silence-guard PR (#1157) and #1152, the allowed-controls PR, whose filter
--silence-redraw-controlsreuses; review it after them.Adds opt-in
serve --silence-redraws N. When the silence guard ends a whole Drama speech reply withsilence, the reply is drawn again up to N times, and the last take with audio is sent.Flags:
--silence-redraws Ntakes 0 to 255 and needs an enabled silence guard.--silence-redraw-budget-s SECONDStakes a positive finite value.--silence-redraw-controls LISTtakes a control list. The budget and the list both need N of 1 or more. Text models refuse--silence-redrawsat startup, including an explicit 0. With the flag omitted or 0, replies are unchanged andX-Deadline-Sis not read.Seeds: redraw k uses
seedFor(prompt, TENSORFOLD_SEED_SALT + k), and the first take keeps salt + 0.Budget: a redraw starts only if the time since receipt plus the previous take's duration fits the lower of
--silence-redraw-budget-sand the request'sX-Deadline-S. While redraws are on, a malformedX-Deadline-Sgets HTTP 400, streams included. If the engine is busy, submission is retried every 20 ms until the latest start that still fits. Without a budget, a busy redraw is not retried and the previous take is sent.Reply: a redraw that ends
stoporlengthis sent. A redraw that endssilencereplaces the previous take, and redrawing continues. A redraw that cannot start, or ends without audio, leaves the previous take.X-Finish-Reasonis the sent take's.Controls: a nonempty list filters redrawn input with the
--allowed-controlsrules. An empty list ('') makes redraws plain speech:Direction:line beforeLine:is dropped;Input with nothing speakable left is not redrawn.
Header: with N of 1 or more, every speech response, including streams and errors, carries
X-Silence-Redraws, the number of redraws admitted to the engine.Streams are never redrawn. They end with the
silencetrailer as before.Example, illustrative only:
--silence-floor-dbfs F --silence-seconds S --silence-redraws 2 --silence-redraw-budget-s 60.Receipt
49ea53bd, on the silence-guard PR's75736ad0merged with feat(server): filter speech delivery controls with an opt-in allowlist #1152'se4561788, on maind1018b31. Host tests: Linux aarch64, Zig 0.17.0, CPU only, no MLX or PyTorch. GPU run: one NVIDIA GB10, native CUDA build (-Dsm=121), no MLX or PyTorch, checkpointfishaudio/drama-3with itscodec.pth(revision not recorded), built-in voice. Stock is upstreamd1018b31. The candidate isca60e9c8, an integration of all the open Drama patches ond1018b31, this one included, not this branch's tip.tools/bench_concurrent.py --alone --serialortoken_shaagainst"draft": false: speech returns PCM, so PCM is compared by SHA-256.TENSORFOLD_SEED_SALT0, 10 and 20), each sent the same 10 public synthetic texts: 180 requests, all complete. Every server ran with--parallel 1 --no-drafts --prompt-cache-gib 0 --context 4096andTF_DRAMA_PREFILL_ROWS=1, which keeps the candidate on stock's prefill schedule.--silence-floor-dbfs -50 --silence-seconds 8("base"); base plus--silence-onset-s 2 --silence-onset-voiced-s 0.4 --silence-mid-s 2 --silence-mid-min-voiced-s 0.4("silence"); silence plus--silence-redraws 2 --silence-redraw-budget-s 60 --silence-redraw-controls '' --short-reply-ratio 0.6 --short-reply-chars-per-s 12("redraw"); and--register-redraw-st 6 --register-redraw-high 50 --register-high-hz 300 --silence-redraw-budget-s 60("register").silenceor was judged short. Each of the 22 silenced takes in the base and silence arms is a prefix of the off audio.silence, with plain-speech redraws (--silence-redraw-controls ''). That was 20 redraws in total, the sum ofX-Silence-Redraws. 8 of those replies then endedstopand 4 still endedsilence, sosilencefinishes fell from 12 to 4 of 30. No other reply was redrawn.seedFor(prompt, salt + k).tools/bench_openai.py: not measured; the GPU run compared PCM, not speed. Redraws run only after asilencefinish and are bounded by N and the budget. The second PCM buffer is allocated only after a silenced take.ttft_sfromtools/bench_cache.py --require-coldon a long prompt, or "n/a" with the reason when the change cannot reach prompt processing: n/a. The first take's prompt path is unchanged, and a redraw reuses its prompt unless--silence-redraw-controlschanges the input.zig build test --summary all: 1263/1267 passed, 2 skipped, 2 failed. Both failures are cortheon linear-time assertions in untouched code; the upstream base also failed cortheon fuzz under similar host load.CUDA_VISIBLE_DEVICES= zig build test-cuda-host --summary all: 598/599 passed, 1 failed (cortheon fuzz).f01efa1a, both suites passed in full: 213/213 steps, and 131/131 steps with 592/592 tests.test-kernel-contract: 55/55.test-golden: 306/319 equal, 0 unexpected differences; additional corpus 26/26.tools/zig/test_speech_flags.py: 1 test, OK.zig build test, the native build and the speech-flag test; counts were not recorded.2e6d4858, the unsquashed branch tip, whose last commit changes only one plain-speech test input:zig fmt --checkpassed, andzig build test --summary allpassed 213/213 steps, 2992/3006 tests, 14 skipped.49ea53bd, which squashes that branch over feat(server): filter speech delivery controls with an opt-in allowlist #1152's filter:zig fmt --checkpassed, andzig build test --summary allpassed 213/213 steps, 2998/3012 tests, 14 skipped.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.SUMMARYline is in the receipt.