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),
|
||||
|
||||
@ -1373,6 +1373,7 @@ button.icon{display:inline-flex;align-items:center;justify-content:center;paddin
|
||||
.dlg-kopf{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1rem 1.3rem .4rem}.dlg-kopf h2{margin:0;font-size:1.15rem;overflow-wrap:anywhere}
|
||||
.dlg-kopf button{font-size:1.1rem;line-height:1;padding:.2rem .6rem}
|
||||
.dlg-daten{padding:.4rem 1.3rem .9rem;border-bottom:1px solid var(--border)}
|
||||
.modellkopf{padding:.2rem 1.3rem .6rem;border-bottom:1px solid var(--border)}.modellkopf h3{font-size:.95rem;margin:.6rem 0 .5rem}.modellkopf dl.daten{padding:0 0 .6rem}.modellkopf p{margin:.3rem 0}.passung-hinweise{margin:.2rem 0 .4rem;padding-left:1.2rem}
|
||||
.dlg-form{display:flex;flex-direction:column;gap:1rem;padding:1rem 1.3rem}
|
||||
.feld{display:flex;flex-direction:column;gap:.3rem}.feld .titel{font-weight:600;font-size:.9rem}.feld input{width:100%}
|
||||
.hilfe{color:var(--muted);font-size:.8rem;line-height:1.4}
|
||||
|
||||
@ -101,7 +101,15 @@ fn register_dialog(
|
||||
Some(k) => {
|
||||
let mut k = crate::modellkopf::aus_kopf(k, a.mmproj.as_deref(), 1);
|
||||
k.stand = Some(1);
|
||||
crate::modellkopf::block_html(&k, a.size_bytes, None, &[0], gesamt, None)
|
||||
crate::modellkopf::block_html(
|
||||
&k,
|
||||
a.size_bytes,
|
||||
None,
|
||||
&[0],
|
||||
gesamt,
|
||||
None,
|
||||
a.quantization.as_deref(),
|
||||
)
|
||||
}
|
||||
None => String::new(),
|
||||
};
|
||||
|
||||
@ -486,6 +486,7 @@ fn modellkopf_block(state: &AppState, m: &ModelRow) -> String {
|
||||
&gpus,
|
||||
&gesamt,
|
||||
m.measured_mb,
|
||||
m.quantization.as_deref(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user