From f00249db9d1ea051d29aa1bcca869fc4b88e83eb Mon Sep 17 00:00:00 2001 From: historia Date: Mon, 24 Aug 2026 02:59:26 -0400 Subject: refactor: add app directory, dir structure change --- app/docs/backend-qwen.md | 67 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 app/docs/backend-qwen.md (limited to 'app/docs/backend-qwen.md') diff --git a/app/docs/backend-qwen.md b/app/docs/backend-qwen.md new file mode 100644 index 0000000..074004c --- /dev/null +++ b/app/docs/backend-qwen.md @@ -0,0 +1,67 @@ +# Backend Option 2: Qwen3-TTS + +The easiest way is to run `python audiobook.py` → **Set up a backend… → qwen-tts** (or `python app/backends/qwen.py`): the TUI pip-installs `qwen-tts` into its managed venv (`app/envs/tts`), configures the two ports and the built-in speaker in `app/converter/config.py`, and prints the launch commands. You can also start the server from the hub's **Server** menu, or let a conversion start it automatically. + +If you prefer to install the backend yourself (in your own environment, not the managed venv), the manual steps are below. Either way the hub detects a running server by its port, so a manually-installed backend works once its server is up. + +Install qwen-tts with pip into your environment: + +```bash +conda activate audiobook +pip install -U qwen-tts +``` + +Run the backend with `qwen-tts-demo`. Add `--no-flash-attn` if FlashAttention isn't installed (see below). Note that the Base model and CustomVoice model run on different ports. + +## Voice clone + +```bash +qwen-tts-demo Qwen/Qwen3-TTS-12Hz-1.7B-Base --ip 127.0.0.1 --port 7861 [--no-flash-attn] +``` + +Then in another terminal: + +```bash +python audiobook.py --backend qwen --clone reference.wav +``` + +The reference `.wav` should be ~10-15 seconds (3 second minimum, 60 second maximum; ~15 seconds is ideal). Longer is **not** better. + +Whisper (`faster_whisper` or `whisper`) is used automatically to transcribe the reference audio. Without a Whisper backend it falls back to x-vector-only cloning. Override with `--transcription "What the .wav says"` or skip transcription with `--no-transcription`. + +## Custom voice (i.e. built-in voice) + +```bash +conda activate audiobook +qwen-tts-demo Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice --ip 127.0.0.1 --port 7860 [--no-flash-attn] +``` + +```bash +python audiobook.py --backend qwen +``` + +Change the voice settings in `app/converter/config.py`. + +## Optional: FlashAttention for qwen-tts-demo server + +FlashAttention provides a *small* speed boost on the `qwen` backend. It is **not** relevant with other backends, and switching to either of those will provide a bigger speed boost. + +`qwen-tts-demo` server tries to use FlashAttention 2 by default and requires `--no-flash-attn` without it. You have two options to install FlashAttention in your python environment: + +1. Build from source (takes absolutely forever). If you run out of memory, lower MAX_JOBS until you don't. + +```bash +conda activate audiobook +pip install ninja packaging psutil +MAX_JOBS=4 pip install --no-build-isolation flash-attn +``` + +2. pip install a prebuilt wheel matching your torch / CUDA / Python / CXX11-ABI combination: + +```bash +conda activate audiobook +python -c "import torch; print(torch.__version__, torch.version.cuda, torch._C._GLIBCXX_USE_CXX11_ABI)" +``` + +- [Official wheels](https://github.com/Dao-AILab/flash-attention/releases) - Pick `cp312` + matching `cuX` + `torchX.Y` + `cxx11abiTRUE/FALSE` +- [Third-party wheels](https://mjunya.com/flash-attention-prebuild-wheels/) -- cgit v1.2.3