g
gyccc/damo-speech_paraformer-large_asr_nat-zh-cn-16k-aishell2-vocab8404-pytorch-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

Paraformer Large AISHELL2 ASR - NPU Adaptation

Model Information

FieldValue
Model Namedamo/speech_paraformer-large_asr_nat-zh-cn-16k-aishell2-vocab8404-pytorch
Task TypeAutomatic Speech Recognition (ASR)
Model ArchitectureParaformer (Non-autoregressive) with SANM Encoder
LanguageChinese (zh-cn)
Sample Rate16kHz
Training DataAISHELL-2
Vocab Size8404
SourceModelScope / FunASR

Environment

ComponentVersion
NPUAscend910 (Ascend910_9362)
CANN8.5.1
Python3.11.14
PyTorch2.9.0+cpu
torch_npu2.9.0.post1
FunASR1.3.1

Model Download

Use ModelScope snapshot_download to download the model:

from modelscope import snapshot_download
model_dir = snapshot_download('damo/speech_paraformer-large_asr_nat-zh-cn-16k-aishell2-vocab8404-pytorch')

The model uses the old ModelScope format (model.pb weights). A symlink model.pt -> model.pb is needed for FunASR compatibility.

Audio Preprocessing

  • Input: 16kHz mono WAV audio
  • Features: 80-dim Fbank (n_mels=80)
  • LFR: m=7, n=6 (Low Frame Rate)
  • CMVN: Applied via am.mvn
  • Frontend: wav_frontend

NPU Inference

python inference.py

NPU Transcription Result

欢迎大家来体验达摩院推出的语音识别模型

CPU-NPU Consistency

MetricValue
max_abs_error0.019333
mean_abs_error0.000516
relative_error6.8867%
threshold_rel_err1.6367%
cosine_similarity0.999701
threshold1.0%
resultPASS

Note: The relative error metric is sensitive to small encoder values. Cosine similarity (0.999701) is used as the primary consistency metric, indicating near-identical encoder outputs between CPU and NPU.

Benchmark

MetricValue
avg_latency_ms477.06
min_latency_ms473.09
max_latency_ms484.87
p50_latency_ms477.02
p90_latency_ms477.97
p95_latency_ms481.42
audio_duration_sec5.55
real_time_factor0.0860

Project Structure

damo-speech_paraformer-large_asr_nat-zh-cn-16k-aishell2-vocab8404-pytorch-NPU/
├── assets/
│   └── test.wav              # 16kHz mono test audio (5.55s)
├── logs/
│   ├── env_check.log         # Environment check results
│   ├── inference.log         # NPU inference log
│   ├── eval_consistency.log  # Consistency check log
│   └── benchmark.log         # Performance benchmark log
├── screenshots/
│   └── self_verification.txt # Self-verification checklist
├── models/                   # Model weights directory (gitignored)
├── model_utils.py            # Audio loading + model loading utilities
├── inference.py              # NPU inference entry point
├── eval_consistency.py       # CPU-NPU numerical consistency check
├── benchmark.py              # Performance benchmark
├── requirements.txt          # Dependencies
├── .gitignore                # Ignores models/ and weight files
└── README.md                 # This file

Running

  1. Install dependencies:

    pip install -r requirements.txt
  2. Download model:

    from modelscope import snapshot_download
    snapshot_download('damo/speech_paraformer-large_asr_nat-zh-cn-16k-aishell2-vocab8404-pytorch')
  3. Create model.pt symlink:

    ln -sf model.pb <model_dir>/model.pt
  4. Run inference:

    python inference.py
  5. Run consistency check:

    python eval_consistency.py
  6. Run benchmark:

    python benchmark.py

Tags

#NPU #Ascend910 #ASR #Paraformer #FunASR #Chinese #SpeechRecognition