SoulX-Singer 是一款高保真、零样本歌声合成模型,能让用户为未见过的歌手生成逼真的歌声。
本仓库包含基于 torch_npu 为 华为昇腾 910 设备适配的 SoulX-Singer 版本,包括推理脚本、精度评估和性能基准测试。
| 指标 | 数值 |
|---|---|
| 模型参数 | 704M |
| 任务 | 歌声合成(SVS) |
| 框架 | PyTorch + torch_npu |
| NPU 硬件 | 昇腾 910(Atlas 800 A2) |
| 推理精度 | FP32 |
| CPU 推理时间 | 2.805s |
| NPU 推理时间 | 0.126s |
| 加速比 | 22.2 倍 |
| 指标 | 梅尔频谱图 | 音频波形 |
|---|---|---|
| 平均绝对误差(MAE) | 6.60e-08 | 1.09e-02 |
| 均方误差(MSE) | 2.68e-14 | 3.45e-04 |
| 最大绝对差值 | 9.54e-07 | 6.29e-02 |
| 余弦相似度 | 0.9999999 | 0.9999992 |
| 相对误差 | 0.000009% | 0.171% |
| 通过(<1%) | ✅ 通过 | ✅ 通过 |
总体精度:✅ 通过——NPU 输出与 CPU 基准在数值精度容差范围内一致。
| 平均值 | 标准差 | 最小值 | 最大值 |
|---|---|---|---|
| 0.126s | 0.002s | 0.124s | 0.129s |
SoulX-Singer 采用流匹配(Flow Matching)架构进行歌声合成:
模型 checkpoint:model.pt(2.8 GB)
# Install PyTorch NPU
pip install torch torch_npu
# Install other dependencies
pip install numpy pyyaml模型检查点(model.pt,2.8 GB)托管在 ModelScope 上。运行推理前请先下载该模型。
pip install modelscope
modelscope download --model Soul-AILab/SoulX-Singer --local_dir ./SoulX-Singer或者,从 AtomGit Releases 下载(对于大文件,建议使用 Web UI 上传)。
# CPU-only inference
python inference.py --skip-npu --output-dir output --n-steps 32
# Full NPU evaluation (CPU baseline + NPU inference + accuracy comparison + benchmark)
python inference.py --output-dir output --n-steps 32 --benchmark-runs 10import torch, yaml
from model import SoulXSinger
with open('config.yaml') as f:
config = yaml.safe_load(f)
model = SoulXSinger(config)
ckpt = torch.load('model.pt', map_location='cpu', weights_only=True)
model.load_state_dict(ckpt['state_dict'], strict=True)
model.eval()
# Run on NPU
model = model.npu()
text = torch.randint(0, 3000, (1, 100)).npu()
pitch = torch.randint(0, 256, (1, 100)).npu()
note_type = torch.randint(0, 256, (1, 100)).npu()
f0 = torch.randint(0, 361, (1, 100)).npu()
noise = torch.randn(1, 1, 128).npu()
with torch.no_grad():
audio, mel = model(text, pitch, note_type, f0, n_steps=32, noise=noise)| 文件 | 描述 |
|---|---|
model.py | 模型架构定义(587 个参数,总计 704M) |
inference.py | NPU 推理脚本,包含 CPU 对比、精度检查和性能基准测试 |
config.yaml | 模型配置 |
model.pt | 预训练检查点(2.8 GB)—— 从 ModelScope 或 AtomGit Releases 下载 |
output/eval_results.json | 完整评估结果(JSON 格式) |
output/run.log | 完整评估运行日志 |
注意:
model.pt(2.8 GB)和model-svc.pt(2.6 GB)未纳入 git 版本控制(详见.gitignore)。请从 ModelScope 下载,或通过 AtomGit 网页界面手动上传。
config.yaml 对完整模型架构进行了重构。nn.Embedding 作为输入编码器(文本、音高、类型、F0)weight + bias 格式@misc{soulxsinger,
title={SoulX-Singer: Towards High-Quality Zero-Shot Singing Voice Synthesis},
author={Jiale Qian and Hao Meng and Tian Zheng and Pengcheng Zhu and Haopeng Lin and Yuhang Dai and Hanke Xie and Wenxiao Cao and Ruixuan Shang and Jun Wu and Hongmei Liu and Hanlin Wen and Jian Zhao and Zhonglin Jiang and Yong Chen and Shunshun Yin and Ming Tao and Jianguo Wei and Lei Xie and Xinsheng Wang},
year={2026},
eprint={2602.07803},
archivePrefix={arXiv},
primaryClass={eess.AS},
url={https://arxiv.org/abs/2602.07803},
}Apache 2.0 许可协议——详情请参见 原始 SoulX-Singer 代码库。
有关 NPU 适配问题,请在本代码库中提交 issue。
原作者:qianjiale@soulapp.cn,menghao@soulapp.cn,wangxinsheng@soulapp.cn