Add qwentts-serve HTTP server, WebUI, device selection and configurable talker KV context - #24
Open
soymh wants to merge 6 commits into
Open
Add qwentts-serve HTTP server, WebUI, device selection and configurable talker KV context#24soymh wants to merge 6 commits into
soymh wants to merge 6 commits into
Conversation
- webui: FastAPI SSE proxy + EventSource frontend (tools/webui/) - qwentts-serve: OpenAI-compatible server following llama-server pattern - backend: --device and --list-devices CLI flags for device selection - stops/cancel: POST /v1/audio/speech/cancel endpoint - instruct: --instruct flag for VoiceDesign models
# Conflicts: # src/backend.h # src/pipeline-tts.cpp # src/qwen.cpp # src/qwen.h # tools/qwen-tts.cpp
…-shot->per-sentence fallback; tts: configurable talker KV context (--talker-ctx)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
I was working on a server binary and some other stuff. This PR was opened by me but written and done by my agent, so I want to be transparent about the process from the start.
We were not aware of the project's AI submission rules when we started this work. Because of limited time, we opened the PR in this way. If that is not acceptable, we apologize, and you are free to close it.
This branch is based on the latest upstream master (0 commits behind) and only adds our changes on top. Here is a detailed description of each change.
qwentts-serve: a new OpenAI-compatible HTTP server
A separate server binary (
qwentts-serve) following the llama-server pattern, built on the sameqwen-corelibrary as the existing tools. It shares the vendored HTTP and JSON libraries (cpp-httplib,yyjson) already used bytts-server.Endpoints:
GET /health- liveness check.GET /v1/models- reports the loaded model (with an optional--alias).GET /v1/voices- lists the named CustomVoice speakers of the loaded model.POST /v1/audio/speech- OpenAI-compatible synthesis. Supportsresponse_format=wav(one-shot RIFF) andresponse_format=pcm(real-time streaming of s16le 24 kHz chunks as they are generated). Acceptsvoice,instruct, and standard sampling overrides per request.POST /v1/audio/speech/cancel- cancels the in-flight synthesis.The PCM streaming path runs synthesis on its own thread and pushes bytes into a queue that the connection thread drains into a chunked response, so a slow client cannot stall the batched worker. A client disconnect aborts generation and frees the GPU.
While merging, we also ported
qwentts-serveto the newqt_init_paramsAPI (the codec chunk configuration moved from the per-request TTS params intoqt_init_params), so it stays compatible with the current upstream internals.WebUI (tools/webui/)
A browser frontend (FastAPI backend + plain HTML/JS/EventSource page, no build step) that proxies to the HTTP server.
--one-shot, or per-requestoneshot): the whole input is synthesized as a single utterance so the model sees the complete context.split_sentencesnow protects ellipsis (...and...unicode) so they no longer split a sentence.Backend device selection
New
--device <name>and--list-devicesflags (also exposed in the library API asqt_init_params.deviceandqt_list_devices()). The backend can be pinned explicitly to a device such ascuda0,vulkan, orcpuinstead of relying only on theGGML_BACKENDenvironment variable and auto-selection.Configurable talker KV cache size
New
--talker-ctx <n>flag (andqt_init_params.talker_max_ctx) that sizes the talker KV cache in positions instead of the hardcoded 4096. Default remains 4096 (0 selects it). This is useful for one-shot synthesis of long prompts where the VRAM allows a larger context.models.sh fix
The download script pointed at a stale repository (
Serveurperso/qwentts.cpp-GGUF) with outdated file names. It now points at the currentServeurperso/Qwen3-TTS-GGUFrepository and downloadsqwen-tokenizer-12hz-Q8_0.gguf,qwen-talker-1.7b-customvoice-Q8_0.gguf, andqwen-talker-1.7b-customvoice-Q4_K_M.gguf.Verification
Built with CUDA (SM86) and verified end to end on an RTX 3050 Laptop with 4 GB VRAM:
test-abi-c(the C99 ABI lock-in test) passes.--list-devicesreportsCUDA0andCPU.--speaker vivian,--lang English).We understand this work may not be merged, and that is fine. Our main goal was to share the changes in case they are useful to the project. We are happy to adjust, split, or rework anything the maintainers prefer.
Thank you for the project.