Skip to main content

weirdnet_model/hw/
sizing.rs

1//! The usable memory budget and which models fit in it.
2
3use crate::ModelSpec;
4use crate::speech::{self, CloneMode, SpeechProfile};
5use serde::{Deserialize, Serialize};
6
7use super::{Accel, GIB, Hardware};
8
9/// What a model is for on a node (its role): `chat`, `embedding`, `transcribe` or `speak` on the
10/// wire.
11#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
12#[serde(rename_all = "snake_case")]
13#[non_exhaustive]
14pub enum Purpose {
15    Chat,
16    Embedding,
17    /// Speech to text: audio in (an `input_audio` part), its transcript out, so a soundtrack can
18    /// become text for models that don't take audio. Never picked as a chat model.
19    Transcribe,
20    /// Text to speech: text (or a multi-speaker script) in, audio out, in the voices its
21    /// [`SpeechProfile`] lists ([`CatalogEntry::speech`]). Never picked as a chat model, never
22    /// in a [`plan`]. Since 0.5.5.
23    Speak,
24}
25
26impl Purpose {
27    /// Every purpose, in wire order.
28    pub const ALL: [Purpose; 4] = [Purpose::Chat, Purpose::Embedding, Purpose::Transcribe, Purpose::Speak];
29
30    /// The name on the wire and in settings: `chat`, `embedding`, `transcribe` or `speak`.
31    pub fn as_str(&self) -> &'static str {
32        match self {
33            Purpose::Chat => "chat",
34            Purpose::Embedding => "embedding",
35            Purpose::Transcribe => "transcribe",
36            Purpose::Speak => "speak",
37        }
38    }
39
40    /// The purpose named `name` (as [`as_str`](Self::as_str) writes it), if any.
41    pub fn parse(name: &str) -> Option<Purpose> {
42        Purpose::ALL.into_iter().find(|p| p.as_str() == name)
43    }
44}
45
46impl std::fmt::Display for Purpose {
47    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
48        f.write_str(self.as_str())
49    }
50}
51
52/// The speech-to-text entry ([`Purpose::Transcribe`]): Voxtral Mini 3B, which llama.cpp runs
53/// with its projector ([`CatalogEntry::projector`]).
54pub const VOXTRAL_MINI_3B: &str = "voxtral-mini-3b";
55
56/// Text-to-speech entries ([`Purpose::Speak`]), one per checkpoint (each mode of Qwen3-TTS is
57/// its own checkpoint, so its own id). Since 0.5.5.
58///
59/// Qwen3-TTS 0.6B CustomVoice: nine preset voices, for vLLM-Omni.
60pub const QWEN3_TTS_0_6B_CUSTOMVOICE: &str = "qwen3-tts-0.6b-customvoice";
61/// Qwen3-TTS 0.6B Base: voice cloning, for vLLM-Omni.
62pub const QWEN3_TTS_0_6B_BASE: &str = "qwen3-tts-0.6b-base";
63/// Qwen3-TTS 1.7B CustomVoice: nine preset voices with style instructions, for vLLM-Omni.
64pub const QWEN3_TTS_1_7B_CUSTOMVOICE: &str = "qwen3-tts-1.7b-customvoice";
65/// Qwen3-TTS 1.7B VoiceDesign: a voice from a description, for vLLM-Omni.
66pub const QWEN3_TTS_1_7B_VOICEDESIGN: &str = "qwen3-tts-1.7b-voicedesign";
67/// Qwen3-TTS 1.7B Base: voice cloning, as ggml-org's GGUF with its projector, for llama.cpp.
68pub const QWEN3_TTS_1_7B_BASE: &str = "qwen3-tts-1.7b-base";
69/// Kokoro 82M: 54 preset voices, as ggml-org's GGUF with its projector, for llama.cpp.
70pub const KOKORO_82M: &str = "kokoro-82m";
71/// VoxCPM2: voice design and cloning, as ggml-org's GGUF with its projector, for llama.cpp.
72pub const VOXCPM2: &str = "voxcpm2";
73/// Fish Audio Drama 3: multi-speaker scripts, as ggml-org's GGUF with its projector, for
74/// llama.cpp. Under the Fish Audio Community License ([`speech::FISH_AUDIO_COMMUNITY`]):
75/// [`CatalogEntry::restricted`], so [`speaker`] never picks it and a download needs the
76/// operator's explicit acceptance ([`Consent::accepting_license`](crate::Consent::accepting_license)).
77pub const FISH_AUDIO_DRAMA_3: &str = "fish-audio-drama-3";
78
79/// Caveling 2 Mini: caveman-so's fine-tune of Inkling 2 Mini (26B mixture of experts, 3.4B
80/// active, text and vision, Apache-2.0) that spends about 43% fewer reasoning tokens, as the
81/// Q4_K_M GGUF with its Q8_0 vision projector ([`CatalogEntry::projector`]) for llama.cpp. Since 0.5.6.
82pub const CAVELING_2_MINI: &str = "caveling-2-mini";
83
84/// Speech-to-text entries ([`Purpose::Transcribe`]) that vLLM serves (the Hugging Face checkpoint,
85/// not a GGUF; install `vllm[audio]`). Since 0.5.6.
86///
87/// Qwen3-ASR 1.7B (Apache-2.0): two safetensors shards ([`CatalogEntry::files`]).
88pub const QWEN3_ASR_1_7B: &str = "qwen3-asr-1.7b";
89/// Whisper large-v3-turbo (MIT), for vLLM. Whisper-style: 30 second windows
90/// ([`WHISPER_CHUNK_SECONDS`](crate::limits::WHISPER_CHUNK_SECONDS)).
91pub const WHISPER_LARGE_V3_TURBO: &str = "whisper-large-v3-turbo";
92/// Cohere Transcribe 03-2026 (Apache-2.0), for vLLM. The Hub repo is gated
93/// ([`CatalogEntry::gated`]: accept its terms and set `HF_TOKEN`) and carries custom code, so
94/// vLLM needs `--trust-remote-code` ([`CatalogEntry::engine_args`]).
95pub const COHERE_TRANSCRIBE_03_2026: &str = "cohere-transcribe-03-2026";
96
97/// The context [`CAVELING_2_MINI`] is sized and launched at (the 262144 an engine's default
98/// plan assumes does not leave room for its KV cache next to the weights on one node).
99const CAVELING_CONTEXT: u32 = 346_112;
100
101/// Bytes of Qwen3-TTS's speech tokenizer (`speech_tokenizer/model.safetensors`, the same file in
102/// every Qwen3-TTS repo), which vLLM-Omni loads next to the checkpoint.
103const QWEN3_TTS_TOKENIZER_BYTES: u64 = 682_293_092;
104/// Where Drama 3's weights come from, for the license check on hand-built specs.
105const DRAMA_3_UPSTREAM: &str = "fishaudio/drama-3";
106
107/// A later shard of a sharded checkpoint: file name, bytes, SHA-256.
108type Shard = (&'static str, u64, &'static str);
109
110/// The shards after the first of a sharded entry (the first is [`CatalogEntry::spec`]), in order.
111fn later_shards(id: &str) -> &'static [Shard] {
112    match id {
113        QWEN3_ASR_1_7B => &[("model-00002-of-00002.safetensors", 478_200_688, "6e0b9d9e09e2e0238e7ef3cc8a484ab387e91b90f1900bedf88bc92d7929ccfc")],
114        _ => &[],
115    }
116}
117
118/// A catalog model with what it needs in memory.
119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
120pub struct CatalogEntry {
121    pub spec: ModelSpec,
122    pub purpose: Purpose,
123    pub quant: String,
124    /// Total and active parameters, in billions (they differ for mixture-of-experts models).
125    pub params_b: f32,
126    pub active_params_b: f32,
127    /// KV cache bytes per token at f16 (layers x KV heads x head dim x 2 x 2).
128    pub kv_bytes_per_token: u64,
129    /// Context the sizing assumes per slot.
130    pub context: u32,
131}
132
133impl CatalogEntry {
134    pub fn id(&self) -> &str {
135        &self.spec.id
136    }
137
138    /// Weights (and the projector's, for entries that need one, and Qwen3-TTS's speech tokenizer
139    /// for its vLLM-Omni checkpoints) plus KV for `slots` concurrent requests at the entry's
140    /// context, plus 10% for compute buffers.
141    pub fn footprint(&self, slots: u32) -> u64 {
142        let kv = self.kv_bytes_per_token * self.context as u64 * slots as u64;
143        let weights = self.weights_bytes() + self.projector().map_or(0, |p| p.size) + self.companion_bytes();
144        (weights + kv) + (weights + kv) / 10
145    }
146
147    fn companion_bytes(&self) -> u64 {
148        match self.spec.id.as_str() {
149            QWEN3_TTS_0_6B_CUSTOMVOICE | QWEN3_TTS_0_6B_BASE | QWEN3_TTS_1_7B_CUSTOMVOICE | QWEN3_TTS_1_7B_VOICEDESIGN => QWEN3_TTS_TOKENIZER_BYTES,
150            _ => 0,
151        }
152    }
153
154    /// Every weights file of the entry, in order, each a [`ModelSpec`] with its own size and
155    /// SHA-256. An entry with one file (all but the sharded checkpoints) lists just
156    /// [`spec`](Self::spec); a sharded checkpoint such as [`QWEN3_ASR_1_7B`] lists its safetensors
157    /// shards, the first of which is `spec` (what the engine loads the checkpoint from). Every
158    /// shard has the entry's id, so one [`Consent`](crate::Consent) covers them all and
159    /// [`download_parts`](crate::download::download_parts) fetches them together, checking each
160    /// hash. The files that are not weights (config, tokenizer) are not pinned: the engine
161    /// fetches them with the repo, at [`revision`](Self::revision). Since 0.5.6.
162    ///
163    /// ```no_run
164    /// use weirdnet_model::{Consent, ModelStore, download::download_parts, hw};
165    ///
166    /// let asr = hw::find(hw::QWEN3_ASR_1_7B).unwrap();
167    /// assert!(asr.is_sharded());
168    /// for shard in asr.files() {
169    ///     println!("{} {} bytes sha256 {}", shard.file, shard.size, shard.sha256.as_deref().unwrap());
170    /// }
171    /// // After showing the user what will be fetched: one consent, every shard checked.
172    /// let consent = Consent::given(&asr.spec);
173    /// download_parts(&ModelStore::from_env(), &asr.files(), &consent, &mut |_| true)?;
174    /// # Ok::<(), weirdnet_model::Error>(())
175    /// ```
176    pub fn files(&self) -> Vec<ModelSpec> {
177        let mut files = vec![self.spec.clone()];
178        files.extend(later_shards(&self.spec.id).iter().map(|&(file, size, sha256)| ModelSpec {
179            file: file.into(),
180            size,
181            sha256: Some(sha256.into()),
182            ..self.spec.clone()
183        }));
184        files
185    }
186
187    /// Whether the entry's weights are in more than one file ([`files`](Self::files)). Since 0.5.6.
188    pub fn is_sharded(&self) -> bool {
189        !later_shards(&self.spec.id).is_empty()
190    }
191
192    /// Bytes of all the weights files ([`files`](Self::files)): `spec.size` for an entry with one.
193    /// Since 0.5.6.
194    pub fn weights_bytes(&self) -> u64 {
195        self.spec.size + later_shards(&self.spec.id).iter().map(|s| s.1).sum::<u64>()
196    }
197
198    /// The Hugging Face commit the entry's sizes and hashes were read at, for the entries added
199    /// in 0.5.6 (an engine pins it, for example vLLM's `--revision`, so what it loads is what the
200    /// hashes describe). `None` for the entries from before, whose hashes pin the file itself.
201    /// Downloads here fetch `main` and check the pinned hashes, so a moved `main` fails the check
202    /// rather than loading other bytes. Since 0.5.6.
203    pub fn revision(&self) -> Option<&'static str> {
204        match self.spec.id.as_str() {
205            CAVELING_2_MINI => Some("ec4b4b4114cf8375abc1cf42d6c41971b778e2ba"),
206            QWEN3_ASR_1_7B => Some("7278e1e70fe206f11671096ffdd38061171dd6e5"),
207            WHISPER_LARGE_V3_TURBO => Some("41f01f3fe87f28c78e2fbf8b568835947dd65ed9"),
208            COHERE_TRANSCRIBE_03_2026 => Some("d552dadc2922ba6f6c1f994f8db904d52dcaf942"),
209            _ => None,
210        }
211    }
212
213    /// Arguments the entry needs on its engine's command line, in addition to the ones an app
214    /// sets for every model: `llama-server` arguments for a GGUF entry ([`is_gguf`](Self::is_gguf);
215    /// `-fa on --jinja` for [`CAVELING_2_MINI`]) and vLLM arguments for a checkpoint
216    /// (`--trust-remote-code` for [`COHERE_TRANSCRIBE_03_2026`], whose repo ships its own modeling
217    /// code). Append them to the launch's extra arguments, after the operator's own, never
218    /// instead of them. Empty for an entry that needs none. Since 0.5.6.
219    ///
220    /// ```
221    /// use weirdnet_model::hw;
222    ///
223    /// let cohere = hw::find(hw::COHERE_TRANSCRIBE_03_2026).unwrap();
224    /// let mut extra_args: Vec<String> = vec!["--max-model-len".into(), "4096".into()]; // the operator's own
225    /// extra_args.extend(cohere.engine_args().iter().map(|a| a.to_string()));
226    /// assert_eq!(extra_args, ["--max-model-len", "4096", "--trust-remote-code"]);
227    /// assert!(cohere.gated() && cohere.revision().is_some());
228    /// ```
229    pub fn engine_args(&self) -> &'static [&'static str] {
230        match self.spec.id.as_str() {
231            CAVELING_2_MINI => &["-fa", "on", "--jinja"],
232            COHERE_TRANSCRIBE_03_2026 => &["--trust-remote-code"],
233            _ => &[],
234        }
235    }
236
237    /// The context to launch the entry with when it needs more than an engine's default plan:
238    /// [`CAVELING_2_MINI`] runs at 346112 tokens (the same figure its footprint is sized at; the
239    /// 262144 default does not fit next to its weights). `None` when the default is right. Since
240    /// 0.5.6.
241    pub fn launch_context(&self) -> Option<u32> {
242        (self.spec.id == CAVELING_2_MINI).then_some(CAVELING_CONTEXT)
243    }
244
245    /// The number of layers to offload to the GPU when the entry should not use the default
246    /// (`99` for [`CAVELING_2_MINI`]: all of them). `None` when the default is right. Since 0.5.6.
247    pub fn launch_gpu_layers(&self) -> Option<u32> {
248        (self.spec.id == CAVELING_2_MINI).then_some(99)
249    }
250
251    /// Whether the Hub repo is gated: it needs the terms accepted on the Hub and a token on the
252    /// downloading node (`HF_TOKEN`, [`HfToken`](crate::HfToken)). [`download`](crate::download())
253    /// says so, without a request, when the store has none. [`COHERE_TRANSCRIBE_03_2026`] is.
254    /// Since 0.5.6.
255    pub fn gated(&self) -> bool {
256        self.spec.id == COHERE_TRANSCRIBE_03_2026
257    }
258
259    /// Whether the entry is a GGUF file llama.cpp runs (with its [`projector`](Self::projector)
260    /// when it has one). The others are Hugging Face checkpoints for vLLM-Omni: `spec.repo` is the
261    /// repo the engine serves, and `spec.file`, `size` and `sha256` pin its main weights (the
262    /// engine fetches the rest of the repo). Since 0.5.5.
263    pub fn is_gguf(&self) -> bool {
264        self.spec.file.to_ascii_lowercase().ends_with(".gguf")
265    }
266
267    /// Whether this is a text-to-speech model ([`Purpose::Speak`]). Since 0.5.5.
268    pub fn speaks(&self) -> bool {
269        self.purpose == Purpose::Speak
270    }
271
272    /// The model's license as its card names it (an SPDX id such as `apache-2.0`, or
273    /// [`speech::FISH_AUDIO_COMMUNITY`]), for the entries that record it: the speech-to-text and
274    /// text-to-speech models and [`CAVELING_2_MINI`] (`apache-2.0`; `mit` for
275    /// [`WHISPER_LARGE_V3_TURBO`]). `None` for the others. Since 0.5.5.
276    pub fn license(&self) -> Option<&'static str> {
277        match self.spec.id.as_str() {
278            FISH_AUDIO_DRAMA_3 => Some(speech::FISH_AUDIO_COMMUNITY),
279            WHISPER_LARGE_V3_TURBO => Some("mit"),
280            VOXTRAL_MINI_3B
281            | CAVELING_2_MINI
282            | QWEN3_ASR_1_7B
283            | COHERE_TRANSCRIBE_03_2026
284            | QWEN3_TTS_0_6B_CUSTOMVOICE
285            | QWEN3_TTS_0_6B_BASE
286            | QWEN3_TTS_1_7B_CUSTOMVOICE
287            | QWEN3_TTS_1_7B_VOICEDESIGN
288            | QWEN3_TTS_1_7B_BASE
289            | KOKORO_82M
290            | VOXCPM2 => Some("apache-2.0"),
291            _ => None,
292        }
293    }
294
295    /// Whether the license restricts use ([`speech::restricting_license`]): such an entry is never
296    /// picked by [`speaker`] or a [`plan`], and [`download`](crate::download()) refuses it (and its
297    /// projector) without a [`Consent::accepting_license`](crate::Consent::accepting_license) for
298    /// that license. Since 0.5.5.
299    pub fn restricted(&self) -> bool {
300        speech::restricting_license(self.license()).is_some()
301    }
302
303    /// What a text-to-speech entry does, cited to the model's card and its engine's documentation
304    /// (llama.cpp `docs/multimodal/tts.md` and the llama-server README for GGUF entries; the
305    /// vLLM-Omni speech API for the others), read 2026-11-27. Never measured figures: what an
306    /// engine reports at load goes over it ([`SpeechProfile::or`]). `None` for entries that
307    /// don't speak. Since 0.5.5.
308    ///
309    /// - Qwen3-TTS (24 kHz, ten languages): CustomVoice has nine preset voices (the 1.7B also
310    ///   takes style instructions; the 0.6B doesn't), VoiceDesign designs a voice from a
311    ///   description, Base clones a voice from a clip whose transcript is optional on vLLM-Omni;
312    ///   ggml-org's 1.7B Base projector has the speaker encoder only, so llama.cpp clones from
313    ///   the clip alone.
314    /// - Kokoro (24 kHz): the 54 voices in ggml-org's projector, `af_heart` (the default) first;
315    ///   English from text (`en-us`, `en-gb`), other languages as raw phonemes; speed.
316    /// - VoxCPM2 (48 kHz, 30 languages from the text): voice design, cloning from a clip (its
317    ///   first 30 s; no transcript).
318    /// - Fish Audio Drama 3 (44.1 kHz, 83 languages from the text): scripts of up to 16
319    ///   speakers. ggml-org's projector has no codec encoder, so it does not clone ("Voice
320    ///   cloning is not supported yet", its card). License [`speech::FISH_AUDIO_COMMUNITY`].
321    pub fn speech(&self) -> Option<SpeechProfile> {
322        if !self.speaks() {
323            return None;
324        }
325        let qwen_vllm = || speech::vllm_omni().with_languages(speech::QWEN3_TTS_LANGUAGES).with_sample_rate(24_000);
326        Some(match self.spec.id.as_str() {
327            QWEN3_TTS_0_6B_CUSTOMVOICE => qwen_vllm().with_presets(QWEN3_TTS_SPEAKERS),
328            QWEN3_TTS_1_7B_CUSTOMVOICE => qwen_vllm().with_presets(QWEN3_TTS_SPEAKERS).with_instructions(true),
329            QWEN3_TTS_1_7B_VOICEDESIGN => qwen_vllm().with_design(true),
330            QWEN3_TTS_0_6B_BASE => qwen_vllm().with_clone(CloneMode::AudioAndText),
331            QWEN3_TTS_1_7B_BASE => {
332                speech::llama_server().with_languages(speech::QWEN3_TTS_LANGUAGES).with_sample_rate(24_000).with_clone(CloneMode::Audio)
333            }
334            KOKORO_82M => speech::llama_server()
335                .with_presets(KOKORO_VOICES)
336                .with_languages(speech::KOKORO_LANGUAGES)
337                .with_raw(true)
338                .with_speed(true)
339                .with_sample_rate(24_000),
340            VOXCPM2 => speech::llama_server()
341                .with_design(true)
342                .with_clone(CloneMode::Audio)
343                .with_max_reference_seconds(30)
344                .with_languages(VOXCPM2_LANGUAGES)
345                .with_sample_rate(48_000),
346            FISH_AUDIO_DRAMA_3 => speech::llama_server()
347                .with_script_speakers(16)
348                .with_languages(DRAMA_3_LANGUAGES)
349                .with_sample_rate(44_100)
350                .with_license(speech::FISH_AUDIO_COMMUNITY),
351            _ => return None,
352        })
353    }
354
355    /// Repos whose files fall under this entry's license (its own, and where the weights come
356    /// from), for [`restricted_license`].
357    fn license_repos(&self) -> Vec<&str> {
358        let mut repos = vec![self.spec.repo.as_str()];
359        if self.spec.id == FISH_AUDIO_DRAMA_3 {
360            repos.push(DRAMA_3_UPSTREAM);
361        }
362        repos
363    }
364
365    /// The multimodal projector (llama.cpp `--mmproj`) the entry needs, pinned like the model
366    /// file: the audio encoder for [`VOXTRAL_MINI_3B`], and the audio generator (codec, voices,
367    /// reference encoder) of each GGUF text-to-speech entry, and the vision encoder of
368    /// [`CAVELING_2_MINI`] (Q8_0). `None` for the other text models and the checkpoints vLLM serves.
369    /// Download it with the same consent gate as the model.
370    pub fn projector(&self) -> Option<ModelSpec> {
371        match self.spec.id.as_str() {
372            VOXTRAL_MINI_3B => Some(spec(
373                "voxtral-mini-3b-mmproj",
374                "Voxtral Mini 3B audio encoder (Q8_0)",
375                "ggml-org/Voxtral-Mini-3B-2507-GGUF",
376                "mmproj-Voxtral-Mini-3B-2507-Q8_0.gguf",
377                715_714_080,
378                "4f24c4ef3ce929d02ed9d1cfb050ae9a7365f057c0ddec0d489580982ebe0d02",
379            )),
380            CAVELING_2_MINI => Some(spec(
381                "caveling-2-mini-mmproj",
382                "Caveling 2 Mini vision encoder (Q8_0)",
383                "caveman-so/caveling-2-mini-GGUF",
384                "mmproj-Caveling-2-Mini-Q8_0.gguf",
385                345_911_360,
386                "ff510827b8f496f6e0755a374c74d8aee0ab5186d953e0e3a6d1fb17a98d3e9f",
387            )),
388            QWEN3_TTS_1_7B_BASE => Some(spec(
389                "qwen3-tts-1.7b-base-mmproj",
390                "Qwen3-TTS 1.7B Base speaker encoder and codec (Q8_0)",
391                "ggml-org/Qwen3-TTS-12Hz-1.7B-Base-GGUF",
392                "mmproj-Qwen3-TTS-12Hz-1.7B-Base-Q8_0.gguf",
393                446_422_912,
394                "6fd65188839bcd6ecc91b277ad471e22a0edfada4699a0fe82f1165c18cfcce2",
395            )),
396            KOKORO_82M => Some(spec(
397                "kokoro-82m-mmproj",
398                "Kokoro 82M decoder and voices (F16)",
399                "ggml-org/Kokoro-82M-GGUF",
400                "mmproj-Kokoro-82M-F16.gguf",
401                208_456_512,
402                "071d20f53b7c5d64b08a24bff5dfb77c2ea0df843a7c6c2356998a735ec6929d",
403            )),
404            VOXCPM2 => Some(spec(
405                "voxcpm2-mmproj",
406                "VoxCPM2 LocDiT and AudioVAE (BF16)",
407                "ggml-org/VoxCPM2-GGUF",
408                "mmproj-VoxCPM2-BF16.gguf",
409                2_007_741_504,
410                "2d0be367461d11e12a8544487491936a8f1d61d70d5313bb25dd50a4693be2ee",
411            )),
412            FISH_AUDIO_DRAMA_3 => Some(spec(
413                "fish-audio-drama-3-mmproj",
414                "Fish Audio Drama 3 codebook tower and codec (BF16)",
415                "ggml-org/drama-3-GGUF",
416                "mmproj-drama-3-BF16.gguf",
417                2_942_644_160,
418                "c29b9c90cf180cf81da39f31f023ba33641d54d7898e5e9be032c4d111ecbced",
419            )),
420            _ => None,
421        }
422    }
423
424    /// Whether this is a speech-to-text model ([`Purpose::Transcribe`]).
425    pub fn transcribes(&self) -> bool {
426        self.purpose == Purpose::Transcribe
427    }
428}
429
430fn spec(id: &str, label: &str, repo: &str, file: &str, size: u64, sha256: &str) -> ModelSpec {
431    ModelSpec { id: id.into(), label: label.into(), repo: repo.into(), file: file.into(), size, sha256: Some(sha256.into()) }
432}
433
434#[allow(clippy::too_many_arguments)]
435fn chat(spec: ModelSpec, quant: &str, params_b: f32, active_params_b: f32, kv_bytes_per_token: u64, context: u32) -> CatalogEntry {
436    CatalogEntry { spec, purpose: Purpose::Chat, quant: quant.into(), params_b, active_params_b, kv_bytes_per_token, context }
437}
438
439#[allow(clippy::too_many_arguments)]
440fn speaker_entry(spec: ModelSpec, quant: &str, params_b: f32, active_params_b: f32, kv_bytes_per_token: u64, context: u32) -> CatalogEntry {
441    CatalogEntry { spec, purpose: Purpose::Speak, quant: quant.into(), params_b, active_params_b, kv_bytes_per_token, context }
442}
443
444/// Qwen3-TTS CustomVoice's preset speakers (its model card, as `config.json` names them).
445const QWEN3_TTS_SPEAKERS: [&str; 9] = ["vivian", "serena", "uncle_fu", "dylan", "eric", "ryan", "aiden", "ono_anna", "sohee"];
446
447/// Kokoro's voices (`VOICES.md`; all 54 are in ggml-org's projector), the default first. The first
448/// letter is the language: American and British English, Spanish, French, Hindi, Italian,
449/// Japanese, Brazilian Portuguese, Mandarin.
450const KOKORO_VOICES: [&str; 54] = [
451    "af_heart",
452    "af_alloy",
453    "af_aoede",
454    "af_bella",
455    "af_jessica",
456    "af_kore",
457    "af_nicole",
458    "af_nova",
459    "af_river",
460    "af_sarah",
461    "af_sky",
462    "am_adam",
463    "am_echo",
464    "am_eric",
465    "am_fenrir",
466    "am_liam",
467    "am_michael",
468    "am_onyx",
469    "am_puck",
470    "am_santa",
471    "bf_alice",
472    "bf_emma",
473    "bf_isabella",
474    "bf_lily",
475    "bm_daniel",
476    "bm_fable",
477    "bm_george",
478    "bm_lewis",
479    "ef_dora",
480    "em_alex",
481    "em_santa",
482    "ff_siwis",
483    "hf_alpha",
484    "hf_beta",
485    "hm_omega",
486    "hm_psi",
487    "if_sara",
488    "im_nicola",
489    "jf_alpha",
490    "jf_gongitsune",
491    "jf_nezumi",
492    "jf_tebukuro",
493    "jm_kumo",
494    "pf_dora",
495    "pm_alex",
496    "pm_santa",
497    "zf_xiaobei",
498    "zf_xiaoni",
499    "zf_xiaoxiao",
500    "zf_xiaoyi",
501    "zm_yunjian",
502    "zm_yunxi",
503    "zm_yunxia",
504    "zm_yunyang",
505];
506
507/// VoxCPM2's 30 languages (its model card's `language` list).
508const VOXCPM2_LANGUAGES: [&str; 30] = [
509    "zh", "en", "ar", "my", "da", "nl", "fi", "fr", "de", "el", "he", "hi", "id", "it", "ja", "km", "ko", "lo", "ms", "no", "pl", "pt", "ru", "es",
510    "sw", "sv", "tl", "th", "tr", "vi",
511];
512
513/// Drama 3's 83 languages (its model card's `language` list).
514const DRAMA_3_LANGUAGES: [&str; 83] = [
515    "zh", "en", "ja", "ko", "es", "pt", "ar", "ru", "fr", "de", "sv", "it", "tr", "no", "nl", "cy", "eu", "ca", "da", "gl", "ta", "hu", "fi", "pl",
516    "et", "hi", "la", "ur", "th", "vi", "jw", "bn", "yo", "sl", "cs", "sw", "nn", "he", "ms", "uk", "id", "kk", "bg", "lv", "my", "tl", "sk", "ne",
517    "fa", "af", "el", "bo", "hr", "ro", "sn", "mi", "yi", "am", "be", "km", "is", "az", "sd", "br", "sq", "ps", "mn", "ht", "ml", "sr", "sa", "te",
518    "ka", "bs", "pa", "lt", "kn", "si", "hy", "mr", "as", "gu", "fo",
519];
520
521/// The tiered catalog: chat models smallest first, then the embedding model, then the
522/// speech-to-text models, then the text-to-speech models. Sizes and SHA-256 from the Hugging Face
523/// API (2026-11-19; Voxtral 2026-11-26; text to speech 2026-11-27; Caveling 2 Mini and the vLLM
524/// speech-to-text checkpoints 2026-12-02); the Gemma 4 files are `weirdnet-model`'s own pinned
525/// entries.
526pub fn catalog() -> Vec<CatalogEntry> {
527    let gemma = |id: &str| crate::catalog::find(id).expect("weirdnet-model ships Gemma 4");
528    vec![
529        chat(
530            spec(
531                "smollm2-135m",
532                "SmolLM2 135M instruct (Q8_0)",
533                "bartowski/SmolLM2-135M-Instruct-GGUF",
534                "SmolLM2-135M-Instruct-Q8_0.gguf",
535                144_811_360,
536                "5a1395716f7913741cc51d98581b9b1228d80987a9f7d3664106742eb06bba83",
537            ),
538            "Q8_0",
539            0.135,
540            0.135,
541            23_040,
542            8192,
543        ),
544        chat(gemma(crate::catalog::GEMMA_4_E2B), "Q4_0", 5.1, 2.0, 32_768, 8192),
545        chat(gemma(crate::catalog::GEMMA_4_E4B), "Q4_0", 8.0, 4.0, 65_536, 8192),
546        chat(
547            spec(
548                "qwen3-8b",
549                "Qwen3 8B (Q4_K_M)",
550                "unsloth/Qwen3-8B-GGUF",
551                "Qwen3-8B-Q4_K_M.gguf",
552                5_027_784_512,
553                "120307ba529eb2439d6c430d94104dabd578497bc7bfe7e322b5d9933b449bd4",
554            ),
555            "Q4_K_M",
556            8.2,
557            8.2,
558            147_456,
559            8192,
560        ),
561        chat(
562            spec(
563                "qwen3-14b",
564                "Qwen3 14B (Q4_K_M)",
565                "unsloth/Qwen3-14B-GGUF",
566                "Qwen3-14B-Q4_K_M.gguf",
567                9_001_753_984,
568                "5eaa0870bd81ed3b58a630a271234cfa604e43ffb3a19cd68e54a80dd9d52a66",
569            ),
570            "Q4_K_M",
571            14.8,
572            14.8,
573            163_840,
574            8192,
575        ),
576        chat(
577            spec(
578                "gpt-oss-20b",
579                "gpt-oss 20B (MXFP4)",
580                "ggml-org/gpt-oss-20b-GGUF",
581                "gpt-oss-20b-MXFP4.gguf",
582                12_109_566_624,
583                "27cd6c432c7672cb812a92f611cf3ba7bbc35928262bb1e1253ff4ee6ae35901",
584            ),
585            "MXFP4",
586            21.0,
587            3.6,
588            49_152,
589            8192,
590        ),
591        // Caveling 2 Mini (caveman-so, Apache-2.0): Inkling 2 Mini with its attention layers
592        // fine-tuned, 26B with 3.4B active. Only 4 of its 24 layers attend over the whole context
593        // (the other 20 slide a 1024-token window, a fixed 84 MB per slot that the figure leaves
594        // out): 4 layers x 8 KV heads x (128 + 128) x 2 bytes, from the repo's `config.json`.
595        // Sized at the context it runs at (CAVELING_CONTEXT), with its vision projector. The
596        // Q4_K_M file is the one pinned: the repo also holds an NVFP4 file, a draft model
597        // (`dspark-`) for speculative decoding and an `imatrix.gguf`, none of them a chat model
598        // to pull by default.
599        chat(
600            spec(
601                CAVELING_2_MINI,
602                "Caveling 2 Mini (Q4_K_M)",
603                "caveman-so/caveling-2-mini-GGUF",
604                "Caveling-2-Mini-Q4_K_M.gguf",
605                18_398_579_616,
606                "aab63d16dac44b32f57d53aa1982e9f18f130b88b992c10539f24feee87cd254",
607            ),
608            "Q4_K_M",
609            26.0,
610            3.4,
611            16_384,
612            CAVELING_CONTEXT,
613        ),
614        chat(
615            spec(
616                "qwen3-30b-a3b",
617                "Qwen3 30B-A3B (Q4_K_M)",
618                "unsloth/Qwen3-30B-A3B-GGUF",
619                "Qwen3-30B-A3B-Q4_K_M.gguf",
620                18_556_686_912,
621                "9f1a24700a339b09c06009b729b5c809e0b64c213b8af5b711b3dbdfd0c5ba48",
622            ),
623            "Q4_K_M",
624            30.5,
625            3.3,
626            98_304,
627            8192,
628        ),
629        chat(
630            spec(
631                "qwen3-32b",
632                "Qwen3 32B (Q4_K_M)",
633                "unsloth/Qwen3-32B-GGUF",
634                "Qwen3-32B-Q4_K_M.gguf",
635                19_762_150_048,
636                "8df67573b2c23484e02ec7af295e39bed7ee774f3771d5fda2978265b59370e7",
637            ),
638            "Q4_K_M",
639            32.8,
640            32.8,
641            262_144,
642            8192,
643        ),
644        CatalogEntry {
645            spec: spec(
646                "qwen3-embedding-0.6b",
647                "Qwen3 Embedding 0.6B (Q8_0)",
648                "Qwen/Qwen3-Embedding-0.6B-GGUF",
649                "Qwen3-Embedding-0.6B-Q8_0.gguf",
650                639_150_592,
651                "06507c7b42688469c4e7298b0a1e16deff06caf291cf0a5b278c308249c3e439",
652            ),
653            purpose: Purpose::Embedding,
654            quant: "Q8_0".into(),
655            params_b: 0.6,
656            active_params_b: 0.6,
657            kv_bytes_per_token: 114_688,
658            context: 2048,
659        },
660        // Mistral's Voxtral Mini 3B (Apache-2.0): a Whisper-style audio encoder in front of a 3B
661        // decoder, transcription in eight languages; 30 seconds of audio cost 187 tokens in
662        // llama.cpp, so 16K of context holds about 20 minutes with its transcript.
663        CatalogEntry {
664            spec: spec(
665                VOXTRAL_MINI_3B,
666                "Voxtral Mini 3B speech to text (Q4_K_M)",
667                "ggml-org/Voxtral-Mini-3B-2507-GGUF",
668                "Voxtral-Mini-3B-2507-Q4_K_M.gguf",
669                2_473_001_920,
670                "4705be8ec22ca23d12632f4b4a3691faa95917d90a06d3cf3c3ec0e91958f1a8",
671            ),
672            purpose: Purpose::Transcribe,
673            quant: "Q4_K_M".into(),
674            params_b: 4.7,
675            active_params_b: 4.7,
676            kv_bytes_per_token: 122_880,
677            context: 16_384,
678        },
679        // Speech to text on vLLM (checkpoints from the Hub, `vllm[audio]`; sizes, SHA-256 and the
680        // commit from the Hugging Face API, 2026-12-02). The context each is sized at is an
681        // assumption for the budget, like the speech entries'.
682        //
683        // Qwen3-ASR 1.7B (Apache-2.0): 2.35B parameters with its audio encoder; the 28-layer
684        // decoder keeps 8 KV heads x (128 + 128), from its `config.json`. Two shards.
685        CatalogEntry {
686            spec: spec(
687                QWEN3_ASR_1_7B,
688                "Qwen3-ASR 1.7B speech to text (BF16, vLLM)",
689                "Qwen/Qwen3-ASR-1.7B",
690                "model-00001-of-00002.safetensors",
691                4_220_320_824,
692                "a4cd1f1a04d90b757dc7f7dd26254e69a013b19e80efe590a83c6a3bde8608d6",
693            ),
694            purpose: Purpose::Transcribe,
695            quant: "BF16".into(),
696            params_b: 2.35,
697            active_params_b: 2.35,
698            kv_bytes_per_token: 28 * 8 * 256 * 2,
699            context: 8192,
700        },
701        // Whisper large-v3-turbo (OpenAI, MIT): 0.81B parameters, a 4-layer decoder of 20 heads x
702        // 64 (self-attention 4 x 20 x (64 + 64) x 2 bytes per token). Its cross-attention keeps
703        // 1500 encoder positions of the same size per request, counted as 1500 more positions
704        // on top of the 448 it decodes.
705        CatalogEntry {
706            spec: spec(
707                WHISPER_LARGE_V3_TURBO,
708                "Whisper large-v3-turbo speech to text (FP16, vLLM)",
709                "openai/whisper-large-v3-turbo",
710                "model.safetensors",
711                1_617_824_864,
712                "542566a422ae4f3fd23f1ba11add198fca01bbf82e66e6a2857b3f608b1eb9d1",
713            ),
714            purpose: Purpose::Transcribe,
715            quant: "F16".into(),
716            params_b: 0.81,
717            active_params_b: 0.81,
718            kv_bytes_per_token: 4 * 20 * 128 * 2,
719            context: 448 + 1500,
720        },
721        // Cohere Transcribe 03-2026 (Apache-2.0; the repo is gated): 2.07B parameters, a
722        // Conformer encoder and a "lightweight" Transformer decoder whose dimensions are in
723        // the gated `config.json`, which this entry was not built from: its KV cost is
724        // sized like Qwen3-ASR's decoder (an upper bound for a lightweight one).
725        CatalogEntry {
726            spec: spec(
727                COHERE_TRANSCRIBE_03_2026,
728                "Cohere Transcribe 03-2026 speech to text (BF16, vLLM, gated)",
729                "CohereLabs/cohere-transcribe-03-2026",
730                "model.safetensors",
731                4_131_862_976,
732                "987bd3e141c7bfdb5a78f5db11397ee7737308357e6cc0a3f36a4979b158137a",
733            ),
734            purpose: Purpose::Transcribe,
735            quant: "BF16".into(),
736            params_b: 2.07,
737            active_params_b: 2.07,
738            kv_bytes_per_token: 28 * 8 * 256 * 2,
739            context: 4096,
740        },
741        // Text to speech (Apache-2.0 unless noted). KV per token from each config or GGUF header
742        // (layers x KV heads x (key + value dim) x 2 bytes). Speech runs one utterance at a
743        // time, and the context these entries are sized at (4096: a prompt plus minutes of
744        // audio frames; Drama 3's documented cap in llama.cpp) is an assumption for the budget,
745        // not a limit the model reports.
746        //
747        // Qwen3-TTS (Qwen, 12.5 Hz codec): 28 layers x 8 KV heads x (128 + 128) for both sizes.
748        // ggml-org converted only the 1.7B Base checkpoint; the others are the Qwen repos that
749        // vLLM-Omni serves (BF16 safetensors, plus the shared speech tokenizer).
750        speaker_entry(
751            spec(
752                QWEN3_TTS_0_6B_CUSTOMVOICE,
753                "Qwen3-TTS 0.6B CustomVoice (BF16, vLLM-Omni)",
754                "Qwen/Qwen3-TTS-12Hz-0.6B-CustomVoice",
755                "model.safetensors",
756                1_811_626_576,
757                "bc3c7e785eb961179c25450d1acff03f839e0002f2f3a5aeb67b5735c0fa2adb",
758            ),
759            "BF16",
760            0.6,
761            0.6,
762            114_688,
763            4096,
764        ),
765        speaker_entry(
766            spec(
767                QWEN3_TTS_0_6B_BASE,
768                "Qwen3-TTS 0.6B Base, voice cloning (BF16, vLLM-Omni)",
769                "Qwen/Qwen3-TTS-12Hz-0.6B-Base",
770                "model.safetensors",
771                1_829_344_272,
772                "180b3b10eb1c9f1b4db7806d5475bae3071c0243c299d49926bab1da3b6946f6",
773            ),
774            "BF16",
775            0.6,
776            0.6,
777            114_688,
778            4096,
779        ),
780        speaker_entry(
781            spec(
782                QWEN3_TTS_1_7B_CUSTOMVOICE,
783                "Qwen3-TTS 1.7B CustomVoice (BF16, vLLM-Omni)",
784                "Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice",
785                "model.safetensors",
786                3_833_402_552,
787                "38b1d5971bdbd982b561cccec982669a53b0537c3cf5e9bd4778ed07bb2f5137",
788            ),
789            "BF16",
790            1.7,
791            1.7,
792            114_688,
793            4096,
794        ),
795        speaker_entry(
796            spec(
797                QWEN3_TTS_1_7B_VOICEDESIGN,
798                "Qwen3-TTS 1.7B VoiceDesign (BF16, vLLM-Omni)",
799                "Qwen/Qwen3-TTS-12Hz-1.7B-VoiceDesign",
800                "model.safetensors",
801                3_833_402_552,
802                "391e8db219f292c515297cdceeb43e4eae67cdde35fa57e79a6a8a532fca0522",
803            ),
804            "BF16",
805            1.7,
806            1.7,
807            114_688,
808            4096,
809        ),
810        speaker_entry(
811            spec(
812                QWEN3_TTS_1_7B_BASE,
813                "Qwen3-TTS 1.7B Base, voice cloning (Q8_0)",
814                "ggml-org/Qwen3-TTS-12Hz-1.7B-Base-GGUF",
815                "Qwen3-TTS-12Hz-1.7B-Base-Q8_0.gguf",
816                1_847_874_400,
817                "ac7931aeb2e7aad1a6ed6602d353a5679c9d096b18ce8204ac730a8408d572e1",
818            ),
819            "Q8_0",
820            1.7,
821            1.7,
822            114_688,
823            4096,
824        ),
825        // Kokoro 82M (hexgrad): not autoregressive; 12 layers x 12 heads x (64 + 64) over its
826        // 512-phoneme context.
827        speaker_entry(
828            spec(
829                KOKORO_82M,
830                "Kokoro 82M (F32)",
831                "ggml-org/Kokoro-82M-GGUF",
832                "Kokoro-82M-F32.gguf",
833                61_774_240,
834                "be19298184f1a2577eb20e4689f1e2b315cbf474c39e113f192991fef3c85c6e",
835            ),
836            "F32",
837            0.082,
838            0.082,
839            36_864,
840            512,
841        ),
842        // VoxCPM2 (OpenBMB, 2B): MiniCPM4 backbone, 28 layers x 2 KV heads x (128 + 128), plus
843        // the projector's residual LM (12 layers x 2 x (64 + 64)), which keeps one context per
844        // utterance.
845        speaker_entry(
846            spec(
847                VOXCPM2,
848                "VoxCPM2, voice design and cloning (Q8_0)",
849                "ggml-org/VoxCPM2-GGUF",
850                "VoxCPM2-Q8_0.gguf",
851                1_565_764_064,
852                "b09cd3afab454f23922632fd474aa0d5d667e128e8bf36e81e77ec7e71fac64b",
853            ),
854            "Q8_0",
855            2.0,
856            2.0,
857            28_672 + 6_144,
858            4096,
859        ),
860        // Fish Audio Drama 3 (Fish Audio Community License): Qwen3.5-MoE, 35B with 3B active;
861        // 10 of its 40 layers attend (the rest are recurrent), 2 KV heads x (256 + 256), plus
862        // the projector's codebook tower (13 layers x 2 x (128 + 128)), which keeps the whole
863        // sequence, prompt and frames, in its 4096 positions.
864        speaker_entry(
865            spec(
866                FISH_AUDIO_DRAMA_3,
867                "Fish Audio Drama 3, multi-speaker (Q4_K_M)",
868                "ggml-org/drama-3-GGUF",
869                "drama-3-Q4_K_M.gguf",
870                20_556_053_760,
871                "5b727d669a7a555713403b7f6d744402dafd6fd37154f0fe834a5310548a8b34",
872            ),
873            "Q4_K_M",
874            35.0,
875            3.0,
876            20_480 + 13_312,
877            4096,
878        ),
879    ]
880}
881
882/// The catalog entries for `purpose`, in catalog order.
883pub fn by_purpose(purpose: Purpose) -> Vec<CatalogEntry> {
884    catalog().into_iter().filter(|e| e.purpose == purpose).collect()
885}
886
887/// The speech-to-text model ([`Purpose::Transcribe`]) that fits `budget` with one request at
888/// a time, projector included, if any: the largest GGUF entry (llama.cpp runs it, and
889/// [`download`](crate::download()) fetches it), as [`speaker`] does; the checkpoints vLLM serves
890/// (0.5.6) are for an app that runs vLLM and picks one itself ([`by_purpose`]). [`plan`] never
891/// proposes one: transcription is optional, so an app adds it when it wants soundtracks turned
892/// into text.
893pub fn transcriber(budget: &Budget) -> Option<CatalogEntry> {
894    by_purpose(Purpose::Transcribe)
895        .into_iter()
896        .filter(|e| e.is_gguf() && e.footprint(1) <= budget.usable_bytes)
897        .max_by(|a, b| a.params_b.total_cmp(&b.params_b))
898}
899
900/// A text-to-speech model ([`Purpose::Speak`]) that fits `budget` with one request at a time,
901/// projector included: the largest GGUF entry (llama.cpp runs it, and [`download`](crate::download())
902/// fetches it) whose license doesn't restrict use, if any. [`plan`] never proposes one: speech
903/// is optional, so an app adds it when it wants text read aloud. Since 0.5.5.
904pub fn speaker(budget: &Budget) -> Option<CatalogEntry> {
905    by_purpose(Purpose::Speak)
906        .into_iter()
907        .filter(|e| e.is_gguf() && !e.restricted() && e.footprint(1) <= budget.usable_bytes)
908        .max_by(|a, b| a.params_b.total_cmp(&b.params_b))
909}
910
911/// The license that restricts downloading `spec`, if any: the license of a restricted catalog
912/// entry ([`CatalogEntry::restricted`]) whose model or projector `spec` is (by id), or whose repo
913/// (or the repo its weights come from) `spec` downloads from. [`download`](crate::download())
914/// refuses such a file without [`Consent::accepting_license`](crate::Consent::accepting_license).
915/// Since 0.5.5.
916pub fn restricted_license(spec: &ModelSpec) -> Option<&'static str> {
917    catalog()
918        .into_iter()
919        .filter(CatalogEntry::restricted)
920        .find(|e| {
921            e.spec.id == spec.id
922                || e.projector().is_some_and(|p| p.id == spec.id)
923                || e.license_repos().iter().any(|r| r.eq_ignore_ascii_case(&spec.repo))
924        })
925        .and_then(|e| e.license())
926}
927
928/// Whether downloading `spec` needs a token: it is the file of a gated catalog entry
929/// ([`CatalogEntry::gated`]) by id, or comes from its repo. [`download`](crate::download())
930/// refuses such a file, before any request, when the store has no token. Since 0.5.6.
931pub fn gated(spec: &ModelSpec) -> bool {
932    catalog().iter().filter(|e| e.gated()).any(|e| e.spec.id == spec.id || e.spec.repo.eq_ignore_ascii_case(&spec.repo))
933}
934
935/// The catalog entry with this id.
936pub fn find(id: &str) -> Option<CatalogEntry> {
937    catalog().into_iter().find(|e| e.spec.id == id)
938}
939
940/// How much memory models may use on this node.
941#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
942pub struct Budget {
943    /// VRAM of the first GPU, or system memory on unified and CPU-only machines.
944    pub pool_bytes: u64,
945    /// Kept for the OS (unified and CPU-only only).
946    pub reserve_bytes: u64,
947    pub usable_bytes: u64,
948}
949
950/// 85% of VRAM, or 85% of unified memory after the OS reserve (default: an eighth of RAM, at least
951/// 4 GiB). `memory_budget` overrides the result; `reserve` overrides the reserve.
952pub fn budget(hw: &Hardware, memory_budget: Option<u64>, reserve: Option<u64>) -> Budget {
953    let unified = hw.unified();
954    let pool_bytes = if unified { hw.ram_bytes } else { hw.gpus.first().map(|g| g.memory_bytes).unwrap_or(hw.ram_bytes) };
955    let reserve_bytes = if unified { reserve.unwrap_or_else(|| (hw.ram_bytes / 8).max(4 * GIB)) } else { 0 };
956    let usable = pool_bytes.saturating_sub(reserve_bytes) / 100 * 85;
957    Budget { pool_bytes, reserve_bytes, usable_bytes: memory_budget.unwrap_or(usable) }
958}
959
960/// What setup proposes for this node.
961#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
962pub struct Plan {
963    pub budget: Budget,
964    pub main: Option<CatalogEntry>,
965    pub standin: Option<CatalogEntry>,
966    pub embedding: Option<CatalogEntry>,
967    /// Concurrent requests each chat model is sized for.
968    pub slots: u32,
969    pub notes: Vec<String>,
970}
971
972/// Picks the largest chat model that fits with its KV budget, a Gemma 4 stand-in and the embedding
973/// model. CPU-only machines only get models with at most 4B active parameters, so answers stay
974/// usable.
975pub fn plan(hw: &Hardware, budget: Budget) -> Plan {
976    let slots = 2;
977    let cpu_only = hw.accel() == Accel::Cpu;
978    let mut notes = Vec::new();
979    let all = catalog();
980    let fits = |e: &&CatalogEntry| e.footprint(slots) <= budget.usable_bytes;
981    let main = all
982        .iter()
983        .filter(|e| e.purpose == Purpose::Chat && e.spec.id != "smollm2-135m")
984        .filter(|e| !cpu_only || e.active_params_b <= 4.0)
985        .filter(fits)
986        .max_by(|a, b| a.params_b.total_cmp(&b.params_b))
987        .cloned();
988    if cpu_only {
989        notes.push("CPU only: limited to models with at most 4B active parameters".into());
990    }
991    if main.is_none() {
992        notes.push("no catalog chat model fits this budget; add a smaller GGUF model".into());
993    }
994    let standin_id = if budget.usable_bytes >= 16 * GIB { crate::catalog::GEMMA_4_E4B } else { crate::catalog::GEMMA_4_E2B };
995    let standin = all.iter().find(|e| e.spec.id == standin_id).filter(fits).filter(|e| main.as_ref().is_none_or(|m| m.spec.id != e.spec.id)).cloned();
996    let embedding = all.iter().find(|e| e.purpose == Purpose::Embedding).filter(|e| e.footprint(1) <= budget.usable_bytes).cloned();
997    Plan { budget, main, standin, embedding, slots, notes }
998}
999
1000#[cfg(test)]
1001mod tests {
1002    use super::*;
1003    use crate::hw::{Gpu, parse_nvidia_smi};
1004
1005    fn box_with(gpus: Vec<Gpu>, ram_gib: u64) -> Hardware {
1006        Hardware { os: "linux".into(), arch: "x86_64".into(), cpu_threads: 16, ram_bytes: ram_gib * GIB, gpus }
1007    }
1008
1009    #[test]
1010    fn rtx_3060_gets_an_8b() {
1011        let hw = box_with(parse_nvidia_smi("NVIDIA GeForce RTX 3060, 12288, 8.6, 615.78.08", 62 * GIB), 62);
1012        let b = budget(&hw, None, None);
1013        assert_eq!(b.pool_bytes, 12 * GIB);
1014        let p = plan(&hw, b);
1015        assert_eq!(p.main.unwrap().id(), "qwen3-8b");
1016        assert_eq!(p.standin.unwrap().id(), "gemma-4-e2b");
1017        assert!(p.embedding.is_some());
1018    }
1019
1020    #[test]
1021    fn spark_gets_a_big_model() {
1022        let hw = box_with(parse_nvidia_smi("NVIDIA GB10, [N/A], 12.1, 580.95.05", 128 * GIB), 128);
1023        let b = budget(&hw, None, None);
1024        assert_eq!(b.reserve_bytes, 16 * GIB);
1025        let p = plan(&hw, b);
1026        assert_eq!(p.main.unwrap().id(), "qwen3-32b");
1027        assert_eq!(p.standin.unwrap().id(), "gemma-4-e4b");
1028    }
1029
1030    #[test]
1031    fn cpu_box_prefers_few_active_params() {
1032        let hw = box_with(Vec::new(), 62);
1033        let p = plan(&hw, budget(&hw, None, None));
1034        assert_eq!(p.main.unwrap().id(), "qwen3-30b-a3b");
1035    }
1036
1037    #[test]
1038    fn tiny_box_gets_no_main() {
1039        let hw = box_with(Vec::new(), 4);
1040        let p = plan(&hw, budget(&hw, Some(GIB), None));
1041        assert!(p.main.is_none());
1042        assert!(!p.notes.is_empty());
1043    }
1044
1045    #[test]
1046    fn override_budget() {
1047        let hw = box_with(Vec::new(), 64);
1048        assert_eq!(budget(&hw, Some(10 * GIB), None).usable_bytes, 10 * GIB);
1049        assert_eq!(budget(&hw, None, Some(14 * GIB)).reserve_bytes, 14 * GIB);
1050    }
1051
1052    #[test]
1053    fn transcribe_is_a_purpose_of_its_own() {
1054        assert_eq!(serde_json::to_string(&Purpose::Transcribe).unwrap(), "\"transcribe\"");
1055        for p in Purpose::ALL {
1056            assert_eq!(serde_json::from_str::<Purpose>(&format!("\"{p}\"")).unwrap(), p);
1057            assert_eq!(Purpose::parse(p.as_str()), Some(p));
1058        }
1059        assert_eq!(Purpose::parse("speech"), None);
1060        // Stored entries from before the variant still read.
1061        assert_eq!(serde_json::from_str::<Purpose>("\"chat\"").unwrap(), Purpose::Chat);
1062    }
1063
1064    #[test]
1065    fn the_catalog_has_a_pinned_speech_to_text_model() {
1066        let stt: Vec<_> = by_purpose(Purpose::Transcribe).into_iter().filter(CatalogEntry::is_gguf).collect();
1067        assert_eq!(stt.len(), 1);
1068        let v = &stt[0];
1069        assert_eq!((v.id(), v.quant.as_str(), v.context), (VOXTRAL_MINI_3B, "Q4_K_M", 16_384));
1070        assert!(v.transcribes());
1071        assert_eq!(find(VOXTRAL_MINI_3B).as_ref(), Some(v));
1072        assert_eq!(v.spec.repo, "ggml-org/Voxtral-Mini-3B-2507-GGUF");
1073        assert_eq!(v.spec.sha256.as_deref().map(str::len), Some(64));
1074        let p = v.projector().expect("Voxtral needs its audio encoder");
1075        assert_eq!((p.repo.as_str(), p.file.as_str(), p.size), (v.spec.repo.as_str(), "mmproj-Voxtral-Mini-3B-2507-Q8_0.gguf", 715_714_080));
1076        assert!(p.sha256.as_deref().is_some_and(|h| h.len() == 64 && h.chars().all(|c| c.is_ascii_hexdigit())));
1077        assert_ne!(p.file, v.spec.file);
1078        // 30 layers x 8 KV heads x (128 + 128) x 2 bytes.
1079        assert_eq!(v.kv_bytes_per_token, 30 * 8 * 256 * 2);
1080        // The projector counts in the footprint; text models have none.
1081        let without = (v.spec.size + v.kv_bytes_per_token * 16_384) * 11 / 10;
1082        assert!(v.footprint(1) > without);
1083        assert!(catalog().iter().filter(|e| !e.transcribes() && !e.speaks() && e.id() != CAVELING_2_MINI).all(|e| e.projector().is_none()));
1084        // Catalog ids stay unique.
1085        let mut ids: Vec<_> = catalog().iter().map(|e| e.id().to_string()).collect();
1086        ids.sort();
1087        ids.dedup();
1088        assert_eq!(ids.len(), catalog().len());
1089    }
1090
1091    #[test]
1092    fn plans_never_pick_the_transcriber_and_it_fits_on_its_own() {
1093        for (gpus, ram) in [(parse_nvidia_smi("NVIDIA GeForce RTX 3060, 12288, 8.6, 615.78.08", 62 * GIB), 62), (Vec::new(), 62), (Vec::new(), 8)] {
1094            let hw = box_with(gpus, ram);
1095            let p = plan(&hw, budget(&hw, None, None));
1096            for e in [&p.main, &p.standin, &p.embedding].into_iter().flatten() {
1097                assert!(!e.transcribes() && !e.speaks(), "{} in a plan", e.id());
1098            }
1099        }
1100        let hw = box_with(Vec::new(), 62);
1101        assert_eq!(transcriber(&budget(&hw, None, None)).map(|e| e.spec.id), Some(VOXTRAL_MINI_3B.into()));
1102        assert_eq!(transcriber(&budget(&hw, Some(GIB), None)), None, "too small a budget");
1103        assert!(by_purpose(Purpose::Embedding).iter().all(|e| e.purpose == Purpose::Embedding));
1104    }
1105
1106    #[test]
1107    fn speak_is_a_purpose_of_its_own() {
1108        assert_eq!(serde_json::to_string(&Purpose::Speak).unwrap(), "\"speak\"");
1109        assert_eq!(Purpose::parse("speak"), Some(Purpose::Speak));
1110        assert_eq!(Purpose::Speak.to_string(), "speak");
1111        assert_eq!(Purpose::parse("tts"), None);
1112    }
1113
1114    #[test]
1115    fn the_catalog_has_cited_speech_models() {
1116        let ids: Vec<_> = by_purpose(Purpose::Speak).iter().map(|e| e.id().to_string()).collect();
1117        assert_eq!(
1118            ids,
1119            [
1120                QWEN3_TTS_0_6B_CUSTOMVOICE,
1121                QWEN3_TTS_0_6B_BASE,
1122                QWEN3_TTS_1_7B_CUSTOMVOICE,
1123                QWEN3_TTS_1_7B_VOICEDESIGN,
1124                QWEN3_TTS_1_7B_BASE,
1125                KOKORO_82M,
1126                VOXCPM2,
1127                FISH_AUDIO_DRAMA_3
1128            ]
1129        );
1130        let hex = |h: &Option<String>| h.as_deref().is_some_and(|h| h.len() == 64 && h.chars().all(|c| c.is_ascii_hexdigit()));
1131        for e in by_purpose(Purpose::Speak) {
1132            assert!(e.speaks() && !e.transcribes());
1133            assert!(hex(&e.spec.sha256), "{} pinned", e.id());
1134            let s = e.speech().unwrap_or_else(|| panic!("{} has a profile", e.id()));
1135            assert!(s.sample_rate.is_some() && !s.formats.is_empty() && s.languages.is_some(), "{}", e.id());
1136            assert!(e.license().is_some());
1137            if e.is_gguf() {
1138                let p = e.projector().unwrap_or_else(|| panic!("{} needs its projector", e.id()));
1139                assert!(hex(&p.sha256) && p.file.starts_with("mmproj-") && p.repo == e.spec.repo);
1140                assert_eq!(s.formats, [crate::speech::AudioFormat::Wav, crate::speech::AudioFormat::Pcm16], "llama-server's formats");
1141                assert!(e.footprint(1) > (e.spec.size + p.size) * 11 / 10);
1142            } else {
1143                assert!(e.projector().is_none());
1144                assert!(e.spec.repo.starts_with("Qwen/") && e.spec.file == "model.safetensors");
1145                assert!(e.footprint(1) > (e.spec.size + QWEN3_TTS_TOKENIZER_BYTES) * 11 / 10, "the speech tokenizer counts");
1146                assert!(s.formats.len() == 5 && s.speed, "vLLM-Omni's formats and speed");
1147            }
1148        }
1149        // Each Qwen3-TTS checkpoint does one thing.
1150        let q = |id| find(id).unwrap().speech().unwrap();
1151        assert_eq!(q(QWEN3_TTS_1_7B_CUSTOMVOICE).presets.as_ref().map(Vec::len), Some(9));
1152        assert!(q(QWEN3_TTS_1_7B_CUSTOMVOICE).instructions && !q(QWEN3_TTS_0_6B_CUSTOMVOICE).instructions);
1153        assert!(q(QWEN3_TTS_1_7B_VOICEDESIGN).design && q(QWEN3_TTS_1_7B_VOICEDESIGN).clone.is_none());
1154        assert_eq!(q(QWEN3_TTS_0_6B_BASE).clone, Some(CloneMode::AudioAndText));
1155        assert_eq!(q(QWEN3_TTS_1_7B_BASE).clone, Some(CloneMode::Audio), "ggml-org's projector has the speaker encoder only");
1156        let k = q(KOKORO_82M);
1157        assert_eq!((k.presets.as_ref().map(Vec::len), k.presets.as_ref().and_then(|p| p.first()).map(String::as_str)), (Some(54), Some("af_heart")));
1158        assert!(k.raw && k.speed);
1159        assert!(q(VOXCPM2).design && q(VOXCPM2).clone == Some(CloneMode::Audio));
1160        assert_eq!(q(VOXCPM2).languages.map(|l| l.len()), Some(30));
1161        let d = q(FISH_AUDIO_DRAMA_3);
1162        assert_eq!((d.script_speakers, d.clone, d.sample_rate), (Some(16), None, Some(44_100)));
1163        assert_eq!(d.languages.map(|l| l.len()), Some(83));
1164        // Only Drama 3 is restricted, and its profile names the license.
1165        let drama = find(FISH_AUDIO_DRAMA_3).unwrap();
1166        assert!(drama.restricted() && drama.license() == Some(crate::speech::FISH_AUDIO_COMMUNITY));
1167        assert_eq!(d.license.as_deref(), Some(crate::speech::FISH_AUDIO_COMMUNITY));
1168        assert_eq!(catalog().iter().filter(|e| e.restricted()).count(), 1);
1169        assert!(catalog().iter().filter(|e| !e.speaks()).all(|e| e.speech().is_none()));
1170    }
1171
1172    #[test]
1173    fn a_speaker_that_fits_and_never_a_restricted_one() {
1174        let b = |usable_bytes| Budget { pool_bytes: usable_bytes, reserve_bytes: 0, usable_bytes };
1175        assert_eq!(speaker(&b(128 * GIB)).map(|e| e.spec.id), Some(VOXCPM2.into()), "never Drama 3, however big");
1176        assert_eq!(speaker(&b(GIB * 7 / 2)).map(|e| e.spec.id), Some(QWEN3_TTS_1_7B_BASE.into()));
1177        assert_eq!(speaker(&b(GIB)).map(|e| e.spec.id), Some(KOKORO_82M.into()));
1178        assert_eq!(speaker(&b(100 << 20)), None);
1179        assert!(by_purpose(Purpose::Speak).iter().all(|e| e.footprint(1) > 0));
1180    }
1181
1182    #[test]
1183    fn downloads_under_a_restricted_license() {
1184        let drama = find(FISH_AUDIO_DRAMA_3).unwrap();
1185        let lic = Some(crate::speech::FISH_AUDIO_COMMUNITY);
1186        assert_eq!(restricted_license(&drama.spec), lic);
1187        assert_eq!(restricted_license(&drama.projector().unwrap()), lic);
1188        // A hand-built spec from the same repos, under any id.
1189        let mut other = drama.spec.clone();
1190        other.id = "my-drama".into();
1191        other.file = "drama-3-Q8_0.gguf".into();
1192        assert_eq!(restricted_license(&other), lic);
1193        other.repo = "FishAudio/Drama-3".into();
1194        assert_eq!(restricted_license(&other), lic);
1195        for e in catalog().iter().filter(|e| e.spec.id != FISH_AUDIO_DRAMA_3) {
1196            assert_eq!(restricted_license(&e.spec), None, "{}", e.id());
1197        }
1198    }
1199
1200    fn is_sha256(h: &Option<String>) -> bool {
1201        h.as_deref().is_some_and(|h| h.len() == 64 && h.chars().all(|c| c.is_ascii_hexdigit() && !c.is_ascii_uppercase()))
1202    }
1203
1204    #[test]
1205    fn caveling_is_a_pinned_chat_model_with_a_vision_projector() {
1206        let e = find(CAVELING_2_MINI).expect("in the catalog");
1207        assert_eq!((e.purpose, e.quant.as_str(), e.params_b, e.active_params_b), (Purpose::Chat, "Q4_K_M", 26.0, 3.4));
1208        assert!(e.is_gguf() && !e.speaks() && !e.transcribes() && !e.restricted() && !e.gated() && !e.is_sharded());
1209        assert_eq!(e.spec.repo, "caveman-so/caveling-2-mini-GGUF");
1210        // The Q4_K_M file, never the repo's NVFP4 file, its draft model or its importance matrix.
1211        assert_eq!((e.spec.file.as_str(), e.spec.size), ("Caveling-2-Mini-Q4_K_M.gguf", 18_398_579_616));
1212        assert!(!e.spec.file.to_ascii_lowercase().contains("dspark") && !e.spec.file.starts_with("imatrix"));
1213        assert!(is_sha256(&e.spec.sha256));
1214        let p = e.projector().expect("vision encoder");
1215        assert_eq!((p.repo.as_str(), p.file.as_str(), p.size), (e.spec.repo.as_str(), "mmproj-Caveling-2-Mini-Q8_0.gguf", 345_911_360));
1216        assert!(is_sha256(&p.sha256));
1217        assert_eq!(e.license(), Some("apache-2.0"));
1218        assert_eq!(e.revision(), Some("ec4b4b4114cf8375abc1cf42d6c41971b778e2ba"));
1219        // llama-server's own arguments, the context and layers it runs with.
1220        assert_eq!(e.engine_args(), ["-fa", "on", "--jinja"]);
1221        assert_eq!((e.launch_context(), e.launch_gpu_layers()), (Some(346_112), Some(99)));
1222        assert_eq!(e.context, 346_112);
1223        // 4 full-attention layers x 8 KV heads x (128 + 128) x 2 bytes, over the whole context.
1224        assert_eq!(e.kv_bytes_per_token, 4 * 8 * 256 * 2);
1225        let kv = e.kv_bytes_per_token * 346_112;
1226        let want = (e.spec.size + p.size + kv) * 11 / 10;
1227        assert!(e.footprint(1).abs_diff(want) < 16, "{} vs {want}", e.footprint(1));
1228        // The entries from before carry no launch values.
1229        let gemma = find(crate::catalog::GEMMA_4_E4B).unwrap();
1230        assert!(
1231            gemma.engine_args().is_empty() && gemma.launch_context().is_none() && gemma.launch_gpu_layers().is_none() && gemma.revision().is_none()
1232        );
1233    }
1234
1235    #[test]
1236    fn caveling_never_changes_what_a_plan_picks() {
1237        // Not on a CPU box with plenty of memory, nor on a big GPU: a bigger model fits first.
1238        for (gpus, ram) in [(Vec::new(), 62), (Vec::new(), 256), (parse_nvidia_smi("NVIDIA GB10, [N/A], 12.1, 580.95.05", 128 * GIB), 128)] {
1239            let hw = box_with(gpus, ram);
1240            let p = plan(&hw, budget(&hw, None, None));
1241            assert_ne!(p.main.unwrap().id(), CAVELING_2_MINI);
1242        }
1243    }
1244
1245    #[test]
1246    fn the_vllm_transcribers_are_pinned_from_the_hub() {
1247        let want = [
1248            (QWEN3_ASR_1_7B, "Qwen/Qwen3-ASR-1.7B", "apache-2.0", 2, 4_220_320_824 + 478_200_688, "7278e1e70fe206f11671096ffdd38061171dd6e5"),
1249            (WHISPER_LARGE_V3_TURBO, "openai/whisper-large-v3-turbo", "mit", 1, 1_617_824_864, "41f01f3fe87f28c78e2fbf8b568835947dd65ed9"),
1250            (
1251                COHERE_TRANSCRIBE_03_2026,
1252                "CohereLabs/cohere-transcribe-03-2026",
1253                "apache-2.0",
1254                1,
1255                4_131_862_976,
1256                "d552dadc2922ba6f6c1f994f8db904d52dcaf942",
1257            ),
1258        ];
1259        for (id, repo, license, shards, bytes, rev) in want {
1260            let e = find(id).unwrap_or_else(|| panic!("{id} in the catalog"));
1261            assert_eq!((e.purpose, e.is_gguf(), e.spec.repo.as_str(), e.license()), (Purpose::Transcribe, false, repo, Some(license)), "{id}");
1262            assert!(e.transcribes() && !e.restricted() && e.projector().is_none(), "{id}");
1263            assert_eq!((e.files().len(), e.weights_bytes(), e.revision()), (shards, bytes, Some(rev)), "{id}");
1264            assert!(e.files().iter().all(|f| is_sha256(&f.sha256) && f.id == id && f.repo == repo), "{id}");
1265            assert_eq!(e.files()[0], e.spec, "{id}: the first file is the spec");
1266            // Weights and KV, plus 10% for buffers.
1267            let kv = e.kv_bytes_per_token * e.context as u64;
1268            assert!(e.footprint(1).abs_diff((bytes + kv) * 11 / 10) < 16, "{id}");
1269        }
1270    }
1271
1272    #[test]
1273    fn a_sharded_entry_lists_every_shard_with_its_own_hash() {
1274        let e = find(QWEN3_ASR_1_7B).unwrap();
1275        assert!(e.is_sharded());
1276        let files = e.files();
1277        let names: Vec<_> = files.iter().map(|f| f.file.as_str()).collect();
1278        assert_eq!(names, ["model-00001-of-00002.safetensors", "model-00002-of-00002.safetensors"]);
1279        assert_eq!(files[0].sha256.as_deref(), Some("a4cd1f1a04d90b757dc7f7dd26254e69a013b19e80efe590a83c6a3bde8608d6"));
1280        assert_eq!(files[1].sha256.as_deref(), Some("6e0b9d9e09e2e0238e7ef3cc8a484ab387e91b90f1900bedf88bc92d7929ccfc"));
1281        assert_ne!(files[0].sha256, files[1].sha256);
1282        assert_eq!(files.iter().map(|f| f.size).sum::<u64>(), e.weights_bytes());
1283        assert_eq!(files[1].size, 478_200_688);
1284        // One consent covers every shard (the id is the entry's), and the store keeps them apart.
1285        let consent = crate::Consent::given(&e.spec);
1286        let store = crate::ModelStore::new(std::path::Path::new("/nonexistent-store"));
1287        for f in &files {
1288            assert_eq!(f.id, e.spec.id);
1289            assert_eq!(crate::Consent::given(f), consent);
1290        }
1291        assert_ne!(store.path(&files[0]), store.path(&files[1]));
1292        // Every other entry is one file, and weights_bytes is the spec's size.
1293        for o in catalog().iter().filter(|o| o.id() != QWEN3_ASR_1_7B) {
1294            assert!(!o.is_sharded(), "{}", o.id());
1295            assert_eq!(o.files(), vec![o.spec.clone()], "{}", o.id());
1296            assert_eq!(o.weights_bytes(), o.spec.size, "{}", o.id());
1297        }
1298    }
1299
1300    #[test]
1301    fn engine_args_are_separate_per_entry() {
1302        let args = |id| find(id).unwrap().engine_args();
1303        assert_eq!(args(COHERE_TRANSCRIBE_03_2026), ["--trust-remote-code"]);
1304        assert!(args(QWEN3_ASR_1_7B).is_empty() && args(WHISPER_LARGE_V3_TURBO).is_empty() && args(VOXTRAL_MINI_3B).is_empty());
1305        let with: Vec<_> = catalog().into_iter().filter(|e| !e.engine_args().is_empty()).map(|e| e.id().to_string()).collect();
1306        assert_eq!(with, [CAVELING_2_MINI, COHERE_TRANSCRIBE_03_2026]);
1307    }
1308
1309    #[test]
1310    fn only_cohere_is_gated_and_nothing_here_is_restricted() {
1311        let gated_ids: Vec<_> = catalog().into_iter().filter(|e| e.gated()).map(|e| e.id().to_string()).collect();
1312        assert_eq!(gated_ids, [COHERE_TRANSCRIBE_03_2026]);
1313        let cohere = find(COHERE_TRANSCRIBE_03_2026).unwrap();
1314        assert!(gated(&cohere.spec));
1315        let other_file = ModelSpec { id: "x".into(), file: "tokenizer.model".into(), ..cohere.spec.clone() };
1316        assert!(gated(&other_file), "another file of the gated repo");
1317        assert!(!gated(&find(WHISPER_LARGE_V3_TURBO).unwrap().spec));
1318        for id in [CAVELING_2_MINI, QWEN3_ASR_1_7B, WHISPER_LARGE_V3_TURBO, COHERE_TRANSCRIBE_03_2026] {
1319            assert!(!find(id).unwrap().restricted(), "{id}");
1320            assert_eq!(restricted_license(&find(id).unwrap().spec), None, "{id}");
1321        }
1322    }
1323
1324    #[test]
1325    fn the_transcriber_stays_a_gguf_llama_cpp_runs() {
1326        for gib in [4, 8, 16, 62, 256] {
1327            let hw = box_with(Vec::new(), gib);
1328            let t = transcriber(&budget(&hw, None, None));
1329            if let Some(t) = t {
1330                assert!(t.is_gguf() && t.id() == VOXTRAL_MINI_3B, "{gib} GiB: {}", t.id());
1331            }
1332        }
1333        // A budget that holds Whisper but not Voxtral gets none: llama.cpp cannot run it.
1334        let small = find(VOXTRAL_MINI_3B).unwrap().footprint(1) - 1;
1335        let budget = Budget { pool_bytes: small, reserve_bytes: 0, usable_bytes: small };
1336        assert!(find(WHISPER_LARGE_V3_TURBO).unwrap().footprint(1) <= small);
1337        assert_eq!(transcriber(&budget), None);
1338        assert_eq!(by_purpose(Purpose::Transcribe).len(), 4);
1339    }
1340}