Views
No views yet
| Attribute | Value |
|---|---|
| Frame Rate | 25 Hz |
| Codebook Size | 8,192 |
| BPS (Bits Per Second) | 325 |
1git clone --recursive https://github.com/Tencent/StableToken.git
2cd StableToken && pip install -r requirements.txt1import os
2from huggingface_hub import snapshot_download
3from transformers import WhisperFeatureExtractor
4from src.model.modeling_whisper import WhisperLFQEncoder
5from src.utils.flow_inference import AudioDecoder
6from src.utils.utils import extract_speech_token, speech_token_to_wav
7
8# 1. Download & Load Models
9model_dir = snapshot_download("tencent/StableToken")
10
11# Load Tokenizer
12tokenizer = WhisperLFQEncoder.from_pretrained(os.path.join(model_dir, "tokenizer")).eval().cuda()
13feature_extractor = WhisperFeatureExtractor.from_pretrained(os.path.join(model_dir, "tokenizer"))
14
15# Load Decoder
16decoder = AudioDecoder(
17 config_path=os.path.join(model_dir, "decoder", "config.yaml"),
18 flow_ckpt_path=os.path.join(model_dir, "decoder", "flow.pt"),
19 hift_ckpt_path=os.path.join(model_dir, "decoder", "hift.pt"),
20 device="cuda"
21)
22
23# 2. Tokenize
24tokens = extract_speech_token(tokenizer, feature_extractor, ["/path/to/audio.wav"], device="cuda")[0]
25
26# 3. Reconstruct
27tts_speech, sampling_rate = speech_token_to_wav(decoder, tokens)| Model | Frame Rate | Codebook Size | UED (%, ↓) |
|---|---|---|---|
| GLM-4-Voice-Tokenizer | 12.5Hz | 16,384 | 31.10 |
| S3 Tokenizer | 25Hz | 4,096 | 26.17 |
| CosyVoice2 | 25Hz | 6,561 | 38.66 |
| StableToken | 25Hz | 8,192 | 10.17 🏆 |
| Model | Frame Rate | BPS | WER (↓) LS-clean | WER (↓) LS-other | WER (↓) SEED-en | WER (↓) SEED-zh | MOS (↑) LS-clean | MOS (↑) LS-other | MOS (↑) SEED-en | MOS (↑) SEED-zh |
|---|---|---|---|---|---|---|---|---|---|---|
| GLM-4-Voice-Tokenizer | 12.5Hz | 175 | 4.04 | 9.33 | 3.54 | 3.23 | 4.07 | 3.99 | 4.16 | 4.10 |
| S3 Tokenizer | 25Hz | 300 | 5.78 | 13.38 | 5.91 | 4.26 | 3.40 | 3.31 | 3.40 | 3.31 |
| CosyVoice2 | 25Hz | 325 | 4.25 | 9.68 | 4.34 | 2.75 | 3.36 | 3.25 | 3.31 | 3.58 |
| StableToken | 25Hz | 325 | 3.84 | 7.99 | 3.44 | 2.62 | 4.09 | 3.83 | 4.01 | 4.18 |
1@article{song2025stabletoken,
2 title={StableToken: A Noise-Robust Semantic Speech Tokenizer for Resilient SpeechLLMs},
3 author={Song, Yuhan and Zhang, Linhao and Wu, Chuhan and Liu, Aiwei and Jia, Wei and Wang, Houfeng and Zhou, Xiao},
4 journal={arXiv preprint arXiv:2509.22220},
5 year={2025}
6}