c
zyzoe/cohere-transcribe-03-2026
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

CohereLabs/cohere-transcribe-03-2026 昇腾 NPU 适配

模型简介

CohereLabs/cohere-transcribe-03-2026(原始权重地址,HuggingFace;本仓因 HF gated 同步自 ModelScope 镜像 CohereLabs/cohere-transcribe-03-2026)是 Cohere 开源的 14 语种通用语音转写(ASR)模型,约 2.06B 参数:NeMo 风格 Conformer 编码器(d_model=1280,48 层,rel-pos 注意力)+ Transformer 解码器(hidden 1024,8 层),词表 16384,16 kHz 输入,支持 en/fr/de/es/it/pt/nl/pl/el/ar/ja/zh/vi/ko。架构为自定义代码 cohere_asr(CohereAsrForConditionalGeneration),加载需 trust_remote_code=True。

验证环境(NPU)

  • NPU:Ascend 910(Atlas 800I A2,npu-smi 25.5.5,device npu:0)
  • CANN:8.5.1
  • torch 2.9.0 + torch_npu(Ascend 后端),transformers 4.57.6

环境依赖

见 requirements.txt:torch / torch_npu / transformers>=4.53 / soundfile / numpy / librosa / modelscope / safetensors / sentencepiece

推理操作流程

# 1. 准备权重:HF gated(auto),优先 ModelScope 镜像
python -c "from modelscope import snapshot_download; snapshot_download('CohereLabs/cohere-transcribe-03-2026', cache_dir='/tmp/bigw/cohere_transcribe')"
# 2. 在昇腾 NPU 上推理(脚本内部自动解析权重,亦可用 COHERE_TRANSCRIBE_MODEL_DIR 指定本地目录)
python inference.py --device npu

inference.py 使用 AutoModelForSpeechSeq2Seq.from_pretrained(..., trust_remote_code=True, output_loading_info=True) 加载(门禁 1:missing/unexpected/mismatched = 0/0/0),model.to("npu:0").eval() 后调用模型自带高层 model.transcribe(processor, language=..., audio_arrays=[...]) API 完成转写。

加载正确性三道门禁(全过):

  1. output_loading_info 0 missing / 0 unexpected / 0 mismatched;
  2. config 落地审计:仓内 config.json 全部键与 model.config.to_dict() 实际生效值逐一比对,0 个键未落地(sample_rate=16000 / max_audio_clip_s=35 / vocab_size=16384 / batch_size=128 均正确生效);
  3. 随机初始化对照:同架构随机初始化模型对同一真实语音输入转写结果为空串 '',正确加载模型输出完整语义正确转写(决定性胜出)。

测试用例与真实 NPU 输出

用例输入昇腾 NPU 真实输出时延
1仓库自带真实英文语音 demo/voxpopuli_test_en_demo.wav(VoxPopuli EN)If not, there will be a big crisis between you and the European Parliament.0.86 s
2合成多频正弦音频(440/1320/60 Hz,3 s,非语音)Thank you.(对非语音输入的模型固有幻觉输出,如实记录)0.13 s

NPU 性能

5 s 音频、max_new_tokens=256、batch=1,预热 5 次 + 正式 20 次(flock 独占 NPU 卡):

指标数值
p5086.1 ms
p9093.9 ms
p9595.2 ms
avg89.0 ms
min / max85.1 / 100.1 ms
峰值 HBM 占用8.57 GB(Ascend 910 64GB)

p95/p50 = 1.10,测量无并发污染,稳态口径取 p50/p90。

截图

agent workflow npu device call model result

#NPU