Text-to-Speech
MLX
Safetensors
Chinese
confucius4
tts
chinese
opt-iq
quantization
quantized
mixed-precision
Instructions to use brokenjade/Confucius4-TTS-mlx-mix with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use brokenjade/Confucius4-TTS-mlx-mix with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir Confucius4-TTS-mlx-mix brokenjade/Confucius4-TTS-mlx-mix
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
Confucius4-TTS — MLX 混合精度量化版(OPTIQ int8)
中文语音合成(TTS)模型,已转换为 Apple MLX 格式,并采用 OPTIQ 混合精度 int8 量化(28 层 float32 + 68 层 int8),可在 Apple Silicon 上本地推理。
模型概述
- 任务:中文文本转语音(Text-to-Speech)
- 采样率:22050 Hz
- 框架:Apple MLX(加载见 mlx-audio)
- 精度:混合精度(float32 / int8 group 量化)
- 用途:本地离线朗读中文文本,无需 GPU 服务器
该混合精度配置经多种精度组合实测比较后选定,已在 Apple M5 Max 芯片上实测可用,同时保留了绝大部分语音生成性能。
量化参数
| 参数 | 值 |
|---|---|
| 量化比特 | 8(int8) |
| 量化组大小(group size) | 64 |
| 量化方式 | 分组缩放(每 64 个权重共享一个 scale) |
| 量化范围 | 仅 T2S 主模型 + W2V-BERT 编码器 |
量化信息记录于仓库内 config.json:
{
"model_type": "confucius4",
"sample_rate": 22050,
"quant_bits": 8,
"quant_group_size": 64
}
子模型组成
本仓库是一个多组件 TTS 系统,共 5 个 safetensors 权重文件:
| 文件 | 大小 | 角色 | 精度 |
|---|---|---|---|
t2s_model.safetensors |
1.39 GB | 文本→语义 token(LLM Transformer,24 层) | 混合:float32 + int8 |
w2vbert_mlx.safetensors |
591 MB | 语音语义编码器(W2V-BERT-2.0) | 混合:float32 + int8 |
s2a_mlx.safetensors |
397 MB | 语义 token→声学(语音解码器) | float32 |
bigvgan_mlx.safetensors |
428 MB | 声码器(HiFi-GAN 类) | float32 |
campplus.safetensors |
26 MB | 说话人/参考音色编码器 | float32 |
另含 checkpoints/tokenizer.json 分词器。
量化张量明细
T2S 主模型(t2s_model.safetensors,24 层 Decoder)
共 68 个 int8 量化张量:
| 张量 | 精度 | 量化层 |
|---|---|---|
mlp.c_fc.weight + mlp.c_proj.weight |
int8 | 全部 24 层 |
attn.c_attn.weight(QKV 合并投影) |
int8 | 层 2–9、12–23(20 层) |
attn.c_attn.weight |
float32(保留) | 层 0、1、10、11(4 层) |
attn.c_proj.weight |
float32(保留) | 全部 24 层 |
规律:所有 MLP 投影与绝大多数 attention 投影量化到 int8;4 层的 c_attn 与全部 c_proj 保留 float32。
W2V-BERT 编码器(w2vbert_mlx.safetensors)
136 个 int8 量化张量:各 encoder 层的 self_attn.linear_q/k/v/out 与 ffn1/ffn2 的 intermediate_dense/output_dense 均量化。
未量化组件
s2a_mlx、bigvgan_mlx、campplus 均为全 float32,未量化——语音解码、声码、说话人编码等影响音频质量的模块保持高精度。
说明与限制
- 本模型适用于 中文 语音合成。
- 本地推理需 Apple Silicon(MLX 依赖 Metal)。
- 量化以
group_size=64的 int8 进行,主要缩减 LLM 与语义编码器模型体积;音频质量关键层保留 float32,以兼顾体积与音质。 - 混合精度配置为实测比较不同精度组合后选定:在 Apple M5 Max 芯片上实测可见效(可用、可正常推理),同时保留了绝大部分语音生成性能(音质与合成效果基本等同高精度版本)。
使用方式
import mlx.core as mx
from mlx_lm.utils import load # 或以 mlx-audio 的 Confucius 加载接口为准
详细推理流程可参考本项目 mlx-audio 的 Confucius4 实现。
- Downloads last month
- 5
Hardware compatibility
Log In to add your hardware
Quantized
Model tree for brokenjade/Confucius4-TTS-mlx-mix
Base model
netease-youdao/Confucius4-TTS