g
gyccc/iic-speech_UniASR_asr_2pass-tr-16k-common-vocab1582-pytorch-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

iic/speech_UniASR_asr_2pass-tr-16k-common-vocab1582-pytorch #NPU

模型信息

  • 模型名: iic/speech_UniASR_asr_2pass-tr-16k-common-vocab1582-pytorch
  • 任务类型: automatic-speech-recognition (ASR)
  • 模型架构: UniASR 2pass (SANMEncoderChunkOpt + FsmnDecoderSCAMAOpt + CifPredictorV2)
  • 语言: Turkish (土耳其语)
  • 来源: ModelScope — https://modelscope.cn/models/iic/speech_UniASR_asr_2pass-tr-16k-common-vocab1582-pytorch

环境信息

项目版本
NPUAscend910B
CANN8.5.1
Python3.11
torch_npu2.6.0
funasr1.3.1

模型下载

通过 ModelScope snapshot_download 下载至本地缓存目录,推理时从本地加载。

音频预处理

  • 采样率:16kHz
  • 单声道
  • 通过 torchaudio 加载 WAV 文件

NPU 推理命令

python inference.py

NPU 推理输出

karşılıklı cümleler havalarda uçuşuyor iktidar tarafı bunu referanduma götürmeme kararında ilk defa belki de böyle bir geri adımın içerisinde iktidar partisi ve erdoğan çünkü bunu evet sandıktan

CPU-NPU 精度一致性校验

通过 register_forward_hook 在 model.model.encoder 上捕获 encoder 输出,计算 CPU 与 NPU 之间的数值差异。

指标值
max_abs_error0.00499
mean_abs_error0.000136
relative_error0.069%
cosine_similarity0.99999985
threshold1.0%
resultPASS

Benchmark 结果

指标值
avg_latency_ms3292.61
min_latency_ms3244.24
max_latency_ms3372.08
p50_latency_ms3280.42
p90_latency_ms3352.57
p95_latency_ms3362.32
audio_duration_sec14.50
real_time_factor0.2271

工程结构

iic-speech_UniASR_asr_2pass-tr-16k-common-vocab1582-pytorch-NPU/
├── model_utils.py          # 模型加载与音频处理工具
├── inference.py            # NPU 推理脚本
├── eval_consistency.py     # CPU-NPU 数值一致性校验
├── benchmark.py            # 性能测试
├── requirements.txt        # 依赖
├── .gitignore
├── assets/
│   └── test.wav            # 测试音频
├── logs/
│   ├── inference.log
│   ├── consistency.log
│   └── benchmark.log
├── screenshots/
│   └── self_verification.png
└── README.md

运行说明

# 安装依赖
pip install -r requirements.txt

# NPU 推理
python inference.py

# CPU-NPU 一致性校验
python eval_consistency.py

# 性能测试
python benchmark.py

#NPU