CohereX
Speech transcription with word-level timestamps and speaker diarization, built on the Cohere Transcribe ASR model.
Cohere Transcribe produces accurate text but no timestamps, no speaker labels, and no language detection. CohereX adds those around it, following the same pipeline design as WhisperX:
audio → VAD → Cohere Transcribe → wav2vec2 forced alignment → diarization → subtitles
- Voice activity detection (pyannote or silero) splits speech into chunks and drops silence.
- Cohere Transcribe transcribes each chunk.
- A wav2vec2 model force-aligns the transcript to the audio for per-word timestamps.
- pyannote assigns a speaker to every word and segment.
- Results are written as SRT, VTT, TXT, TSV, or JSON.
Requirements
- Python 3.10–3.13
- FFmpeg on your PATH (used for audio decoding)
- A Hugging Face account with access to the gated models:
CohereLabs/cohere-transcribe-03-2026pyannote/speaker-diarization-community-1(only if you use--diarize)
Accept the model terms on their Hugging Face pages, then log in:
hf auth login
Install
git clone https://github.com/bakrianoo/cohereX.git
cd cohereX
pip install -e .
Optional automatic language detection needs one extra package:
pip install -e ".[langid]"
GPU is strongly recommended. On CPU the model runs but is slow.
Quick start
Transcribe a file and write all output formats to out/:
coherex audio.mp3 --language en -o out/
Add speaker labels:
coherex audio.mp3 --language en --diarize -o out/
Let CohereX detect the language (needs the langid extra):
coherex audio.mp3 --language auto -o out/
Produce only an SRT with two lines per cue:
coherex audio.mp3 --language en -f srt --max_line_width 42 --max_line_count 2 -o out/
--language is required. Cohere Transcribe has no built-in language detection, and passing
the wrong language produces a fluent but wrong transcription rather than an error. Use auto
if you are unsure.
Supported languages
en, fr, de, es, it, pt, nl, pl, el, ar, ja, zh, vi, ko.
Automatic detection (--language auto) chooses from this set only.
Common options
| Option | Default | Description |
|---|---|---|
--language |
— | Language code or auto. Required. |
--diarize |
off | Assign speaker labels (needs the pyannote model + token). |
--no_align |
off | Skip forced alignment (segment-level timestamps only). |
--device |
cuda if available |
cpu or cuda. |
--compute_type |
default |
bfloat16, float16, float32, or default (bfloat16 on GPU, float32 on CPU). |
--batch_size |
8 |
VAD chunks per forward pass. Helps on GPU; use 1 on CPU. |
--vad_method |
pyannote |
pyannote or silero. |
--chunk_size |
30 |
Max seconds per VAD chunk. Keep below 35. |
--output_format / -f |
all |
srt, vtt, txt, tsv, json, aud, or all. |
--output_dir / -o |
. |
Where to write outputs. |
--punctuation |
true |
Set false for lower-cased output without punctuation. |
--max_line_width |
none | Max characters per subtitle line. |
--max_line_count |
none | Max lines per subtitle cue. |
--min_speakers / --max_speakers |
none | Constrain the speaker count for diarization. |
--hf_token |
none | Hugging Face token (or use hf auth login). |
Run coherex --help for the full list.
Python API
import coherex
model = coherex.load_model(device="cuda", compute_type="bfloat16", vad_method="pyannote")
# 1. Transcribe (segment-level timestamps from VAD)
result = model.transcribe("audio.mp3", language="en", batch_size=8)
# 2. Word-level timestamps
align_model, metadata = coherex.load_align_model("en", device="cuda")
result = coherex.align(result["segments"], align_model, metadata, "audio.mp3", "cuda")
# 3. Speaker labels
from coherex.diarize import DiarizationPipeline
diarizer = DiarizationPipeline(device="cuda")
speakers = diarizer("audio.mp3")
result = coherex.assign_word_speakers(speakers, result)
for seg in result["segments"]:
print(seg["start"], seg["end"], seg.get("speaker"), seg["text"])
To detect the language from audio:
model = coherex.load_model(device="cuda")
language = coherex.detect_language(model, "audio.mp3")
result = model.transcribe("audio.mp3", language=language)
Output
JSON contains segments and a flat word_segments list, each word carrying start, end,
score, and (with --diarize) speaker:
{
"segments": [
{
"start": 0.83,
"end": 6.33,
"text": "This week, I traveled to Chicago...",
"speaker": "SPEAKER_00",
"words": [
{"word": "This", "start": 0.83, "end": 1.01, "score": 0.98, "speaker": "SPEAKER_00"}
]
}
],
"word_segments": [
{"word": "This", "start": 0.83, "end": 1.01, "score": 0.98, "speaker": "SPEAKER_00"}
],
"language": "en"
}
Notes and limitations
- Language is required. There is no reliable failure mode for the wrong language — the model will transcribe confidently in whatever language you specify.
- VAD matters. Cohere Transcribe transcribes non-speech audio as hallucinated text, so the VAD step is on by default and should stay on for noisy input.
- 14 languages only, listed above.
- Alignment coverage. Word timestamps come from a per-language wav2vec2 model. If none is
available for a language, run with
--no_alignto get segment-level timestamps instead. autodetection cost. It probes the model once per candidate language, so it is slower than passing a code directly. Prefer an explicit--languagewhen you know it.
How it fits together
Only the ASR-specific pieces are unique to CohereX:
asr.py— loads Cohere Transcribe and transcribes VAD chunks.transcribe.py— the end-to-end pipeline.langid.py— optional language detection.__main__.py— the command-line interface.
Alignment (alignment.py), diarization (diarize.py), VAD (vads/), subtitle formatting
(SubtitlesProcessor.py), and the output writers (utils.py) follow WhisperX.
Credits
- Cohere Transcribe — the ASR model.
- WhisperX — the pipeline design and the alignment, diarization, VAD, and subtitle components.
- pyannote.audio — VAD and diarization.
License
Apache 2.0.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file coherex-0.1.0.tar.gz.
File metadata
- Download URL: coherex-0.1.0.tar.gz
- Upload date:
- Size: 19.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db7a8c6030e69f4c8c0d4ce489a80b7b6186ec58cf5a60d95987d46740dc89b4
|
|
| MD5 |
af2affc9ac36ecd8d26ddca8d0e17e62
|
|
| BLAKE2b-256 |
ccfc65b0843ffbdf8f27afb060d8f0179ff36125450fb165833712e588381ff1
|
Provenance
The following attestation bundles were made for coherex-0.1.0.tar.gz:
Publisher:
publish.yml on bakrianoo/cohereX
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coherex-0.1.0.tar.gz -
Subject digest:
db7a8c6030e69f4c8c0d4ce489a80b7b6186ec58cf5a60d95987d46740dc89b4 - Sigstore transparency entry: 2340872452
- Sigstore integration time:
-
Permalink:
bakrianoo/cohereX@1e75b446f2a773916cb77f5e162c8bd45cd60025 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/bakrianoo
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1e75b446f2a773916cb77f5e162c8bd45cd60025 -
Trigger Event:
release
-
Statement type:
File details
Details for the file coherex-0.1.0-py3-none-any.whl.
File metadata
- Download URL: coherex-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
907b32da2ca5c04d838952d5f43192d74804dffd00dd3f937fd680d7039490c3
|
|
| MD5 |
efa9841f898e6e96c9c07455a738a90b
|
|
| BLAKE2b-256 |
e37905442ac14dfde10fc16e189437fbb21a24ca2ec194efa43381175c487205
|
Provenance
The following attestation bundles were made for coherex-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on bakrianoo/cohereX
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coherex-0.1.0-py3-none-any.whl -
Subject digest:
907b32da2ca5c04d838952d5f43192d74804dffd00dd3f937fd680d7039490c3 - Sigstore transparency entry: 2340872467
- Sigstore integration time:
-
Permalink:
bakrianoo/cohereX@1e75b446f2a773916cb77f5e162c8bd45cd60025 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/bakrianoo
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1e75b446f2a773916cb77f5e162c8bd45cd60025 -
Trigger Event:
release
-
Statement type: