transcribe.cpp icon indicating copy to clipboard operation
transcribe.cpp copied to clipboard

Speaker diarization support in Granite 4.1 Plus?

Open victorhooi opened this issue 4 months ago • 4 comments

This is pretty awesome!

I saw there's support for the IBM Granite 4.1 models, which I've been keen to try for ages - in particular the Granite 4.1 Plus mode with timestamps and speaker diarization.

However, I saw that transcribe.cpp doesn't currently support this. It says here:

Speaker diarization | No (upstream supports via prompt; not exposed in v1 of transcribe.cpp)

When you say "upstream supports via prompt" - do you mean that the only way to enable it is to change the prompt, is that right? (Meta question - I'm curious why they do it like this - as opposed to something more deterministic, like a flag - but perhaps I'm showing my modern ML models newbieness here):

E.g. from the HF page:

SAA_PROMPT = "<|audio|> Speaker attribution: Transcribe and denote who is speaking by adding [Speaker 1]: and [Speaker 2]: tags before speaker turns."

or

TS_PROMPT = "<|audio|> Timestamps: Transcribe the speech. After each word, add a timestamp tag showing the end time in centiseconds, e.g. hello [T:45] world [T:82]"

Is that quite hard to add to transcribe.cpp though? As in, it's not a simple change, is it?

victorhooi avatar Jul 19 '26 07:07 victorhooi

https://github.com/handy-computer/transcribe.cpp/pull/85

atmosfar avatar Jul 19 '26 08:07 atmosfar

Just merged this in #85 please test and let me know. The API surface area is subject to change but it's a first cut at support

I'm not quite ready to release the public 0.2.0 version yet as there's a few more things I would like to get in

cjpais avatar Jul 19 '26 23:07 cjpais

Sorry for the delay - but I've had a chance to test this properly now. I used main (553f109), M5 Pro 48 GB, macOS 26.5.2, Metal, Q8_0 quants, using a real two-person meeting recording (16 kHz mono, converted per the README).

Disclaimer: AI was used to assist in the analysis - but mistakes are on me.

granite-speech-4.1-2b-plus - works as documented, with some weirdness

  • The documented behaviours check out: speaker turns come back as rows with no timing, and --diarize --timestamps word is properly rejected (unsupported timestamp granularity, exit 1) rather than silently downgraded.
  • But on real conversation the usable length is far below the session gate. The header says max audio: 377.6 s (context 4096), but a 360-s clip truncates ("hit the model's context/generation cap before end-of-stream", exit 1, 3 segments, the last one degenerating into a repetition loop) - and so do 180 s and 120 s. The first clean run for me was 90 s (6 turns, 102× realtime). The same thing happens at 180 s without --diarize, so it looks like the base generation budget rather than the speaker prompt. Practical upshot: I'd need to chunk meeting-style audio to ~90 s for this model. Maybe worth a line in the model doc, since the gate accepts about 4× more than dense speech can actually finish.
  • Quality-wise on the same recording, MOSS gives me much finer and more consistent turns - granite lumped several distinct exchanges into one long turn, and once emitted the same exchange twice with different speaker labels (S3, then S4). Granite's word-timestamps mode is the real drawcard for me (MOSS can't do that), but it's mutually exclusive with --diarize, per the docs. (I think that's an upstream limitation right?)

MOSS-Transcribe-Diarize - the post-#85 structured surface all works for me:

  • Segments carry speaker_id, the batch JSONL has the new speakers turn array (t0_ms/t1_ms/speaker_id), and raw_text still carries the inline [start][Sxx]text[end] string - so I no longer need to parse brackets out of text myself.
  • Labels look good at normal lengths: sensible turn-taking on a 3-min clip (46 timed, speaker-tagged segments), and on a 60-min run the two speakers stay evenly separated to the end (364/346, interleaved throughout, with a brief third label confined to the opening minute).
  • One heads-up, detailed in my comment on #108: at 91 min (newly reachable thanks to #115) the labels mostly collapse to a single speaker, while the transcription itself still reads fine. Looks like long-context model behaviour rather than an API problem.
  • Minor CLI note: --batch-jsonl is silently ignored for a single positional file - you need --batch list mode to get JSONL. An error (or honoring the flag) might be kinder.

Sortformer I couldn't test: the GGUF repo the model doc links (handy-computer/diar_streaming_sortformer_4spk-v2.1-gguf) doesn't resolve any more (401 anonymous, 404 logged in, and it's missing from the handdy-computer hf org's public model list), so those download links are currently dead. Happy to run the same clips through it if it comes back - not sure if this is temporary?

victorhooi avatar Aug 06 '26 03:08 victorhooi

Okay, I think the weirdness that you have is something that we're going to be fixing soon, regardless I can tell, most of this is now just in terms of model problems, so I'm going to close this issue. But thank you for all of the information. I believe the sort former model is should be able to be resolved, but maybe the link is still broken. Just let me know and I'll update it. I've just been quite busy

cjpais avatar Sep 20 '26 09:09 cjpais