fix: discover bei Maya zählt den Modellordner über dem Pack (auf srv04 gemessen: 0,9 statt 71 GB)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 09:25:03 +01:00
parent ece2c657ae
commit 3c4bb805d3
2 changed files with 29 additions and 3 deletions

View File

@ -540,8 +540,8 @@ impl Engine for MayaEngine {
} }
/// Sucht Maya-Konfigurationen (`*.json` mit `exe` und `model_name`) direkt in /// Sucht Maya-Konfigurationen (`*.json` mit `exe` und `model_name`) direkt in
/// den Ordnern. Die Größe ist die des Modellordners (`--glm-pack`), falls er /// den Ordnern. Die Größe ist die des Modellordners, in dem der Pack
/// lesbar ist. Verändert nichts. /// (`--glm-pack`) liegt, falls er lesbar ist. Verändert nichts.
pub(crate) fn scan_configs(roots: &[PathBuf]) -> Vec<DiscoveredArtifact> { pub(crate) fn scan_configs(roots: &[PathBuf]) -> Vec<DiscoveredArtifact> {
let mut found = Vec::new(); let mut found = Vec::new();
for root in roots { for root in roots {
@ -577,7 +577,14 @@ pub(crate) fn scan_configs(roots: &[PathBuf]) -> Vec<DiscoveredArtifact> {
name: name.to_string(), name: name.to_string(),
path, path,
quantization, quantization,
size_bytes: pack.map(|p| dir_size(&p, 0)).unwrap_or(0), // Gemessen auf srv04: Der Pack enthält nur den dichten Teil
// (0,9 GB), die Experten liegen in den GGUF-Dateien des
// Modellordners darüber (zusammen 71 GB). Gezählt wird deshalb
// der Modellordner.
size_bytes: pack
.as_deref()
.map(|p| dir_size(p.parent().unwrap_or(p), 0))
.unwrap_or(0),
}); });
} }
} }

View File

@ -264,3 +264,22 @@ async fn discover_findet_die_konfiguration() {
assert_eq!(found[0].quantization.as_deref(), Some("IQ1_S")); assert_eq!(found[0].quantization.as_deref(), Some("IQ1_S"));
assert_eq!(found[0].path, f.maya_config); assert_eq!(found[0].path, f.maya_config);
} }
#[tokio::test]
async fn discover_zaehlt_den_modellordner_ueber_dem_pack() {
let f = fixture("ok", 5);
let modell = f.dir.join("modell");
std::fs::create_dir_all(modell.join("pack")).unwrap();
std::fs::write(modell.join("pack/dense.bin"), vec![0u8; 100]).unwrap();
std::fs::write(modell.join("experten-00001-of-00002.gguf"), vec![0u8; 1000]).unwrap();
std::fs::write(
f.dir.join("maya-test.json"),
format!(
r#"{{"exe":"/x","args":["--glm-pack","{}"],"model_name":"fake-maya"}}"#,
modell.join("pack").display()
),
)
.unwrap();
let found = MayaEngine::new(f.config.clone()).discover().await.unwrap();
assert_eq!(found[0].size_bytes, 1100);
}