Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions reports/porting/cohere/cohere-transcribe-arabic-07-2026/intake.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{
"schema_version": "transcribe-intake-v1",
"family": "cohere",
"hf_repo": "CohereLabs/cohere-transcribe-arabic-07-2026",
"hf_revision": "c3e911b42149bf7a1e53d5cef9878aee87515a23",
"sources": {
"config": {
"kind": "hf_file",
"path": "config.json",
"status": "found"
},
"preprocessor": {
"kind": "hf_file",
"path": "preprocessor_config.json",
"status": "found"
},
"tokenizer_config": {
"kind": "hf_file",
"path": "tokenizer_config.json",
"status": "found"
},
"tokenizer_json": {
"kind": "hf_file",
"path": "tokenizer.json",
"status": "found"
},
"generation_config": {
"kind": "hf_file",
"path": "generation_config.json",
"status": "found"
},
"safetensors_metadata": {
"kind": "hf_api",
"path": "HfApi.get_safetensors_metadata",
"status": "found",
"detail": "header-only floating dtype distribution; no tensor payloads downloaded"
}
},
"variants": [
{
"name": "cohere-transcribe-arabic-07-2026",
"memory_gb": null,
"files": []
}
],
"config": {
"architecture_candidates": [
"encoder-decoder"
],
"key_fields": {
"model_type": "cohere_asr",
"architectures": [
"CohereAsrForConditionalGeneration"
]
}
},
"dtype": {
"expected": "bfloat16",
"source": "weights_header",
"evidence": "safetensors header BF16=2104, I64=48; BF16 selected as dominant floating dtype",
"details": {
"config_declared": null,
"header_distribution": {
"I64": 48,
"BF16": 2104
}
}
},
"frontend": {
"sample_rate": null,
"n_mels": null,
"hop_length": null,
"fft_size": null,
"window": null,
"normalization": null,
"preemphasis": null,
"dither": null,
"center": null,
"padding_mode": null,
"mel_filterbank_norm": null
},
"tokenizer": {
"type": "sentencepiece",
"vocab_size": 16384,
"special_tokens": {
"bos": 4,
"eos": 3,
"pad": 2,
"decoder_start": 13764
},
"has_language_tokens": true,
"vocab_sha256": "c6e708e8cd5c72afb475a2268fcbae2cf86651d0439aeff395734e3c3cc85de5"
},
"capabilities": {
"languages": [
"en",
"ar"
],
"language_detection": null,
"translation": null,
"timestamps": [],
"streaming": null,
"speaker_diarization": null
},
"upstream_benchmarks": [],
"reference_framework": null,
"reference_rationale": null,
"architecture_pattern": null,
"known_risks": [],
"intake_gaps": [
{
"field": "capabilities",
"reason": "translation, timestamps, streaming, VAD, and diarization flags require reading the model card; fill before intake sign-off"
},
{
"field": "upstream_benchmarks",
"reason": "publisher-reported WER/CER scores are not auto-scraped; add entries from the model card during research"
}
]
}
27 changes: 23 additions & 4 deletions scripts/convert-cohere.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@

import argparse
import json
import os
import re
import sys
from pathlib import Path

Expand Down Expand Up @@ -203,7 +205,7 @@ def read_hparams(config: dict, gen_config: dict) -> dict:
"dec_max_seq": int(dec["max_sequence_length"]),
"dec_activation": str(dec["hidden_act"]).lower(),

"vocab_size": int(config["vocab_size"]),
"vocab_size": int(config.get("vocab_size") or config["head"]["num_classes"]),
"decoder_start_token_id": int(gen_config["decoder_start_token_id"]),
"bos_token_id": int(gen_config["bos_token_id"]),
"eos_token_id": int(gen_config["eos_token_id"]),
Expand Down Expand Up @@ -427,8 +429,25 @@ def convert(model_dir: Path, out_path: Path, repo_id: str | None = None) -> None

hp = read_hparams(config, gen_config)

# Variant suffix from the HF repo id, e.g. "arabic-07-2026" for
# CohereLabs/cohere-transcribe-arabic-07-2026, "03-2026" for the base.
# Local dirs without --repo-id keep the base-model default.
if repo_id:
variant = os.path.basename(repo_id)
if variant.startswith("cohere-transcribe-"):
variant = variant[len("cohere-transcribe-"):]
else:
variant = "03-2026"

# Version tag: extra tag from the repo id ("arabic" for
# cohere-transcribe-arabic-07-2026). The base model has no extra tag,
# so fall back to the variant suffix ("03-2026") to keep today's
# metadata.
m = re.search(r"cohere-transcribe-(.+?)-\d{2}-\d{4}", repo_id or "")
version = m.group(1) if m else variant

