1use crate::ModelSpec;
4use crate::speech::{self, CloneMode, SpeechProfile};
5use serde::{Deserialize, Serialize};
6
7use super::{Accel, GIB, Hardware};
8
9#[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 Transcribe,
20 Speak,
24}
25
26impl Purpose {
27 pub const ALL: [Purpose; 4] = [Purpose::Chat, Purpose::Embedding, Purpose::Transcribe, Purpose::Speak];
29
30 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 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
52pub const VOXTRAL_MINI_3B: &str = "voxtral-mini-3b";
55
56pub const QWEN3_TTS_0_6B_CUSTOMVOICE: &str = "qwen3-tts-0.6b-customvoice";
61pub const QWEN3_TTS_0_6B_BASE: &str = "qwen3-tts-0.6b-base";
63pub const QWEN3_TTS_1_7B_CUSTOMVOICE: &str = "qwen3-tts-1.7b-customvoice";
65pub const QWEN3_TTS_1_7B_VOICEDESIGN: &str = "qwen3-tts-1.7b-voicedesign";
67pub const QWEN3_TTS_1_7B_BASE: &str = "qwen3-tts-1.7b-base";
69pub const KOKORO_82M: &str = "kokoro-82m";
71pub const VOXCPM2: &str = "voxcpm2";
73pub const FISH_AUDIO_DRAMA_3: &str = "fish-audio-drama-3";
78
79pub const CAVELING_2_MINI: &str = "caveling-2-mini";
83
84pub const QWEN3_ASR_1_7B: &str = "qwen3-asr-1.7b";
89pub const WHISPER_LARGE_V3_TURBO: &str = "whisper-large-v3-turbo";
92pub const COHERE_TRANSCRIBE_03_2026: &str = "cohere-transcribe-03-2026";
96
97const CAVELING_CONTEXT: u32 = 346_112;
100
101const QWEN3_TTS_TOKENIZER_BYTES: u64 = 682_293_092;
104const DRAMA_3_UPSTREAM: &str = "fishaudio/drama-3";
106
107type Shard = (&'static str, u64, &'static str);
109
110fn 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#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
120pub struct CatalogEntry {
121 pub spec: ModelSpec,
122 pub purpose: Purpose,
123 pub quant: String,
124 pub params_b: f32,
126 pub active_params_b: f32,
127 pub kv_bytes_per_token: u64,
129 pub context: u32,
131}
132
133impl CatalogEntry {
134 pub fn id(&self) -> &str {
135 &self.spec.id
136 }
137
138 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 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 pub fn is_sharded(&self) -> bool {
189 !later_shards(&self.spec.id).is_empty()
190 }
191
192 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 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 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 pub fn launch_context(&self) -> Option<u32> {
242 (self.spec.id == CAVELING_2_MINI).then_some(CAVELING_CONTEXT)
243 }
244
245 pub fn launch_gpu_layers(&self) -> Option<u32> {
248 (self.spec.id == CAVELING_2_MINI).then_some(99)
249 }
250
251 pub fn gated(&self) -> bool {
256 self.spec.id == COHERE_TRANSCRIBE_03_2026
257 }
258
259 pub fn is_gguf(&self) -> bool {
264 self.spec.file.to_ascii_lowercase().ends_with(".gguf")
265 }
266
267 pub fn speaks(&self) -> bool {
269 self.purpose == Purpose::Speak
270 }
271
272 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 pub fn restricted(&self) -> bool {
300 speech::restricting_license(self.license()).is_some()
301 }
302
303 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 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 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 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
444const QWEN3_TTS_SPEAKERS: [&str; 9] = ["vivian", "serena", "uncle_fu", "dylan", "eric", "ryan", "aiden", "ono_anna", "sohee"];
446
447const 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
507const 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
513const 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
521pub 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 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 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 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 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 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 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 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 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 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
882pub fn by_purpose(purpose: Purpose) -> Vec<CatalogEntry> {
884 catalog().into_iter().filter(|e| e.purpose == purpose).collect()
885}
886
887pub 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
900pub 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
911pub 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
928pub 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
935pub fn find(id: &str) -> Option<CatalogEntry> {
937 catalog().into_iter().find(|e| e.spec.id == id)
938}
939
940#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
942pub struct Budget {
943 pub pool_bytes: u64,
945 pub reserve_bytes: u64,
947 pub usable_bytes: u64,
948}
949
950pub 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#[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 pub slots: u32,
969 pub notes: Vec<String>,
970}
971
972pub 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 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 assert_eq!(v.kv_bytes_per_token, 30 * 8 * 256 * 2);
1080 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 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 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 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 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 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 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 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 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 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 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 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 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 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}