d
gcw_GYGYTJUF/CohereAsr
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

Cohere ASR (CohereAsrForConditionalGeneration)

This repository contains the vLLM adapter for CohereLabs/cohere-transcribe-03-2026, enabling high-performance speech-to-text inference on both GPU and Ascend NPU via the vLLM engine.

Model Overview

Cohere ASR is an encoder-decoder speech recognition model based on a Conformer encoder and a Transformer decoder.

  • Encoder: 48-layer Conformer with relative positional encoding, depthwise separable convolutions, and subsampling factor 8.
  • Decoder: 8-layer Transformer with cross-attention to encoder outputs.
  • Vocabulary: 16,384 SentencePiece tokens.
  • Supported languages: en, fr, de, es, it, pt, nl, pl, el, ar, ja, zh, vi, ko.

File Structure

File (relative to vLLM root)Description
vllm/model_executor/models/cohere_asr.pyCore vLLM adapter (new file)
vllm/model_executor/models/registry.pyRegister architecture in model registry (4-line insertion)
tests/models/registry.pyRegister test model in test registry (4-line insertion)
tests/e2e/models/configs/CohereAsr.yamlE2E test configuration template
docs/source/tutorials/models/CohereAsr.mdUsage documentation

Usage

Prerequisites

The model requires trust_remote_code=True because it uses custom modeling files (modeling_cohere_asr.py, tokenization_cohere_asr.py, processing_cohere_asr.py).

vLLM Serve

vllm serve CohereLabs/cohere-transcribe-03-2026 \
  --trust-remote-code \
  --dtype bfloat16 \
  --tensor-parallel-size 1 \
  --max-model-len 1024 \
  --port 8000

Transcription API

curl -s http://127.0.0.1:8000/v1/audio/transcriptions \
  -H 'Content-Type: multipart/form-data' \
  -F file=@sample.wav \
  -F model="CohereAsrForConditionalGeneration" \
  -F language=en

Chat Completions (Encoder-Decoder)

curl -s http://127.0.0.1:8000/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "CohereAsrForConditionalGeneration",
    "messages": [
      {"role": "user", "content": [{"type": "audio", "audio_url": "file://sample.wav"}]}
    ],
    "temperature": 0,
    "max_tokens": 128
  }'

Implementation Notes

  • The encoder is kept as pure PyTorch (Conformer blocks) because it does not require tensor-parallel attention or KV-cache support.
  • The decoder is rewritten with vLLM-native layers:
    • QKVParallelLinear + Attention for self-attention (PagedAttention compatible).
    • ColumnParallelLinear + MergedColumnParallelLinear + CrossAttention for encoder-decoder cross-attention.
    • ColumnParallelLinear + RowParallelLinear for the feed-forward network.
  • Weight loading uses WeightsMapper to bridge the original checkpoint key names to the vLLM model structure, plus a custom load_weights to merge separate Q/K/V weights into stacked parallel linear layers.
  • The token classifier head (proj_out) is tied to decoder token embeddings. Its bias is loaded from log_softmax.mlp.layer0.bias in the original checkpoint.

Feature Matrix

FeatureStatus
ACLGraph✅
Tensor Parallel✅ (decoder only)
Beam Search✅
Transcription API✅
Language Selection✅
Timestamps❌
Diarization❌
EP / flashcomm1N/A
Multimodal (image)N/A

Known Limitations

  • The encoder is not tensor-parallel sharded; only the decoder benefits from TP.
  • Segment-level timestamps and speaker diarization are not yet supported.

License

Apache-2.0