w
gcw_uQ09W7jl/AbelZimba-whisper-bemba-stt-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

AbelZimba/whisper-bemba-stt

#NPU

模型信息

属性值
模型名称AbelZimba/whisper-bemba-stt
任务类型automatic-speech-recognition
模型架构WhisperForConditionalGeneration
Backendtransformers
来源HuggingFace
模型权重URLhttps://huggingface.co/AbelZimba/whisper-bemba-stt

基于 OpenAI Whisper 微调的 Bemba 语语音识别模型,在 Ascend 910B NPU 上完成适配。

环境信息

属性值
NPUAscend910_9362
CANN8.5.1
Python3.11.14
PyTorch2.9.0+cpu
torch-npu2.9.0.post1
transformers4.57.6
soundfile0.13.1
numpy1.26.4

安装依赖

pip install -r requirements.txt

模型下载

import os
os.environ['HF_ENDPOINT']='https://hf-mirror.com'
from huggingface_hub import snapshot_download
model_dir = snapshot_download(repo_id="AbelZimba/whisper-bemba-stt", local_dir="./model_cache/whisper-bemba-stt", max_workers=1)

下载后,processor 与 model 均从本地 model_dir 加载,使用 local_files_only=True 确保离线加载。

推理方法

export MODEL_DIR=./model_cache/whisper-bemba-stt
python inference.py /path/to/test.wav
python inference.py --audio /path/to/test.wav

NPU 调用结果

属性值
NPU 设备Ascend910_9362
torch.npu.is_available()True
推理设备npu:0
模型参数设备npu:0
输入 Tensor 设备npu:0

NPU 设备调用证据

模型推理结果

属性值
测试音频./test.wav (4.00s, 16kHz, mono)
转写结果[звук висок]
推理耗时~0.50s (首次) / ~0.136s (平均)
设备npu:0 (Ascend910_9362)
状态PASS

真实 NPU 推理输出:

Model: AbelZimba/whisper-bemba-stt
NPU device: Ascend910_9362
Device: npu:0
Model param device: npu:0 dtype: torch.float32
Audio loaded: shape=(64000,), sr=16000, duration=4.00s
Input input_features device: npu:0 shape: torch.Size([1, 80, 3000]) dtype: torch.float32
Inference time: 0.504s
Transcription:  [звук висок]
Status: PASS

模型推理结果

性能测试

指标值
avg0.136s
p500.136s
min0.134s
max0.143s
首次推理0.504s
dtypefloat32
devicenpu:0

CPU-NPU 一致性

指标值
CPU 转写[звук висок]
NPU 转写[звук висок]
文本一致完全一致
Encoder hidden cosine1.0001
Encoder hidden L1 diff0.004437
结论PASS

已知限制

  • 需 float32,float16 在 NPU 上 bias mismatch
  • 输入 30s 内
  • 合成测试音频转写为通用字符,真实 Bemba 需 --audio 验证
  • 首次推理含编译 ~0.5s

Agent 适配流程

Agent 适配流程