Repository navigation
speech: openai_audio, a cmd worker for any OpenAI-compatible audio server - #154
Conversation
…rver
tools/speech/openai_audio/worker.py serves speech (POST /v1/audio/speech, raw PCM
streamed into speech.wav) and transcription (POST /v1/audio/transcriptions ->
transcript.json) through a model's own server, which it starts from options.server
({port}, {id}, {weights}) and stops on exit, as openai_server does for chat; or an
existing options.url. Standard library only. Server 4xx -> invalid_request_error,
503/unreachable -> service_unavailable; 64-bit seeds are folded to 32 bits.
test_worker.py runs it against a fake server (no GPU).
Review of 944f585: transcription replaced the requested temperature with 0 and ignored timestamp granularity, so temperature=0.7 with timestamps=word succeeded with no words. - temperature, language and prompt go to the server as asked. A server that cannot honour one refuses it, and the caller gets that 400 with the server's reason (Gufo's Qwen3-ASR: "supports temperature 0 only"). - options.timestamps lists the granularities the server returns ([] by default). A request for a listed one asks for verbose_json with that timestamp_granularities[] (word also asks for segment when listed), and a reply without them is a server_error, never a transcript missing what was asked. - word not listed is refused (invalid_request_error) before the server is asked. segment not listed keeps the whole clip as one segment, since the daemon asks for segments for every verbose_json, srt and vtt reply. The fake server now records each request's form fields: 23 checks (was 8), covering forwarding, refusals and both timestamp configurations. CI runs them.
jayleaton
left a comment
There was a problem hiding this comment.
Thanks for addressing the transcription options and adding the request-recording tests. Temperature, language and prompt are now forwarded, unsupported word timestamps are refused, and all 23 tests pass.
Blocking: tools/speech/openai_audio/worker.py:147. start_new_session=True puts the model server outside the worker's process group. The daemon's abort and timeout path SIGKILLs the worker's group, so Python's cleanup never runs. The server can survive, still holding GPU memory, while the scheduler thinks the tool is unloaded. Please make the server's lifetime follow the daemon's kill scope, including Gufo container teardown, and add a fake-server regression test that SIGKILLs the worker mid-generation.
Nit: worker.py:235. A seed of 0 is valid, but the truthiness check drops it. Please forward it when send_seed is enabled, and test that the server receives 0.
The model's server no longer gets a session of its own (start_new_session): it stays in the worker's process group, so the daemon's SIGKILL of that group on abort or timeout takes it down too, and PR_SET_PDEATHSIG (SIGTERM) covers the worker dying alone. Before, a hard kill left the server, and a Gufo container behind it, holding the GPU. An unload now signals the server and every process below it (/proc children) instead of its group. Seed 0 was dropped by a truthiness check: a request's seed is sent whenever it has one and send_seed is on. Tests: SIGKILL of the worker's group mid-generation, the server is gone (fails on the old worker: the server outlived it); the server receives seed 0; no seed, none sent; send_seed false, none sent.
|
Review fixes pushed (eaca3c0, new commit, no force-push):
— SMF Works |
# Conflicts: # .github/workflows/ci.yml
jayleaton
left a comment
There was a problem hiding this comment.
Randy's round-2 review found nothing left to fix. Seed 0 is now forwarded, and the server dies with the worker in both the group-SIGKILL and the worker-only SIGKILL cases. Thanks!
…upstream/gufo-host-tz
…ream/scheduler-protect-loading
…ream/observe-snap-logs
…split/5-minimax-workflows ci.yml: keep this branch's steps.
…amd-split/5-minimax-workflows # Conflicts: # .github/workflows/ci.yml
Part 2 of 5 (split from #152).
A generic cmd worker that serves speech and transcription through any OpenAI-compatible audio server. Independent of the AMD work.
From the review of #152:
timestampslists what the server supports (default[]). A listed granularity requestsverbose_jsonwithtimestamp_granularities[]. An unlistedwordrequest is refused with a 400 before the server is called; an unlistedsegmentrequest returns the whole clip as one segment. A declared granularity missing from the reply is a server error, never a silent success.tools/speech/openai_audio/test_worker.py: 23 checks (was 8) against a fake server that records the form fields it received. CI runs it.Checks run locally:
zig build test,zig build test-unit(26/26), audio 23/23, syntax,git diff --check.