print(f"vocab_size = {hp['vocab_size']}")
print(f"Variant: cohere-transcribe-03-2026")
print(f"Variant: cohere-transcribe-{variant}")

print(f"Reading tokenizer from {tokenizer_path}")
tok = extract_tokenizer(tokenizer_path)
Expand Down Expand Up @@ -463,7 +482,7 @@ def convert(model_dir: Path, out_path: Path, repo_id: str | None = None) -> None
add_general_identity(
writer,
name="Cohere Transcribe",
version="03-2026",
version=version,
basename="cohere-transcribe",
size_label=size_label,
file_type=REFERENCE_FILE_TYPE,
Expand All @@ -477,7 +496,7 @@ def convert(model_dir: Path, out_path: Path, repo_id: str | None = None) -> None
)

# ----- stt.variant -----
writer.add_string("stt.variant", "cohere-transcribe-03-2026")
writer.add_string("stt.variant", f"cohere-transcribe-{variant}")

# ----- tokenizer.ggml.* -----
writer.add_string("tokenizer.ggml.model", "bpe")
Expand Down
87 changes: 87 additions & 0 deletions scripts/hf_cards/cohere-transcribe-arabic-07-2026.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Spec for the HF README of handy-computer/cohere-transcribe-arabic-07-2026-gguf.
# Consumed by scripts/hf_cards/generate.py.

hf_repo: CohereLabs/cohere-transcribe-arabic-07-2026
target_repo: handy-computer/cohere-transcribe-arabic-07-2026-gguf
transcribe_docs_url: https://github.com/handy-computer/transcribe.cpp/blob/main/docs/models/cohere-transcribe-arabic-07-2026.md

upstream_commit: c3e911b42149bf7a1e53d5cef9878aee87515a23
pin_date: 2026-07-31

# Validation pin for the most recent upload. Updated on each release —
# older HF revisions carry whatever value was current at their upload time.
validation:
reference: Transformers
commit: main
date: 2026-08

license: apache-2.0
license_display: Apache-2.0
pipeline_tag: automatic-speech-recognition
languages:
- ar
- en
tags:
- gguf
- transcribe.cpp
- asr
- speech-to-text
- cohere
- conformer
- encoder-decoder
- arabic
- ar

summary: |
Arabic-English speech transcription model, 2B params, Conformer encoder
with a Transformer encoder-decoder head (cross-attention, tied token
embedding), optimized for Arabic. Takes a 16 kHz mono WAV and produces a
transcript. Decoding is autoregressive.

default_quant_index: 3 # Q5_K_M

# Capability flags for the transcribe_cpp metadata block.
capabilities:
streaming: false
translate: false
lang_detect: false
timestamps: none # none | segment | word | token

# Speedup-over-realtime (×RT) per rig/backend, from docs/models; published
# raw as rtf_<machine> in the metadata block.
perf:
m4-max:
metal: TBD
cpu: TBD
ryzen-4750u:
vulkan: TBD
cpu: TBD

wer:
source: FLEURS Arabic (428 utts)
notes: |
WER measured on the FLEURS Arabic split (428 utterances) with greedy
decoding and no external LM. BF16: 11.02% on transcribe.cpp vs 11.00%
on native Transformers. Quant WERs pending the quant sweep.

