--- language: - ar - en tags: - speech-recognition - automatic-speech-recognition - onnx - sherpa-onnx - cohere-asr - arabic base_model: CohereLabs/cohere-transcribe-arabic-07-2026 library_name: transformers pipeline_tag: automatic-speech-recognition --- # cohere-transcribe-arabic-07-2026 (ONNX, sherpa-onnx format) ONNX export of [`CohereLabs/cohere-transcribe-arabic-07-2026`](https://huggingface.co/CohereLabs/cohere-transcribe-arabic-07-2026) for offline inference with **sherpa-onnx** (`OfflineCohereTranscribeModelConfig`). ## Files The `onnx/` folder contains the exported graphs. Each variant has an encoder + decoder + shared `tokens.txt`: | Variant | Encoder | Decoder | Notes | |---|---|---|---| | **q4f16** | `encoder.q4f16.onnx` + `.onnx_data` | `decoder.q4f16.onnx` + `.onnx_data` | 4-bit + fp16 (~1.5 GB) | | **int8** | `encoder.int8.onnx` + `.onnx_data` | `decoder.int8.onnx` + `.onnx_data` | dynamic int8 (~3 GB) | Each `*.onnx` is the graph; the `*.onnx_data` sidecar holds the weights (external data format, since a 2B-param graph exceeds ONNX's 2 GB protobuf limit). ## sherpa-onnx I/O contract - **Encoder**: 1 input (mel features) -> 2 outputs (`cross_k`, `cross_v`), each `[8, batch, 8, seq, 128]`. Runs once per utterance. - **Decoder**: 6 inputs (`tokens, self_k, self_v, cross_k, cross_v, offset`) -> 3 outputs (`logits, self_k_out, self_v_out`). - The encoder precomputes the cross-attention K/V; the decoder reuses them statically and only maintains its own self-attention cache. - `model_type` metadata = `cohere-transcribe`. ## Usage (sherpa-onnx, Python) ```python import sherpa_onnx recognizer = sherpa_onnx.OfflineRecognizer.from_cohere_transcribe( encoder="./onnx/encoder.q4f16.onnx", decoder="./onnx/decoder.q4f16.onnx", tokens="./onnx/tokens.txt", debug=False, ) stream = recognizer.create_stream() stream.accept_waveform(16000, audio_samples) stream.set_option("language", "ar") recognizer.decode_stream(stream) print(stream.result.text) ``` ## How this was produced Exported with `tools/cohere-conversion/convert_direct.py` (direct `torch.onnx.export`, no optimum) from transformers 5.14.1 + torch 2.10.0. Run `convert_direct.py --variant q4f16` (or `int8`) then `upload_to_hub.py`. ## License Derived from the gated `CohereLabs/cohere-transcribe-arabic-07-2026`. See that model's license terms.