feat: Quantisierung und Vision-Projektor aus der Datei, Passungsblock mit Abstand, Browserprüfung (#1233, #1234)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -57,9 +57,9 @@ fn jetzt() -> i64 {
|
||||
.unwrap_or(0)
|
||||
}
|
||||
|
||||
/// Sucht den Vision-Projektor im Ordner der Modelldatei (der erste nach Name).
|
||||
/// Sucht den Vision-Projektor im Ordner der Modelldatei (der passendste nach Name).
|
||||
fn mmproj_neben(pfad: &std::path::Path) -> Option<std::path::PathBuf> {
|
||||
let mut gefunden: Vec<std::path::PathBuf> = std::fs::read_dir(pfad.parent()?)
|
||||
let kandidaten: Vec<std::path::PathBuf> = std::fs::read_dir(pfad.parent()?)
|
||||
.ok()?
|
||||
.flatten()
|
||||
.map(|e| e.path())
|
||||
@ -67,11 +67,11 @@ fn mmproj_neben(pfad: &std::path::Path) -> Option<std::path::PathBuf> {
|
||||
p.extension().is_some_and(|e| e == "gguf")
|
||||
&& p.file_stem()
|
||||
.and_then(|s| s.to_str())
|
||||
.is_some_and(|s| s.to_lowercase().starts_with("mmproj"))
|
||||
.is_some_and(nexus_adapter::gguf::ist_mmproj)
|
||||
})
|
||||
.collect();
|
||||
gefunden.sort();
|
||||
gefunden.into_iter().next()
|
||||
let stem = pfad.file_stem()?.to_str()?;
|
||||
nexus_adapter::gguf::bester_mmproj(stem, &kandidaten).cloned()
|
||||
}
|
||||
|
||||
/// Liest beim Start den Kopf aller llama.cpp-Modelle, die noch keinen haben, und speichert ihn.
|
||||
@ -99,6 +99,19 @@ pub async fn kopf_nachlesen(state: &AppState) -> usize {
|
||||
}
|
||||
Err(e) => aus_fehler(&e, jetzt()),
|
||||
};
|
||||
// Fehlt die Quantisierung in der Registry, gilt die Datei, sonst der Dateiname.
|
||||
let quant = k
|
||||
.dateityp
|
||||
.and_then(nexus_adapter::gguf::dateityp_name)
|
||||
.map(str::to_string)
|
||||
.or_else(|| {
|
||||
pfad.file_stem()
|
||||
.and_then(|s| s.to_str())
|
||||
.and_then(nexus_adapter::parse_quantization)
|
||||
});
|
||||
if let Some(q) = quant {
|
||||
let _ = state.store().set_quantisierung_wenn_leer(&modell, &q);
|
||||
}
|
||||
if state
|
||||
.store()
|
||||
.set_artifact_kopf(&modell, &k)
|
||||
@ -317,6 +330,7 @@ pub fn block_html(
|
||||
gpus: &[u32],
|
||||
gesamt: &[(u32, u64)],
|
||||
gemessen_mb: Option<i64>,
|
||||
quantisierung_name: Option<&str>,
|
||||
) -> String {
|
||||
use crate::ui::esc;
|
||||
if let Some(f) = &k.fehler {
|
||||
@ -330,10 +344,15 @@ pub fn block_html(
|
||||
.to_string();
|
||||
}
|
||||
let zahl = |v: Option<u32>| v.map_or("–".to_string(), |v| v.to_string());
|
||||
let quant = k
|
||||
.dateityp
|
||||
.and_then(nexus_adapter::gguf::dateityp_name)
|
||||
.map_or("–".to_string(), str::to_string);
|
||||
// Die Datei hat Vorrang; fehlt `general.file_type` (bei neu quantisierten Dateien häufig), gilt der Name.
|
||||
let quant = match (
|
||||
k.dateityp.and_then(nexus_adapter::gguf::dateityp_name),
|
||||
quantisierung_name,
|
||||
) {
|
||||
(Some(q), _) => format!("{q} (aus der Datei)"),
|
||||
(None, Some(q)) => format!("{q} (aus dem Dateinamen, die Datei nennt keine)"),
|
||||
(None, None) => "–".to_string(),
|
||||
};
|
||||
let mut feld = String::new();
|
||||
let mut f = |titel: &str, wert: String| {
|
||||
feld.push_str(&format!(
|
||||
@ -345,7 +364,7 @@ pub fn block_html(
|
||||
"Architektur",
|
||||
k.architektur.clone().unwrap_or_else(|| "–".into()),
|
||||
);
|
||||
f("Quantisierung (aus der Datei)", quant);
|
||||
f("Quantisierung", quant);
|
||||
f(
|
||||
"Trainierter Kontext",
|
||||
k.kontext.map_or("–".into(), |c| format!("{c} Tokens")),
|
||||
@ -379,7 +398,7 @@ pub fn block_html(
|
||||
None => "noch nicht gemessen".to_string(),
|
||||
};
|
||||
format!(
|
||||
"<div class=\"modellkopf\"><h3>Aus der Modelldatei</h3><dl class=\"daten dlg-daten\">{feld}</dl>\
|
||||
"<div class=\"modellkopf\"><h3>Aus der Modelldatei</h3><dl class=\"daten\">{feld}</dl>\
|
||||
<p class=\"passung\">{zeile}{chip}</p><p class=\"hilfe\">{messung}</p>\
|
||||
<ul class=\"hilfe passung-hinweise\">{hinweise}</ul></div>",
|
||||
zeile = esc(&a.zeile),
|
||||
|
||||
Reference in New Issue
Block a user