quants:
- name: BF16
filename: cohere-transcribe-arabic-07-2026-BF16.gguf
size: ~4.0 GB
wer: 11.02%
- name: Q8_0
filename: cohere-transcribe-arabic-07-2026-Q8_0.gguf
size: ~2.1 GB
wer: TBD
- name: Q6_K
filename: cohere-transcribe-arabic-07-2026-Q6_K.gguf
size: ~1.7 GB
wer: TBD
- name: Q5_K_M
filename: cohere-transcribe-arabic-07-2026-Q5_K_M.gguf
size: ~1.5 GB
wer: TBD
- name: Q4_K_M
filename: cohere-transcribe-arabic-07-2026-Q4_K_M.gguf
size: ~1.3 GB
wer: TBD
58 changes: 42 additions & 16 deletions tests/cohere_real_smoke.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// This test loads a real Cohere ASR GGUF (the output of
// scripts/convert-cohere.py against an actual HuggingFace model
// directory) and verifies that the loader produces a fully populated
// CohereModel matching the cohere-transcribe-03-2026 architecture.
// CohereModel matching a cohere-transcribe-* architecture.
//
// Gating:
//
Expand All @@ -25,12 +25,18 @@
//
// 1. Load returns OK; the model pointer is set.
// 2. arch_string == "cohere_asr".
// 3. variant_string == "cohere-transcribe-03-2026".
// 3. variant_string starts with "cohere-transcribe-" (covers the
// base cohere-transcribe-03-2026 and sibling variants like
// cohere-transcribe-arabic-07-2026).
// 4. backend is non-empty (one of "Metal"/"CPU"/...).
// 5. native_sample_rate == 16000, supports_translate == false.
// 6. n_languages == 14 and the first few match the converter's
// ordering from config["supported_languages"]
// (en, fr, de, es, ...).
// 6. n_languages matches the converter's
// config["supported_languages"] count and the first few match
// the base variant's ordering (en, fr, de, es, ...). The
// cohere-transcribe-arabic-07-2026 variant supports only
// [en, ar], so the exact count is checked against the
// variant-reported value read at load time rather than a
// hardcoded 14.
// 7. CohereHParams reach-in: every field read by the loader matches
// the 2.0B cohere-transcribe-03-2026 values published in
// config.json (encoder: 48 layers, d_model=1280, 8 heads,
Expand Down Expand Up @@ -119,7 +125,8 @@ int main() {
" uv run scripts/convert-cohere.py "
"<model-dir> --repo-id CohereLabs/cohere-transcribe-03-2026\n"
"and re-run with "
"TRANSCRIBE_COHERE_GGUF=models/cohere-transcribe-03-2026/cohere-transcribe-03-2026-BF16.gguf\n");
"TRANSCRIBE_COHERE_GGUF=models/cohere-transcribe-03-2026/cohere-transcribe-03-2026-BF16.gguf\n"
"(or the equivalent path for another cohere-transcribe-* variant)\n");
return 77;
}
const std::string fixture = env;
Expand Down Expand Up @@ -148,7 +155,14 @@ int main() {
// exact label depends on the build platform; we just assert
// it is non-empty.
CHECK_STR_EQ(transcribe_model_arch_string(model), "cohere_asr");
CHECK_STR_EQ(transcribe_model_variant_string(model), "cohere-transcribe-03-2026");
{
const std::string variant = transcribe_model_variant_string(model);
// Variant-agnostic: any cohere-transcribe-* model (base
// cohere-transcribe-03-2026, cohere-transcribe-arabic-07-2026,
// ...) is structurally valid here.
CHECK(variant.rfind("cohere-transcribe-", 0) == 0);
std::fprintf(stderr, "cohere_real_smoke: variant=%s\n", variant.c_str());
}
{
const std::string backend = transcribe_model_backend(model);
if (backend.empty()) {
Expand All @@ -169,16 +183,28 @@ int main() {
CHECK_EQ_INT(caps->native_sample_rate, 16000);
CHECK(caps->supports_translate == false);

// Published cohere-transcribe-03-2026 supports 14 languages
// in this exact order (from config.json supported_languages):
// Language catalog is variant-dependent. The base
// cohere-transcribe-03-2026 supports 14 languages in this
// exact order (from config.json supported_languages):
// en, fr, de, es, it, pt, nl, pl, el, ar, ja, zh, vi, ko
CHECK_EQ_INT(caps->n_languages, 14);
if (caps->n_languages >= 5 && caps->languages != nullptr) {
CHECK_STR_EQ(caps->languages[0], "en");
CHECK_STR_EQ(caps->languages[1], "fr");
CHECK_STR_EQ(caps->languages[2], "de");
CHECK_STR_EQ(caps->languages[3], "es");
CHECK_STR_EQ(caps->languages[4], "it");
// The cohere-transcribe-arabic-07-2026 variant supports
// only [en, ar]. Check the exact catalog per variant.
const std::string variant = transcribe_model_variant_string(model);
if (variant == "cohere-transcribe-03-2026") {
CHECK_EQ_INT(caps->n_languages, 14);
if (caps->n_languages >= 5 && caps->languages != nullptr) {
CHECK_STR_EQ(caps->languages[0], "en");
CHECK_STR_EQ(caps->languages[1], "fr");
CHECK_STR_EQ(caps->languages[2], "de");
CHECK_STR_EQ(caps->languages[3], "es");
CHECK_STR_EQ(caps->languages[4], "it");
}
} else {
CHECK_EQ_INT(caps->n_languages, 2);
if (caps->n_languages >= 2 && caps->languages != nullptr) {
CHECK_STR_EQ(caps->languages[0], "en");
CHECK_STR_EQ(caps->languages[1], "ar");
}
}
}

Expand Down
Loading