Upload Chatterbox-ONNX-WebGPU
Browse files- LICENSE +21 -0
- README.md +45 -0
- onnx/conditional_decoder.onnx +3 -0
- voices/default.bin +3 -0
LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2025 Resemble AI
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
base_model:
|
| 4 |
+
- ResembleAI/chatterbox
|
| 5 |
+
tags:
|
| 6 |
+
- onnx
|
| 7 |
+
- webgpu
|
| 8 |
+
- text-to-speech
|
| 9 |
+
- quick-inference
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# Chatterbox-ONNX-WebGPU
|
| 13 |
+
|
| 14 |
+
[ResembleAI/chatterbox](https://huggingface.co/ResembleAI/chatterbox) (English) for running in a web browser with ONNX
|
| 15 |
+
Runtime Web's WebGPU backend, as used by Quick Inference: a smaller speech decoder and a precomputed default voice.
|
| 16 |
+
The language model and token embeddings are onnx-community's, used unchanged from
|
| 17 |
+
[onnx-community/chatterbox-ONNX](https://huggingface.co/onnx-community/chatterbox-ONNX) (revision `3cab09af`):
|
| 18 |
+
`language_model_q4`, `embed_tokens` and `tokenizer.json`.
|
| 19 |
+
|
| 20 |
+
## Changes from the original
|
| 21 |
+
|
| 22 |
+
- `onnx/conditional_decoder.onnx`: onnx-community's float32 `conditional_decoder.onnx` quantized without calibration
|
| 23 |
+
(round to nearest, symmetric, blocks of 32): matrix multiplications to 4-bit `MatMulNBits`, convolution weights to
|
| 24 |
+
blocked int8 `DequantizeLinear` (opset 21; 4 bits made the vocoder brighter). Activations stay float32.
|
| 25 |
+
534 MB → 145 MB.
|
| 26 |
+
- `voices/default.bin` (0.26 MB): what onnx-community's `speech_encoder.onnx` (float32) outputs for its
|
| 27 |
+
`default_voice.wav`, computed once, so the browser needs neither the speech encoder (591 MB) nor a reference clip.
|
| 28 |
+
Little-endian float32: N, P, F, then `audio_features` [N, 1024], `audio_tokens` [P] (whole numbers),
|
| 29 |
+
`speaker_embeddings` [192] and `speaker_features` [F, 80]. Made by `tools/export/chatterbox_voice.py` in
|
| 30 |
+
[Quick Inference](https://github.com/mdanyalmalik/quick-inf).
|
| 31 |
+
|
| 32 |
+
The decoder is a modified file: its output is close to, but not identical to, the original's. On eight test
|
| 33 |
+
sentences, Whisper small.en heard it with a 4.5% word error rate, the same as the original float32 graphs.
|
| 34 |
+
|
| 35 |
+
## Use
|
| 36 |
+
|
| 37 |
+
As the ONNX example in onnx-community's model card, with this file's four arrays in place of the speech encoder's
|
| 38 |
+
outputs (`audio_features` before the text's embeddings in the first language-model step, exaggeration 0.5, greedy
|
| 39 |
+
speech tokens with repetition penalty 1.2 until token 6562) and this decoder: `audio_tokens` and the new tokens with
|
| 40 |
+
the two speaker arrays → 24 kHz audio. Quick Inference speaks one sentence at a time and runs the text through the
|
| 41 |
+
Python package's `punc_norm` first.
|
| 42 |
+
|
| 43 |
+
## Licence
|
| 44 |
+
|
| 45 |
+
MIT, as Chatterbox (`LICENSE`).
|
onnx/conditional_decoder.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4bc107a9996b313f5d1a094cdbccd9afaa20e6be596170eac74d8b0d903f1663
|
| 3 |
+
size 145358459
|
voices/default.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1cb6ec75b9d8e58c4c5d7936c887307fe16c7b76bd91bbeda9e503fc9a9f8191
|
| 3 |
+
size 255732
|