diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 78 |
1 files changed, 72 insertions, 6 deletions
@@ -2,7 +2,7 @@ Convert TXT, PDF, and EPUB files into audiobooks using the Qwen3-TTS voice model. -This builds upon [WhiskeyCoder/Qwen3-Audiobook-Converter](https://github.com/WhiskeyCoder/Qwen3-Audiobook-Converter) adding more output files, metadata, generated cover art, transcription/speed/language options, better text cleanup, and clearer instructions. It also expects the qwen-tts server to be on different ports per model, so two server processes can run at once. +This builds upon [WhiskeyCoder/Qwen3-Audiobook-Converter](https://github.com/WhiskeyCoder/Qwen3-Audiobook-Converter) adding more output files, support for a faster backend, metadata, generated cover art, transcription/speed/language options, better text cleanup, and clearer instructions. It also expects the qwen-tts server to be on different ports per model, so two server processes can run at once. ## Overview @@ -47,7 +47,7 @@ cd qwen3-audiobook-converter pip install -r requirements.txt ``` -## Running the Qwen server and audiobook script +## Running the Qwen Gradio server and audiobook script The audiobook script talks to a Qwen3-TTS Gradio server that is run using `qwen-tts-demo`. Add `--no-flash-attn` if FlashAttention isn't installed (see below). The script expects the custom voice model and base model to be on different ports depending on which you're using. The Qwen model(s) will automatically download. @@ -57,7 +57,7 @@ Put your book files (epub, etc.) in the `input/` folder. Then run the script. Th ```bash conda activate qwen3-tts -qwen-tts-demo Qwen/Qwen3-TTS-12Hz-1.7B-Base --ip 127.0.0.1 --port 7861 +qwen-tts-demo Qwen/Qwen3-TTS-12Hz-1.7B-Base --ip 127.0.0.1 --port 7861 --no-flash-attn ``` Then in another terminal: @@ -75,14 +75,76 @@ Whisper (`faster_whisper` or `whisper`) is used automatically to transcribe the ```bash conda activate qwen3-tts -qwen-tts-demo Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice --ip 127.0.0.1 --port 7860 +qwen-tts-demo Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice --ip 127.0.0.1 --port 7860 --no-flash-attn ``` ```bash python audiobook.py ``` -Edit `converter/config.py` to change which built-in voice is used. +Change the voice settings in `converter/config.py`. + + +## Using the `--faster` backend + +Instead of the Qwen Gradio demos, `--faster` talks to the OpenAI-compatible server from [faster-qwen3-tts](https://github.com/andimarafioti/faster-qwen3-tts), which uses CUDA graph capture for roughly 5-10x faster inference with the same models. **It requires an NVIDIA GPU**. + +**The `--faster` backend always uses voice cloning**. The reference voice and language are configured on the **server**, not through the converter. The server does not transcribe reference audio itself, so transcripts must come from you — either by hand, or with the `tools/make_voices.py` helper (see below). + +### Install + +Install into the **same `qwen3-tts` conda environment** used for the Gradio server. + +```bash +conda activate qwen3-tts +pip install "faster-qwen3-tts[demo]" +``` + +### Run the server + +The pip package does not include the server script, so clone the repository: + +```bash +git clone https://github.com/andimarafioti/faster-qwen3-tts +cd faster-qwen3-tts +``` + +Single voice (the voice is named `default`): + +```bash +python examples/openai_server.py \ + --model Qwen/Qwen3-TTS-12Hz-1.7B-Base \ + --ref-audio /absolute/path/to/reference.wav \ + --ref-text "Transcript of the reference audio." \ + --language English --port 8000 +``` + +Multiple voices — create a `voices.json` mapping names to reference configurations: + +```json +{ + "default": {"ref_audio": "voice1.wav", "ref_text": "Transcript of voice 1.", "language": "English"}, + "obama": {"ref_audio": "voice2.wav", "ref_text": "Transcript of voice 2.", "language": "English"} +} +``` + +```bash +python examples/openai_server.py --voices voices.json --port 8000 +``` + +### Generating voices.json (optional) + +The `tools/make_voices.py` helper builds a `voices.json` for the server: it transcribes every `.wav` in a directory with using whisper (which is in the qwen3-tts environment). By default it puts voices.json into the input directory. Check the help with `-h` for more options. + +```bash +python tools/make_voices.py path/to/wavs +``` + +### Run the converter + +```bash +python audiobook.py --faster [--faster-voice NAME] +``` ## Options @@ -95,10 +157,14 @@ Edit `converter/config.py` to change which built-in voice is used. | `--speed <n>` | Playback speed, pitch-preserving (`1.0` = normal). A normal-speed copy is also output. | | `--single-file` | Merge all chapters into a single file (default: one file per chapter). `m4b` is always one file. | | `--language <lang>` | Output language for the synthesized speech. Can add an accent even if the text is English. | +| `--faster` | Use a faster-qwen3-tts OpenAI-compatible server (up to 5x faster in certain cases). | +| `--faster-voice <name>` | Chooses a voice from voices.json when using `--faster` with multiple voices. | + +Other options and defaults are configured in `converter/config.py` ## FlashAttention for qwen-tts-demo server (optional) -The server tries to use FlashAttention 2 by default, but `--no-flash-attn` works without it. On supported GPUs FlashAttention can give a modest speedup. +This is **not** used with the `--faster` backend. The Gradio server tries to use FlashAttention 2 by default, but requires `--no-flash-attn` without it. On supported GPUs FlashAttention can give a modest speedup. 1. Build from source (takes absolutely forever). If you run out of memory, lower MAX_JOBS until you don't. |
