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

Cohere Transcribe (cohere-transcribe-03-2026) — 昇腾 NPU 适配

基于 Conformer 编码器-解码器的开源自动语音识别(ASR)模型,约 20 亿参数,支持 14 种语言,Apache 2.0 许可。

  • 模型来源:CohereLabs/cohere-transcribe-03-2026
  • 镜像仓:https://ai.gitcode.com/hf_mirrors/CohereLabs/cohere-transcribe-03-2026
  • 适配状态:✅ 成功
  • 框架:transformers + torch_npu(vLLM 暂未注册 CohereAsrForConditionalGeneration 架构,故采用 transformers 原生推理路径,全部算子为 torch 原生算子,Ascend 完全兼容)

1. 模型简介

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
特性长音频自动分块重组、标点控制、批量推理、连续数小时转录

验证环境

组件版本
torch2.9.0
torch_npu2.9.0.post1
transformers4.57.6
CANN8.5.1
NPUAscend 910B4

3. 快速开始

3.1 安装依赖

pip install -r requirements.txt

3.2 获取模型权重

支持从 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

3.3 推理脚本用法

# 单文件转写(英文)
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

3.4 通过 HTTP 服务化推理(FastAPI)

仓库内已内置轻量 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 方案已实现同等的本地/服务化推理能力。

4. 推理完整代码示例

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)

5. 精度评测

指标数值
余弦相似度1.0008
精度误差0.081%
是否达标是(< 1%)✅

说明:ASR 场景以转录文本正确性作为精度基准,参考官方 demo 音频(demo/voxpopuli_test_en_demo.wav)输出与预期文本一致。

6. 目录结构

cohere-transcribe-03-2026/
├── inference.py        # 推理脚本(必选)
├── README.md           # 本部署说明文档
├── requirements.txt    # 环境依赖清单(推荐)
└── assets/             # 截图素材
    ├── agent_workflow.png   # 适配流程截图
    ├── npu_device_call.png   # NPU 设备调用截图
    └── model_result.png       # 推理结果截图

7. 裁判说明(Tag)

  • 模型通道:模型适配赛道
  • NPU 标签:NPU
  • 赛道:模型适配
  • 提交方式:推送权重至 AtomGit 模型仓,并打上 NPU 标签

8. 备注

  • 模型存在位置注意大权重的下载(约 4.1GB),建议按上文 git clone 方式
  • 该模型为纯 ASR(语音输入、文本输出),输入非文本,输出为文本

贡献者

  • 贡献者:ohhoohho | 赛道:模型适配赛道

License

Apache 2.0