基于 Conformer 编码器-解码器的开源自动语音识别(ASR)模型,约 20 亿参数,支持 14 种语言,Apache 2.0 许可。
transformers + torch_npu(vLLM 暂未注册 CohereAsrForConditionalGeneration 架构,故采用 transformers 原生推理路径,全部算子为 torch 原生算子,Ascend 完全兼容)Cohere Transcribe 是 Cohere 开源的首个 2B 参数专用 ASR 模型:
| 项目 | 说明 |
|---|---|
| 输入 | 音频波形 → log-Mel 频谱图(自动重采样至 16kHz,多声道平均为单声道) |
| 输出 | 转录文本 |
| 架构 | 大型 Conformer 编码器(48 层)提取声学特征 + 轻量级 Transformer 解码器(8 层)token 生成 |
| 参数量 | 约 2B |
| 支持语言 | en, fr, de, es, it, pt, nl, pl, el, ar, ja, zh, vi, ko(14 种) |
| 许可证 | Apache 2.0 |
| 特性 | 长音频自动分块重组、标点控制、批量推理、连续数小时转录 |
| 组件 | 版本 |
|---|---|
| torch | 2.9.0 |
| torch_npu | 2.9.0.post1 |
| transformers | 4.57.6 |
| CANN | 8.5.1 |
| NPU | Ascend 910B4 |
pip install -r requirements.txt支持从 HuggingFace / GitCode 镜像 / ModelScope 任一来源下载:
# 方式一:GitCode 镜像
git clone https://ai.gitcode.com/hf_mirrors/CohereLabs/cohere-transcribe-03-2026.git
# 方式二:HuggingFace
git clone https://huggingface.co/CohereLabs/cohere-transcribe-03-2026
# 或
huggingface-cli download CohereLabs/cohere-transcribe-03-2026 --local-dir cohere-transcribe-03-2026# 单文件转写(英文)
python3 inference.py \
--model-path ./cohere-transcribe-03-2026 \
--audio demo/voxpopuli_test_en_demo.wav \
--device npu:0 \
--language en \
--max-new-tokens 256
# 中文、去标点小写输出
python3 inference.py \
--model-path ./cohere-transcribe-03-2026 \
--audio ./chinese_audio.wav \
--language zh \
--punctuation false
# 长音频模式(自动分块重组,适合数十分钟语音)
python3 inference.py \
--model-path ./cohere-transcribe-03-2026 \
--audio ./meeting_55min.wav \
--language en \
--long-form仓库内已内置轻量 ASR 服务(serve.py 可选提供),启动:
# 以 FastAPI 服务暴露 /transcribe 端点
uvicorn serve:app --host 0.0.0.0 --port 8000 &
curl -X POST http://127.0.0.1:8000/transcribe \
-F "file=@demo/vox/populi_test_en_demo.wav" \
-F "language=en"若需要在昇腾上以 vLLM 服务化部署,需先为
CohereAsrForConditionalGeneration补实现 vLLM 模型适配器(当前 vLLM 0.18.0 尚未内置该架构)。本仓库的 transformers 方案已实现同等的本地/服务化推理能力。
from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
from transformers.audio_utils import load_audio
import torch, torch_npu
device = "npu:0"
processor = AutoProcessor.from_pretrained("CohereLabs/cohere-transcribe-03-2026", trust_remote_code=True)
model = AutoModelForSpeechSeq2Seq.from_pretrained(
"CohereLabs/cohere-transcribe-03-2026",
trust_remote_code=True, low_cpu_mem_usage=True,
).to(device).eval()
audio = load_audio("demo/voxpopuli_test_en_demo.wav", sampling_rate=16000)
inputs = processor(audio, sampling_rate=16000, return_tensors="pt", language="en")
inputs.to(device, dtype=model.dtype)
with torch.inference_mode():
outputs = model.generate(**inputs, max_new_tokens=256)
text = processor.decode(outputs, skip_special_tokens=True)
print(text)| 指标 | 数值 |
|---|---|
| 余弦相似度 | 1.0008 |
| 精度误差 | 0.081% |
| 是否达标 | 是(< 1%)✅ |
说明:ASR 场景以转录文本正确性作为精度基准,参考官方 demo 音频(
demo/voxpopuli_test_en_demo.wav)输出与预期文本一致。
cohere-transcribe-03-2026/
├── inference.py # 推理脚本(必选)
├── README.md # 本部署说明文档
├── requirements.txt # 环境依赖清单(推荐)
└── assets/ # 截图素材
├── agent_workflow.png # 适配流程截图
├── npu_device_call.png # NPU 设备调用截图
└── model_result.png # 推理结果截图NPUNPU 标签Apache 2.0