Skip to content

armgit / Handy

Public Imported from GitHub
0

A free, open source, and extensible speech-to-text application that works completely offline.

transcribe.cpp 0.2.0 (#1924)

CJ Paisafbf44cd5f82
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 5bfb684f..5650486f 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -672,7 +672,7 @@ jobs:
listing="$(mktemp)"
dpkg-deb -c "$deb" > "$listing"
require_pattern "$listing" 'usr/bin/handy$' "handy binary"
- require_pattern "$listing" 'usr/lib/Handy/libtranscribe\.so\.[0-9]+$' "transcribe runtime library (SONAME)"
+ require_pattern "$listing" 'usr/lib/Handy/libtranscribe\.so(\.[0-9]+)+$' "transcribe runtime library (SONAME)"
require_pattern "$listing" 'usr/lib/Handy/libggml-cpu.*\.so' "ggml CPU backend module"
if [[ "${{ inputs.platform }}" == *"ubuntu-22.04"* && "${{ inputs.target }}" == "x86_64-unknown-linux-gnu" ]]; then
require_pattern "$listing" 'usr/lib/Handy/libonnxruntime\.so\.[0-9]+$' "ONNX Runtime library (SONAME)"
@@ -702,7 +702,7 @@ jobs:
listing="$(mktemp)"
rpm -qpl "$rpm_pkg" > "$listing"
require_pattern "$listing" '/usr/bin/handy$' "handy binary"
- require_pattern "$listing" '/usr/lib/Handy/libtranscribe\.so\.[0-9]+$' "transcribe runtime library (SONAME)"
+ require_pattern "$listing" '/usr/lib/Handy/libtranscribe\.so(\.[0-9]+)+$' "transcribe runtime library (SONAME)"
require_pattern "$listing" '/usr/lib/Handy/libggml-cpu.*\.so' "ggml CPU backend module"
# Same /usr/lib pollution guard as the deb audit (issue #1639).
if grep -Eq 'usr/lib/[^/]+\.so' "$listing"; then
diff --git a/scripts/gen_catalog.py b/scripts/gen_catalog.py
index 0d34dfcf..f61c6f7b 100644
--- a/scripts/gen_catalog.py
+++ b/scripts/gen_catalog.py
@@ -56,9 +56,8 @@ CURATION = {
"Fun-ASR-MLT-Nano-2512": {"rank": 10, "desc": "A tiny multilingual model"},
# description-only (unranked, not recommended) — carried over from the legacy .bin entry
"Breeze-ASR-25": {"desc": "Optimized for Taiwanese Mandarin. Code-switching support."},
- # hidden until the pinned transcribe-cpp ships their arch (has no `moss`/`sortformer`
- # under src/arch/) — the app would offer a download it cannot load
- "moss-transcribe-diarize": {"hidden": True},
+ # Sortformer emits speaker segments only; Handy's catalog is for models
+ # that produce transcription text.
"diar_streaming_sortformer_4spk-v2.1": {"hidden": True},
}
# temporary capability corrections pending a card re-push (remove once cards fixed)
@@ -69,7 +68,8 @@ OVERRIDES = {
# ───────────────────────── helpers ──────────────────────────────────────────
ARCH = ["whisper","moonshine-streaming","moonshine","parakeet","canary-qwen","canary","voxtral",
- "granite-speech","granite","qwen3","gigaam","sensevoice","cohere","fun-asr","nemotron","medasr"]
+ "granite-speech","granite","qwen3","gigaam","sensevoice","cohere","fun-asr","nemotron","medasr",
+ "moss","sortformer"]
ACR = {"asr":"ASR","ctc":"CTC","rnnt":"RNNT","tdt":"TDT","nar":"NAR","mlt":"MLT"}
SCALAR = {0:("<B",1),1:("<b",1),2:("<H",2),3:("<h",2),4:("<I",4),5:("<i",4),
6:("<f",4),7:("<?",1),10:("<Q",8),11:("<q",8),12:("<d",8)}
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index 7d29c10e..6d0770fa 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -7270,9 +7270,9 @@ dependencies = [
[[package]]
name = "transcribe-cpp"
-version = "0.1.3"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4c3c4d6136eeccf56cfe8a6669e2d63770d1ef051c7cafd2cb9226218c66cded"
+checksum = "9cff7b2aaacac97e5f7abb3898d91ad885c87c15dc433907b8045ff5c4ca8440"
dependencies = [
"log",
"thiserror 2.0.18",
@@ -7281,9 +7281,9 @@ dependencies = [
[[package]]
name = "transcribe-cpp-sys"
-version = "0.1.3"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "278fd6a6da4d9d8d5f2716bd6761a76ea55c129fda6ba57856b80249a8570ed4"
+checksum = "02f9a1f1be01b78806a3546a751aa094b8144ac3032474a1e8e783d22bd26281"
dependencies = [
"cmake",
"serde_json",
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 73e7f876..95e3a0ef 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -77,7 +77,7 @@ sha2 = "0.10"
# transcribe-rs is now ONNX-only (Parakeet, Moonshine, SenseVoice, GigaAM,
# Canary, Cohere). Per-platform backend features are added in the target tables.
transcribe-rs = { version = "0.3.8", features = ["onnx"] }
-transcribe-cpp = { version = "0.1.3", default-features = false }
+transcribe-cpp = { version = "0.2.0", default-features = false }
handy-keys = "0.3.4"
ferrous-opencc = "0.2.3"
clap = { version = "4", features = ["derive"] }
@@ -136,17 +136,17 @@ winreg = "0.55"
# signtool verify entirely. CI pins -DGGML_NATIVE=OFF (see build.yml) so the
# static build targets a portable ARM baseline, not the build runner's CPU.
[target.'cfg(all(windows, target_arch = "x86_64"))'.dependencies]
-transcribe-cpp = { version = "0.1.3", default-features = false, features = [
+transcribe-cpp = { version = "0.2.0", default-features = false, features = [
"dynamic-backends",
"vulkan",
] }
[target.'cfg(all(windows, target_arch = "aarch64"))'.dependencies]
-transcribe-cpp = { version = "0.1.3", default-features = false }
+transcribe-cpp = { version = "0.2.0", default-features = false }
[target.'cfg(target_os = "macos")'.dependencies]
tauri-nspanel = { git = "https://github.com/ahkohd/tauri-nspanel", branch = "v2.1" }
-transcribe-cpp = { version = "0.1.3", default-features = false, features = ["metal"] }
+transcribe-cpp = { version = "0.2.0", default-features = false, features = ["metal"] }
# Used by the receipt-sequenced ("reliable") paste path for lazy NSPasteboard
# promises. Versions track what Tauri already pulls in.
objc2 = "0.6"
@@ -158,7 +158,7 @@ objc2-service-management = "0.3.2"
gtk-layer-shell = { version = "0.8", features = ["v0_6"] }
gtk = "0.18"
libc = "0.2"
-transcribe-cpp = { version = "0.1.3", default-features = false, features = [
+transcribe-cpp = { version = "0.2.0", default-features = false, features = [
"dynamic-backends",
"vulkan",
] }
diff --git a/src-tauri/build.rs b/src-tauri/build.rs
index edcb0844..46d4e9d3 100644
--- a/src-tauri/build.rs
+++ b/src-tauri/build.rs
@@ -205,7 +205,7 @@ fn stage_transcribe_runtime_libs() {
let src = entry.path();
let name = src.file_name().and_then(|s| s.to_str()).unwrap_or("");
// Match by NAME, not extension: Linux versions its libs
- // (libtranscribe.so.0, .so.0.1.3) and the loader needs the SONAME, so
+ // (libtranscribe.so.0, .so.0.2.0) and the loader needs the SONAME, so
// an extension-only filter would miss the versioned names entirely.
let is_lib = name.ends_with(".dll")
|| name.ends_with(".dylib")
@@ -217,23 +217,24 @@ fn stage_transcribe_runtime_libs() {
}
}
- // A Linux install dir carries each lib as a symlink chain (libfoo.so ->
- // libfoo.so.0 -> libfoo.so.0.1.3), and tauri's deb/rpm bundlers flatten
- // symlinks into real files — staging every name would triplicate each lib
- // on disk and draw "not a symbolic link" warnings from ldconfig (issue
- // #1639). Only one name per lib is ever resolved at runtime: the SONAME
- // (`libfoo.so.N`) for the NEEDED core libs, and the bare unversioned name
- // for the dlopen'd ggml backend modules. Stage exactly that name;
- // `fs::copy` dereferences the symlink so the staged file is the real
- // library.
+ // A Linux install dir carries each lib as a symlink chain (for example,
+ // libfoo.so -> libfoo.so.0.2 -> libfoo.so.0.2.0), and tauri's deb/rpm
+ // bundlers flatten symlinks into real files. Staging every name would
+ // triplicate each lib and draw "not a symbolic link" warnings from ldconfig
+ // (issue #1639). Only one name per lib is needed at runtime: the shortest
+ // versioned name is the SONAME for linked core libs, while a dlopen'd ggml
+ // backend module generally has only its bare unversioned name. Stage that
+ // name; `fs::copy` dereferences the symlink so the staged file is real.
let mut best: std::collections::BTreeMap<&str, (&str, &PathBuf, usize)> = Default::default();
for (name, src) in &libs {
let (stem, rank) = match split_versioned_so(name) {
// Windows/macOS names (.dll/.dylib) are unversioned: keep as-is.
None => (name.as_str(), 0),
- // Prefer the SONAME form (exactly one numeric suffix), then the
- // bare `.so`; fully-versioned names only as a last resort.
- Some((stem, depth)) => (stem, if depth == 1 { 0 } else { depth + 1 }),
+ // Prefer the shortest versioned name (`.so.0`, `.so.0.2`, etc.),
+ // then the bare `.so`; a full version is only the fallback when the
+ // install tree did not provide its SONAME symlink.
+ Some((stem, 0)) => (stem, usize::MAX),
+ Some((stem, depth)) => (stem, depth - 1),
};
match best.get(stem) {
Some(&(_, _, existing)) if existing <= rank => {}
@@ -261,7 +262,7 @@ fn stage_transcribe_runtime_libs() {
/// Split a versioned ELF shared-library name into (stem, version depth):
/// `libfoo.so` -> ("libfoo", 0), `libfoo.so.0` -> ("libfoo", 1),
-/// `libfoo.so.0.1.3` -> ("libfoo", 3). Returns None for names that aren't a
+/// `libfoo.so.0.2.0` -> ("libfoo", 3). Returns None for names that aren't a
/// `.so` optionally followed by dot-separated numeric components.
fn split_versioned_so(name: &str) -> Option<(&str, usize)> {
let idx = name.find(".so")?;
diff --git a/src-tauri/src/catalog/catalog.json b/src-tauri/src/catalog/catalog.json
index 978b1837..64fc3482 100644
--- a/src-tauri/src/catalog/catalog.json
+++ b/src-tauri/src/catalog/catalog.json
@@ -1,6 +1,6 @@
{
"catalog_version": 2,
- "generated_at": "2026-07-23T10:15:59+00:00",
+ "generated_at": "2026-08-17T11:27:14+00:00",
"mirrors": [
"https://blob.handy.computer"
],
@@ -1340,6 +1340,39 @@
"recommended": false,
"recommended_rank": null
},
+ {
+ "id": "handy-computer/moss-transcribe-diarize-gguf",
+ "revision": "6fdfa33aed776bbb0ac11a1a9835634fe6d75dd7",
+ "slug": "moss-transcribe-diarize",
+ "name": "MOSS-Transcribe-Diarize 0.9B",
+ "architecture": "moss",
+ "family": "moss",
+ "parameters": "909M",
+ "description": "2-language speech-to-text with segment-level timestamps.",
+ "base_model": "OpenMOSS-Team/MOSS-Transcribe-Diarize",
+ "license": "apache-2.0",
+ "language_count": 2,
+ "languages": ["en", "zh"],
+ "capabilities": {
+ "streaming": false,
+ "translate": false,
+ "lang_detect": false,
+ "timestamps": "segment"
+ },
+ "speed_score": 31,
+ "accuracy_score": 88,
+ "files": [
+ {"filename": "MOSS-Transcribe-Diarize-Q4_K_M.gguf", "quant": "Q4_K_M", "size_bytes": 617345184, "sha256": "e371990f2c8f21ded18e18cfac8906b059b5ee7cbce154ed4d3c582c05100b8b"},
+ {"filename": "MOSS-Transcribe-Diarize-Q5_K_M.gguf", "quant": "Q5_K_M", "size_bytes": 700313760, "sha256": "52deaeff931272f3d49eb437f0f4916e42fce9f42e68db250047408241cf473c"},
+ {"filename": "MOSS-Transcribe-Diarize-Q6_K.gguf", "quant": "Q6_K", "size_bytes": 768151712, "sha256": "f36e6edd7cae9d9c280b8bc48b4bfd10d9ccfe17995cf8daa9517a94329e2bbd"},
+ {"filename": "MOSS-Transcribe-Diarize-Q8_0.gguf", "quant": "Q8_0", "size_bytes": 986899616, "sha256": "64ec654dc6ffcfdfe180422dffce1d33422b0c30959b7edfd131bad77ee35039"},
+ {"filename": "MOSS-Transcribe-Diarize-BF16.gguf", "quant": "BF16", "size_bytes": 1826882720, "sha256": "ccf9aa138e18beb295ec69e1979206c6e48f872fbc3a8c887d6a1fee9dbe7712"},
+ {"filename": "MOSS-Transcribe-Diarize-F16.gguf", "quant": "F16", "size_bytes": 1833665696, "sha256": "fee2e436f7a6e768756446cf31e34bbf4223c4448fa2073d2f424d46f83d7f4b"}
+ ],
+ "default_quant": "Q8_0",
+ "recommended": false,
+ "recommended_rank": null
+ },
{
"id": "handy-computer/nemotron-speech-streaming-en-0.6b-gguf",
"revision": "7d9b719206789e4068d87c6398262ab4dfd4e45d",
@@ -1408,7 +1441,7 @@
},
{
"id": "handy-computer/multitalker-parakeet-streaming-0.6b-v1-gguf",
- "revision": "0314bc0d2f4be9a0d79fa5eeb36ad1f3962cfcbb",
+ "revision": "31042fb4b5018be38240018492bdbde1923789dc",
"slug": "multitalker-parakeet-streaming-0.6b-v1",
"name": "Multitalker Parakeet Streaming EN",
"architecture": "parakeet",
@@ -1431,9 +1464,15 @@
{"filename": "multitalker-parakeet-streaming-0.6b-v1-Q4_K_M.gguf", "quant": "Q4_K_M", "size_bytes": 477812416, "sha256": "d9f05f95ab70054f37af71aae7bc64d37eabfc2d266935224a827cb0d838bb4f"},
{"filename": "multitalker-parakeet-streaming-0.6b-v1-Q5_K_M.gguf", "quant": "Q5_K_M", "size_bytes": 541890240, "sha256": "247a14c84dc6d0e7d4f5604b6f2b89b927af2e49eb0ed9fe350b447e849acf01"},
{"filename": "multitalker-parakeet-streaming-0.6b-v1-Q6_K.gguf", "quant": "Q6_K", "size_bytes": 603878080, "sha256": "c5ad23c5e59e3f73d5adebc963992818109d1ecb272f5c862b2355bc41950dac"},
+ {"filename": "bundle/multitalker-parakeet-streaming-0.6b-v1-Q4_K_M.gguf", "quant": "Q4_K_M", "size_bytes": 617132032, "sha256": "f3ea86dd8415b10ddb6cd7df12bed2798b72e8c1f09b83d227a3892ab7d2cd8a"},
+ {"filename": "bundle/multitalker-parakeet-streaming-0.6b-v1-Q5_K_M.gguf", "quant": "Q5_K_M", "size_bytes": 681209856, "sha256": "6914abb66959caede909df26ec63d930d5becdb66cc7dc3409d805f275b8727c"},
{"filename": "multitalker-parakeet-streaming-0.6b-v1-Q8_0.gguf", "quant": "Q8_0", "size_bytes": 734123712, "sha256": "4748deea0222eb9057ebdac1679eebb970bbe882ee10a96ae34596ffe83615c7"},
+ {"filename": "bundle/multitalker-parakeet-streaming-0.6b-v1-Q6_K.gguf", "quant": "Q6_K", "size_bytes": 743197696, "sha256": "771673b7266ff6f79d8b1f5cde01c114eb7e575179160c8a046f4c78b90bc743"},
+ {"filename": "bundle/multitalker-parakeet-streaming-0.6b-v1-Q8_0.gguf", "quant": "Q8_0", "size_bytes": 873443328, "sha256": "847df2b5b7576ee69801d74d60f5863df1503d09a790a57f0609323c15f26d64"},
{"filename": "multitalker-parakeet-streaming-0.6b-v1-F16.gguf", "quant": "F16", "size_bytes": 1246058304, "sha256": "d2b3cbd7d202f97dd7d91da228a70cc47d5f60ba57c8431a37462b2c2d035ba7"},
- {"filename": "multitalker-parakeet-streaming-0.6b-v1-F32.gguf", "quant": "F32", "size_bytes": 2489180480, "sha256": "a73ea5c34cffd714e97ef6de22db8e9437b6c0265f86f8bd31825fd2b0f49e6c"}
+ {"filename": "bundle/multitalker-parakeet-streaming-0.6b-v1-F16.gguf", "quant": "F16", "size_bytes": 1482674144, "sha256": "a8c2b0172b3a8963bef52501eaaf628df194374e494b01973b8098f085ba0827"},
+ {"filename": "multitalker-parakeet-streaming-0.6b-v1-F32.gguf", "quant": "F32", "size_bytes": 2489180480, "sha256": "a73ea5c34cffd714e97ef6de22db8e9437b6c0265f86f8bd31825fd2b0f49e6c"},
+ {"filename": "bundle/multitalker-parakeet-streaming-0.6b-v1-F32.gguf", "quant": "F32", "size_bytes": 2960100320, "sha256": "e94fa869969470a4434b38d551f444c22d545bb65a48e640d4f5c7439720251a"}
],
"default_quant": "Q8_0",
"recommended": false,
@@ -1538,6 +1577,39 @@
"recommended": false,
"recommended_rank": null
},
+ {
+ "id": "handy-computer/parakeet-primeline-gguf",
+ "revision": "90880dc372f8cc0025ae7a08d2c887278124a538",
+ "slug": "parakeet-primeline",
+ "name": "Parakeet TDT 0.6B primeLine (German-tuned)",
+ "architecture": "parakeet",
+ "family": "parakeet",
+ "parameters": "0.6B",
+ "description": "25-language speech-to-text with auto language detection, token-level timestamps.",
+ "base_model": "primeline/parakeet-primeline",
+ "license": "cc-by-4.0",
+ "language_count": 25,
+ "languages": ["de", "bg", "hr", "cs", "da", "nl", "en", "et", "fi", "fr", "el", "hu", "it", "lv", "lt", "mt", "pl", "pt", "ro", "ru", "sk", "sl", "es", "sv", "uk"],
+ "capabilities": {
+ "streaming": false,
+ "translate": false,
+ "lang_detect": true,
+ "timestamps": "token"
+ },
+ "speed_score": 79,
+ "accuracy_score": 67,
+ "files": [
+ {"filename": "parakeet-primeline-Q4_K_M.gguf", "quant": "Q4_K_M", "size_bytes": 485425568, "sha256": "8b01f1893fa1db166d8b08375f8300c140fc7f110af7e9b68480a27b145dad7d"},
+ {"filename": "parakeet-primeline-Q5_K_M.gguf", "quant": "Q5_K_M", "size_bytes": 548946336, "sha256": "a1dd12b7f374c33d5e33a61c8a852035d27064cefe53f8cdfc3410cddf3b31c8"},
+ {"filename": "parakeet-primeline-Q6_K.gguf", "quant": "Q6_K", "size_bytes": 610342304, "sha256": "62301f4a2c393421a4162864718e85edac7eb85ce8ed82c343a4b994b6d85594"},
+ {"filename": "parakeet-primeline-Q8_0.gguf", "quant": "Q8_0", "size_bytes": 739508640, "sha256": "dbd1ec2985aea64d16550a0068ea9153c0bc01955bf2a5c18b74ca213546d3cd"},
+ {"filename": "parakeet-primeline-F16.gguf", "quant": "F16", "size_bytes": 1255869920, "sha256": "a6f626fa7263cf55a27eda312d1f91dfe6edfeb8de85a5536fbb3cb93af064e1"},
+ {"filename": "parakeet-primeline-F32.gguf", "quant": "F32", "size_bytes": 2508435680, "sha256": "6075ededee05ad520b3402bf089d00cd87819025b8509f746587c822d99a9a2d"}
+ ],
+ "default_quant": "Q8_0",
+ "recommended": false,
+ "recommended_rank": null
+ },
{
"id": "handy-computer/parakeet-tdt-1.1b-gguf",
"revision": "8c21810615694c53a4f4745996190fcca880f8e5",
diff --git a/src-tauri/src/catalog/mod.rs b/src-tauri/src/catalog/mod.rs
index 64d0a0ce..fb11df0f 100644
--- a/src-tauri/src/catalog/mod.rs
+++ b/src-tauri/src/catalog/mod.rs
@@ -231,6 +231,16 @@ mod tests {
assert_eq!(before, ids.len(), "catalog descriptor ids must be unique");
}
+ #[test]
+ fn pure_diarization_models_are_not_downloadable() {
+ assert!(
+ CATALOG
+ .iter()
+ .all(|model| model.caps.architecture.as_deref() != Some("sortformer")),
+ "Sortformer produces speaker segments, not transcription text"
+ );
+ }
+
#[test]
fn scores_are_normalised_0_to_1() {
for d in CATALOG.iter() {
diff --git a/src-tauri/src/managers/model_capabilities.rs b/src-tauri/src/managers/model_capabilities.rs
index 8ac6aa48..4f25f1a9 100644
--- a/src-tauri/src/managers/model_capabilities.rs
+++ b/src-tauri/src/managers/model_capabilities.rs
@@ -46,6 +46,8 @@ pub const KNOWN_ARCHES: &[&str] = &[
"granite_speech_nar",
"funasr_nano",
"medasr",
+ "moss",
+ "sortformer",
];
// GGUF metadata keys transcribe-cpp writes for ASR models.
diff --git a/src-tauri/src/managers/transcription.rs b/src-tauri/src/managers/transcription.rs
index 30e3af4c..c8cd4491 100644
--- a/src-tauri/src/managers/transcription.rs
+++ b/src-tauri/src/managers/transcription.rs
@@ -552,23 +552,33 @@ impl TranscriptionManager {
// --device-index flag) hard-select that registered device;
// otherwise re-read the persisted accelerator preference (so an
// accelerator change marked for reload takes effect here).
- let (backend, gpu_device) = match device_index {
+ let (backend, device) = match device_index {
Some(index) => resolve_device_index(index).inspect_err(|e| {
emit_loading_failed(&e.to_string());
})?,
None => {
let settings = get_settings(&self.app_handle);
let accelerator = settings.transcribe_accelerator;
- (
- select_transcribe_backend(accelerator),
- resolve_gpu_device(accelerator, settings.transcribe_gpu_device),
- )
+ let device = resolve_gpu_device(
+ accelerator,
+ settings.transcribe_gpu_device.as_deref(),
+ );
+ // Backend::Auto accepts an exact CPU/GPU device. When
+ // no exact device is saved, retain Handy's strict
+ // accelerator/backend policy and native fallback.
+ let backend = if device.is_some() {
+ Backend::Auto
+ } else {
+ select_transcribe_backend(accelerator)
+ };
+ (backend, device)
}
};
- let model_options = ModelOptions {
- backend,
- gpu_device,
- };
+ let requested_device = device
+ .as_ref()
+ .map(transcribe_device_label)
+ .unwrap_or_else(|| "automatic".to_string());
+ let model_options = ModelOptions { backend, device };
let model = Model::load_with(&model_path, &model_options).map_err(|e| {
let error_msg = format!("Failed to load whisper model {}: {}", model_id, e);
emit_loading_failed(&error_msg);
@@ -597,13 +607,19 @@ impl TranscriptionManager {
caps.supports_language_detect,
caps.languages.clone(),
);
+ let bound_device = model
+ .device()
+ .map(|device| transcribe_device_label(&device))
+ .unwrap_or_else(|_| "unknown".to_string());
info!(
- "Loaded whisper model '{}' (requested {:?}, gpu_device {}, bound backend '{}', \
- supports_streaming={}, supports_translate={}, supports_language_detect={})",
+ "Loaded whisper model '{}' (requested {:?}, requested device '{}', \
+ bound backend '{}', bound device '{}', supports_streaming={}, \
+ supports_translate={}, supports_language_detect={})",
model_id,
backend,
- gpu_device,
+ requested_device,
bound_backend,
+ bound_device,
caps.supports_streaming,
caps.supports_translate,
caps.supports_language_detect
@@ -1906,35 +1922,31 @@ pub fn describe_compute_devices() -> Vec<String> {
.collect()
}
-/// Resolve a `--list-devices` registry index to the (backend, gpu_device) pair
-/// for a transcribe-cpp model load (the `--device-index` flag). The
-/// backend is set explicitly from the device's kind, so there's no "index 0 =
-/// auto" ambiguity. Errors if the index isn't a registered, loadable device.
-fn resolve_device_index(index: usize) -> Result<(Backend, i32)> {
+/// Resolve a `--list-devices` registry index to an exact opaque device handle
+/// for a transcribe-cpp model load (the `--device-index` flag). In 0.2 index 0
+/// is an exact selection too; only an omitted index requests automatic device
+/// selection. Errors if the index isn't a registered, loadable primary device.
+fn resolve_device_index(index: usize) -> Result<(Backend, Option<transcribe_cpp::Device>)> {
let device = transcribe_compute_devices()
.into_iter()
.find(|d| d.index == Some(index))
.ok_or_else(|| {
anyhow::anyhow!("No compute device with index {index} (see --list-devices)")
})?;
- let backend = match device.kind.as_str() {
- "cpu" => Backend::Cpu,
- "metal" => Backend::Metal,
- "cuda" => Backend::Cuda,
- "vulkan" => Backend::Vulkan,
- other => {
- return Err(anyhow::anyhow!(
- "Device index {index} has kind '{other}', which cannot host a model"
- ))
- }
- };
- // gpu_device is a registry index used only by GPU backends; CPU ignores it.
- let gpu_device = if matches!(backend, Backend::Cpu) {
- 0
- } else {
- index as i32
- };
- Ok((backend, gpu_device))
+ if matches!(
+ device.device_type,
+ transcribe_cpp::DeviceType::Accel | transcribe_cpp::DeviceType::Unknown
+ ) {
+ return Err(anyhow::anyhow!(
+ "Device index {index} ({}) cannot host a model",
+ device.kind
+ ));
+ }
+
+ // 0.2's opaque handle makes every index, including zero, an exact
+ // selection. Backend::Auto accepts any primary device and cannot conflict
+ // with the selected device's vendor backend.
+ Ok((Backend::Auto, Some(device)))
}
/// Map Handy's whisper accelerator setting to a transcribe-cpp [`Backend`].
@@ -1952,7 +1964,7 @@ fn select_transcribe_backend(setting: TranscribeAcceleratorSetting) -> Backend {
#[cfg(target_os = "macos")]
let candidates = [Backend::Metal];
#[cfg(not(target_os = "macos"))]
- let candidates = [Backend::Cuda, Backend::Vulkan];
+ let candidates = [Backend::Cuda, Backend::Rocm, Backend::Vulkan];
match candidates
.into_iter()
@@ -1980,33 +1992,44 @@ fn select_transcribe_backend(setting: TranscribeAcceleratorSetting) -> Backend {
}
}
-/// Resolve the user's stored GPU device choice into a [`ModelOptions::gpu_device`]
-/// registry index for the next model load.
-///
-/// Settings store a registry index into [`transcribe_cpp::devices`] (`-1` is the
-/// UI's auto/CPU sentinel); transcribe-cpp treats `0` as "auto / first match" and
-/// rejects an out-of-range or non-GPU index. So an explicit selection is honored
-/// only when the user chose the GPU accelerator and the stored index still
-/// resolves to a registered GPU device — otherwise fall back to `0` so a stale
-/// selection can never fail the load.
-fn resolve_gpu_device(setting: TranscribeAcceleratorSetting, gpu_device: i32) -> i32 {
- if transcribe_gpu_disabled_for_host()
- || setting != TranscribeAcceleratorSetting::Gpu
- || gpu_device <= 0
- {
- return 0;
- }
- let still_valid = transcribe_compute_devices()
- .iter()
- .any(|d| d.index == Some(gpu_device as usize) && is_transcribe_gpu_device(d));
- if still_valid {
- gpu_device
- } else {
+/// Resolve the user's persisted GPU identity to a fresh opaque 0.2 device
+/// handle. Registry indices and handles are process-local, so settings store a
+/// key based on the backend's stable `device_id` (falling back to name for
+/// backends such as Metal that do not report one).
+fn resolve_gpu_device(
+ setting: TranscribeAcceleratorSetting,
+ gpu_device: Option<&str>,
+) -> Option<transcribe_cpp::Device> {
+ if transcribe_gpu_disabled_for_host() || setting != TranscribeAcceleratorSetting::Gpu {
+ return None;
+ }
+ let gpu_device = gpu_device?;
+ let resolved = transcribe_compute_devices().into_iter().find(|device| {
+ is_transcribe_gpu_device(device) && transcribe_device_key(device) == gpu_device
+ });
+ if resolved.is_none() {
warn!(
- "Stored transcribe GPU device index {} is no longer available; using auto",
+ "Stored transcribe GPU device '{}' is no longer available; using automatic GPU selection",
gpu_device
);
- 0
+ }
+ resolved
+}
+
+fn transcribe_device_key(device: &transcribe_cpp::Device) -> String {
+ let (identity_kind, identity) = match device.device_id.as_deref() {
+ Some(device_id) => ("id", device_id),
+ None => ("name", device.name.as_str()),
+ };
+ serde_json::to_string(&(device.kind.as_str(), identity_kind, identity))
+ .expect("transcribe device identity is always JSON serializable")
+}
+
+fn transcribe_device_label(device: &transcribe_cpp::Device) -> String {
+ if device.description.is_empty() {
+ device.name.clone()
+ } else {
+ device.description.clone()
}
}
@@ -2039,7 +2062,7 @@ pub fn apply_accelerator_settings(app: &tauri::AppHandle) {
#[derive(Serialize, Clone, Debug, Type)]
pub struct GpuDeviceOption {
- pub id: i32,
+ pub id: String,
pub name: String,
pub total_vram_mb: usize,
}
@@ -2062,7 +2085,10 @@ fn effective_transcribe_accelerator(
}
fn is_transcribe_gpu_device(device: &transcribe_cpp::Device) -> bool {
- device.kind != "cpu" && device.kind != "accel"
+ matches!(
+ device.device_type,
+ transcribe_cpp::DeviceType::Gpu | transcribe_cpp::DeviceType::Igpu
+ )
}
fn transcribe_device_allowed(kind: &str, gpu_disabled: bool) -> bool {
@@ -2091,22 +2117,17 @@ fn available_transcribe_accelerators(gpu_disabled: bool) -> Vec<String> {
}
fn cached_gpu_devices() -> &'static [GpuDeviceOption] {
- // GPU compute devices transcribe-cpp registered at startup. `id` is the
- // device's registry index (`Device::index`, not a re-counted position) so it
- // feeds straight back as `ModelOptions::gpu_device` (see `resolve_gpu_device`).
- // `total_vram_mb` is the backend-reported capacity, 0 when unreported (some
- // Metal/Vulkan drivers).
+ // GPU compute devices transcribe-cpp registered at startup. `id` is a
+ // persistent identity key, never the process-local registry index. It uses
+ // the backend's device_id where available and its name otherwise (Metal).
+ // `total_vram_mb` is 0 when the backend does not report capacity.
GPU_DEVICES.get_or_init(|| {
transcribe_compute_devices()
.into_iter()
.filter(is_transcribe_gpu_device)
.map(|d| GpuDeviceOption {
- id: d.index.unwrap_or(0) as i32,
- name: if d.description.is_empty() {
- d.name
- } else {
- d.description
- },
+ id: transcribe_device_key(&d),
+ name: transcribe_device_label(&d),
total_vram_mb: (d.memory_total / (1024 * 1024)) as usize,
})
.collect()
diff --git a/src-tauri/src/settings.rs b/src-tauri/src/settings.rs
index f11d30e9..8e8fdcb5 100644
--- a/src-tauri/src/settings.rs
+++ b/src-tauri/src/settings.rs
@@ -464,8 +464,14 @@ pub struct AppSettings {
pub transcribe_accelerator: TranscribeAcceleratorSetting,
#[serde(default)]
pub ort_accelerator: OrtAcceleratorSetting,
- #[serde(default = "default_transcribe_gpu_device")]
- pub transcribe_gpu_device: i32,
+ /// Stable transcribe.cpp device selector. This is derived from the backend's
+ /// `device_id` when available (or its name for backends such as Metal),
+ /// never from the process-local device registry index.
+ #[serde(
+ default = "default_transcribe_gpu_device",
+ deserialize_with = "deserialize_transcribe_gpu_device"
+ )]
+ pub transcribe_gpu_device: Option<String>,
#[serde(default)]
pub extra_recording_buffer_ms: u64,
#[serde(default = "default_vad_enabled")]
@@ -481,7 +487,7 @@ fn default_model() -> String {
"".to_string()
}
-const CURRENT_SETTINGS_SCHEMA_VERSION: u32 = 1;
+const CURRENT_SETTINGS_SCHEMA_VERSION: u32 = 2;
fn default_settings_schema_version() -> u32 {
CURRENT_SETTINGS_SCHEMA_VERSION
@@ -733,8 +739,25 @@ fn default_post_process_prompts() -> Vec<LLMPrompt> {
}]
}
-fn default_transcribe_gpu_device() -> i32 {
- -1 // auto
+fn default_transcribe_gpu_device() -> Option<String> {
+ None // automatic device selection
+}
+
+/// Accept the 0.1-era integer registry index long enough for the schema
+/// migration to clear it. Device indices are process-local in transcribe.cpp
+/// 0.2 and must never be carried across launches.
+fn deserialize_transcribe_gpu_device<'de, D>(deserializer: D) -> Result<Option<String>, D::Error>
+where
+ D: Deserializer<'de>,
+{
+ match Option::<serde_json::Value>::deserialize(deserializer)? {
+ None => Ok(None),
+ Some(serde_json::Value::String(value)) => Ok(Some(value)),
+ Some(serde_json::Value::Number(_)) => Ok(None),
+ Some(_) => Err(de::Error::custom(
+ "transcribe GPU device must be a string, integer, or null",
+ )),
+ }
}
fn default_typing_tool() -> TypingTool {
@@ -1068,14 +1091,22 @@ fn apply_settings_migrations(
.and_then(|v| v.as_u64())
.unwrap_or(0);
if stored_schema_version < 1 {
- // `transcribe_gpu_device` used to be a UI ordinal; it is now a
- // transcribe.cpp registry index. A positive legacy value can point at a
- // different GPU after CPU/accelerator/backend devices are included in
- // the registry, so reset ambiguous explicit selections to Auto once.
- if settings.transcribe_gpu_device > 0 {
+ // Before schema 1 this was a UI ordinal. Preserve the original safety
+ // migration: a positive selection was ambiguous even in 0.1.
+ let had_positive_legacy_selection = settings_value
+ .get("transcribe_gpu_device")
+ .and_then(|value| value.as_i64())
+ .is_some_and(|value| value > 0);
+ if had_positive_legacy_selection {
settings.transcribe_accelerator = TranscribeAcceleratorSetting::Auto;
- settings.transcribe_gpu_device = default_transcribe_gpu_device();
}
+ }
+ if stored_schema_version < 2 {
+ // transcribe.cpp 0.2 replaced integer registry indices with opaque
+ // process-local handles. Clear every old index once; keeping the GPU
+ // accelerator preference for schema-1 users preserves their intent and
+ // lets the backend choose a valid GPU automatically.
+ settings.transcribe_gpu_device = default_transcribe_gpu_device();
settings.settings_schema_version = CURRENT_SETTINGS_SCHEMA_VERSION;
updated = true;
}
@@ -1156,7 +1187,8 @@ mod tests {
/// Frozen snapshot of a real v0.9.0-era settings store, as written to
/// disk. This pins backwards compatibility: it must always parse strictly
- /// (no salvage) and require no migration rewrite.
+ /// (no salvage). Schema migrations may then rewrite fields whose native
+ /// meaning changed.
///
/// If a schema change breaks this test, do NOT just update the fixture —
/// it stands in for the stores on users' machines. Add a
@@ -1164,7 +1196,7 @@ mod tests {
/// `apply_settings_migrations` so old values keep loading, and only extend
/// the fixture alongside that.
#[test]
- fn frozen_v0_9_store_parses_strictly_without_migration() {
+ fn frozen_v0_9_store_parses_strictly_then_migrates_device_index() {
// Note "log_level": 2 — the legacy numeric format, kept deliberately.
let stored: serde_json::Value = serde_json::from_str(
r##"{
@@ -1269,8 +1301,18 @@ mod tests {
assert_eq!(settings.sound_theme, SoundTheme::Pop);
assert!(settings.filler_word_removal_enabled);
- // A current-format store must not be rewritten on every read.
- assert!(!apply_settings_migrations(&mut settings, &stored));
+ // The 0.1 integer device index is cleared once for transcribe.cpp 0.2,
+ // while preserving this user's explicit GPU accelerator preference.
+ assert!(apply_settings_migrations(&mut settings, &stored));
+ assert_eq!(
+ settings.settings_schema_version,
+ CURRENT_SETTINGS_SCHEMA_VERSION
+ );
+ assert_eq!(
+ settings.transcribe_accelerator,
+ TranscribeAcceleratorSetting::Gpu
+ );
+ assert_eq!(settings.transcribe_gpu_device, None);
}
#[test]
@@ -1431,7 +1473,6 @@ mod tests {
fn gpu_device_migration_resets_legacy_positive_selection_to_auto() {
let mut settings = get_default_settings();
settings.transcribe_accelerator = TranscribeAcceleratorSetting::Gpu;
- settings.transcribe_gpu_device = 2;
let raw = serde_json::json!({
"transcribe_accelerator": "gpu",
@@ -1443,10 +1484,7 @@ mod tests {
settings.transcribe_accelerator,
TranscribeAcceleratorSetting::Auto
);
- assert_eq!(
- settings.transcribe_gpu_device,
- default_transcribe_gpu_device()
- );
+ assert_eq!(settings.transcribe_gpu_device, None);
assert_eq!(
settings.settings_schema_version,
CURRENT_SETTINGS_SCHEMA_VERSION
@@ -1454,10 +1492,27 @@ mod tests {
}
#[test]
- fn gpu_device_migration_keeps_current_schema_positive_selection() {
+ fn gpu_device_migration_clears_v1_index_but_keeps_gpu_preference() {
+ let raw = serde_json::json!({
+ "settings_schema_version": 1,
+ "transcribe_accelerator": "gpu",
+ "transcribe_gpu_device": 2
+ });
+ let mut settings: AppSettings = serde_json::from_value(raw.clone()).unwrap();
+
+ assert!(apply_settings_migrations(&mut settings, &raw));
+ assert_eq!(
+ settings.transcribe_accelerator,
+ TranscribeAcceleratorSetting::Gpu
+ );
+ assert_eq!(settings.transcribe_gpu_device, None);
+ }
+
+ #[test]
+ fn gpu_device_migration_keeps_current_stable_selection() {
let mut settings = get_default_settings();
settings.transcribe_accelerator = TranscribeAcceleratorSetting::Gpu;
- settings.transcribe_gpu_device = 2;
+ settings.transcribe_gpu_device = Some("[\"vulkan\",\"id\",\"0000:01:00.0\"]".into());
let raw = serde_json::json!({
"settings_schema_version": CURRENT_SETTINGS_SCHEMA_VERSION,
@@ -1465,15 +1520,14 @@ mod tests {
"whats_new_last_seen_version": default_whats_new_last_seen_version(),
"overlay_style": "live",
"transcribe_accelerator": "gpu",
- "transcribe_gpu_device": 2
+ "transcribe_gpu_device": settings.transcribe_gpu_device
});
assert!(!apply_settings_migrations(&mut settings, &raw));
assert_eq!(
- settings.transcribe_accelerator,
- TranscribeAcceleratorSetting::Gpu
+ settings.transcribe_gpu_device.as_deref(),
+ Some("[\"vulkan\",\"id\",\"0000:01:00.0\"]")
);
- assert_eq!(settings.transcribe_gpu_device, 2);
}
#[test]
diff --git a/src-tauri/src/shortcut/mod.rs b/src-tauri/src/shortcut/mod.rs
index 471b7006..57ae254b 100644
--- a/src-tauri/src/shortcut/mod.rs
+++ b/src-tauri/src/shortcut/mod.rs
@@ -1340,7 +1340,7 @@ pub fn change_ort_accelerator_setting(
#[tauri::command]
#[specta::specta]
-pub fn change_transcribe_gpu_device(app: AppHandle, device: i32) -> Result<(), String> {
+pub fn change_transcribe_gpu_device(app: AppHandle, device: Option<String>) -> Result<(), String> {
let mut s = settings::get_settings(&app);
s.transcribe_gpu_device = device;
save_accelerator_and_reload_next_use(&app, s);
diff --git a/src/bindings.ts b/src/bindings.ts
index 0c9cdc87..6e6f64ba 100644
--- a/src/bindings.ts
+++ b/src/bindings.ts
@@ -443,7 +443,7 @@ async changeOrtAcceleratorSetting(accelerator: OrtAcceleratorSetting) : Promise<
else return { status: "error", error: e as any };
}
},
-async changeTranscribeGpuDevice(device: number) : Promise<Result<null, string>> {
+async changeTranscribeGpuDevice(device: string | null) : Promise<Result<null, string>> {
try {
return { status: "ok", data: await TAURI_INVOKE("change_transcribe_gpu_device", { device }) };
} catch (e) {
@@ -959,7 +959,13 @@ selected_channel?: number | null; clamshell_microphone?: string | null; selected
* after the target app actually reads the transcript, instead of after a
* fixed delay. See `paste_tx`. macOS and Windows only.
*/
-reliable_paste?: boolean; typing_tool?: TypingTool; external_script_path?: string | null; filler_word_removal_enabled?: boolean; custom_filler_words?: string[] | null; transcribe_accelerator?: TranscribeAcceleratorSetting; ort_accelerator?: OrtAcceleratorSetting; transcribe_gpu_device?: number; extra_recording_buffer_ms?: number; vad_enabled?: boolean;
+reliable_paste?: boolean; typing_tool?: TypingTool; external_script_path?: string | null; filler_word_removal_enabled?: boolean; custom_filler_words?: string[] | null; transcribe_accelerator?: TranscribeAcceleratorSetting; ort_accelerator?: OrtAcceleratorSetting;
+/**
+ * Stable transcribe.cpp device selector. This is derived from the backend's
+ * `device_id` when available (or its name for backends such as Metal),
+ * never from the process-local device registry index.
+ */
+transcribe_gpu_device?: string | null; extra_recording_buffer_ms?: number; vad_enabled?: boolean;
/**
* Which recording overlay to show: None / Minimal / Live. Streaming mode is
* not gated on this — that follows model capability. Migrated from the old
@@ -979,7 +985,7 @@ export type EngineType =
* the file, so this one variant covers the whole transcribe-cpp family.
*/
"TranscribeCpp" | "Parakeet" | "Moonshine" | "MoonshineStreaming" | "SenseVoice" | "GigaAM" | "Canary" | "Cohere"
-export type GpuDeviceOption = { id: number; name: string; total_vram_mb: number }
+export type GpuDeviceOption = { id: string; name: string; total_vram_mb: number }
export type HistoryEntry = { id: number; file_name: string; timestamp: number; saved: boolean; title: string; transcription_text: string; post_processed_text: string | null; post_process_prompt: string | null; post_process_requested: boolean }
export type HistoryUpdatePayload = { action: "added"; entry: HistoryEntry } | { action: "updated"; entry: HistoryEntry } | { action: "deleted"; id: number } | { action: "toggled"; id: number }
/**
diff --git a/src/components/settings/AccelerationSelector.tsx b/src/components/settings/AccelerationSelector.tsx
index 7a936ab9..a2276cb8 100644
--- a/src/components/settings/AccelerationSelector.tsx
+++ b/src/components/settings/AccelerationSelector.tsx
@@ -24,30 +24,31 @@ interface AccelerationSelectorProps {
/**
* transcribe.cpp dropdown encodes accelerator + device in a single value:
- * "auto" → accelerator=auto, gpu_device=-1
- * "cpu" → accelerator=cpu, gpu_device=-1
- * "gpu:0" → accelerator=gpu, gpu_device=0
- * "gpu:1" → accelerator=gpu, gpu_device=1
+ * "auto" → accelerator=auto, gpu_device=null
+ * "cpu" → accelerator=cpu, gpu_device=null
+ * "gpu" → accelerator=gpu, auto GPU selection
+ * "gpu:<id>" → accelerator=gpu, stable opaque device identity
*/
function encodeTranscribeValue(
accelerator: TranscribeAcceleratorSetting,
- gpuDevice: number,
+ gpuDevice: string | null,
): string {
if (accelerator === "cpu") return "cpu";
- if (accelerator === "gpu" && gpuDevice >= 0) return `gpu:${gpuDevice}`;
+ if (accelerator === "gpu")
+ return gpuDevice === null ? "gpu" : `gpu:${gpuDevice}`;
return "auto";
}
function decodeTranscribeValue(value: string): {
accelerator: TranscribeAcceleratorSetting;
- gpuDevice: number;
+ gpuDevice: string | null;
} {
- if (value === "cpu") return { accelerator: "cpu", gpuDevice: -1 };
+ if (value === "cpu") return { accelerator: "cpu", gpuDevice: null };
+ if (value === "gpu") return { accelerator: "gpu", gpuDevice: null };
if (value.startsWith("gpu:")) {
- const id = parseInt(value.slice(4), 10);
- return { accelerator: "gpu", gpuDevice: id };
+ return { accelerator: "gpu", gpuDevice: value.slice(4) };
}
- return { accelerator: "auto", gpuDevice: -1 };
+ return { accelerator: "auto", gpuDevice: null };
}
export const AccelerationSelector: FC<AccelerationSelectorProps> = ({
@@ -74,6 +75,7 @@ export const AccelerationSelector: FC<AccelerationSelectorProps> = ({
}
if (available.transcribe.includes("gpu")) {
+ opts.push({ value: "gpu", label: "GPU" });
for (const dev of available.gpu_devices) {
const vramLabel =
dev.total_vram_mb >= 1024
@@ -105,16 +107,19 @@ export const AccelerationSelector: FC<AccelerationSelectorProps> = ({
}, [t]);
const currentAccelerator = getSetting("transcribe_accelerator") ?? "auto";
- const currentGpuDevice = getSetting("transcribe_gpu_device") ?? -1;
+ const currentGpuDevice = getSetting("transcribe_gpu_device") ?? null;
const currentTranscribe = encodeTranscribeValue(
currentAccelerator as TranscribeAcceleratorSetting,
- currentGpuDevice as number,
+ currentGpuDevice as string | null,
);
const displayedTranscribe = transcribeOptions.some(
(option) => option.value === currentTranscribe,
)
? currentTranscribe
- : (transcribeOptions[0]?.value ?? null);
+ : currentAccelerator === "gpu" &&
+ transcribeOptions.some((option) => option.value === "gpu")
+ ? "gpu"
+ : (transcribeOptions[0]?.value ?? null);
const currentOrt = getSetting("ort_accelerator") ?? "auto";
const handleTranscribeChange = async (value: string) => {
diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.ts
index f7e7944c..2ec9e4df 100644
--- a/src/stores/settingsStore.ts
+++ b/src/stores/settingsStore.ts
@@ -173,7 +173,7 @@ const settingUpdaters: {
ort_accelerator: (value) =>
commands.changeOrtAcceleratorSetting(value as OrtAcceleratorSetting),
transcribe_gpu_device: (value) =>
- commands.changeTranscribeGpuDevice(value as number),
+ commands.changeTranscribeGpuDevice(value as string | null),
extra_recording_buffer_ms: (value) =>
commands.changeExtraRecordingBufferSetting(value as number),
};