本文档记录 DFSMN 语音降噪模型(48kHz causal)在昇腾 NPU (Ascend 910B3) 上的迁移适配与精度验证结果。
该模型基于 Deep FSMN (Feedforward Sequential Memory Network) 架构,采用 9 层 FSMN 结构,输入 120 维声学特征,输出 961 维相位敏感掩码(Phase-Sensitive Mask),支持 48kHz 采样率的 causal 实时降噪。
相关获取地址:
参考文档:
| 组件 | 版本 |
|---|---|
CANN | 8.5.1 |
torch | 2.8.0 |
torch_npu | 2.8.0.post4 |
modelscope | 1.37.0 |
librosa | latest |
Ascend 910B3,单卡推理[B, T, 120] 声学特征[B, T, 961] 相位敏感掩码conda create -n iic_speech_dfsmn_ans python=3.10 -y
conda activate iic_speech_dfsmn_ans
pip install torch==2.8.0 torch_npu==2.8.0.post4 \
-i https://mirrors.huaweicloud.com/repository/pypi/simple \
--trusted-host mirrors.huaweicloud.com
pip install modelscope librosa soundfile numpy \
sortedcontainers simplejson addict datasets pyarrow \
-i https://mirrors.huaweicloud.com/repository/pypi/simple \
--trusted-host mirrors.huaweicloud.commodelscope download --model damo/iic_speech_dfsmn_ans_psm_48k_causal \
--local_dir ./iic_speech_dfsmn_ans_psm_48k_causalpython inference.py --feature fbank_features.npy --device npufrom inference import run_inference
import numpy as np
features = np.random.randn(1, 100, 120).astype(np.float32)
result = run_inference(features, device="npu")
print(f"输出: {result['output'].shape}, 耗时: {result['time_ms']:.1f}ms")python evaluate.py验证结果:
[1, 100, 961]测试条件:input [1, 100, 120]。
| 指标 | CPU | NPU (Ascend 910B3) |
|---|---|---|
| 推理耗时 | 101 ms | 5 ms |
| 加速比 | — | 20x |
对比 CPU (PyTorch) 与 NPU (torch_npu) 在相同随机声学特征输入下 DfsmnAns 模型的输出掩码。
| 指标 | 数值 |
|---|---|
| 输出形状 | [1, 100, 961] |
| 鲁棒平均相对误差 | 0.00003% |
| 精度要求 | 平均相对误差 < 1% |
| 精度评测 | 通过 |
pipeline.model 直接获取 DfsmnAns 模型,输入为 [B, T, 120] 声学特征