Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(models): a downloaded model lands in the folder its header names (A27, #234)

purple8d6fe9e99d05
diff --git a/src-tauri/src/commands/download.rs b/src-tauri/src/commands/download.rs
index 465c7c63..ee7ec620 100644
--- a/src-tauri/src/commands/download.rs
+++ b/src-tauri/src/commands/download.rs
@@ -835,7 +835,33 @@ pub async fn comfy_model_info(
let file = hits
.first()
.ok_or_else(|| format!("{} was not found in the ComfyUI models folders", filename))?;
- Ok(file_facts(file, own_folder, hits.len()))
+ let mut facts = file_facts(file, own_folder, hits.len());
+ // A27: a file in the wrong main model folder is named, never moved.
+ let found_in = main_folder_of(file);
+ let path = file.clone();
+ let belongs = match found_in {
+ Some(f) => tauri::async_runtime::spawn_blocking(move || crate::commands::model_sniff::belongs_elsewhere(&path, f))
+ .await
+ .ok()
+ .flatten(),
+ None => None,
+ };
+ if let (Some(target), Some(obj)) = (belongs, facts.as_object_mut()) {
+ obj.insert("belongsIn".into(), serde_json::json!(target));
+ obj.insert("foundIn".into(), serde_json::json!(found_in));
+ }
+ Ok(facts)
+}
+
+/// The main model folder (checkpoints, diffusion_models or unet) a file sits
+/// in, also below a subfolder of it (`checkpoints/flux/x.safetensors`).
+pub(crate) fn main_folder_of(file: &Path) -> Option<&'static str> {
+ file.ancestors().skip(1).find_map(|d| match d.file_name()?.to_str()? {
+ "checkpoints" => Some("checkpoints"),
+ "diffusion_models" => Some("diffusion_models"),
+ "unet" => Some("unet"),
+ _ => None,
+ })
}
/// C41: show a ComfyUI model file (a LoRA, a checkpoint) in the file
@@ -1178,6 +1204,53 @@ mod chat_download_tests {
}
}
+/// A27: the directories the header may send a main model file to, for a
+/// download whose folder came from a title. None for any other folder (a
+/// LoRA, a VAE, an upscaler: their search type says what they are) and for
+/// a ComfyUI on another machine, whose files LU does not read back.
+async fn header_folder_dirs(
+ state: &State<'_, AppState>,
+ comfy_path: &Option<String>,
+ subfolder: &str,
+) -> Option<HashMap<String, PathBuf>> {
+ if !["checkpoints", "diffusion_models", "unet"].contains(&subfolder) || remote_comfy(state).is_some() {
+ return None;
+ }
+ let mut dirs = HashMap::new();
+ for key in crate::commands::model_sniff::HEADER_FOLDERS {
+ if let Ok(d) = comfy_models_dir(state, comfy_path, key).await {
+ dirs.insert(key.to_string(), d);
+ }
+ }
+ Some(dirs)
+}
+
+/// A27: the file of this name in another main model folder, where an earlier
+/// download of it was moved by its header.
+fn already_settled(dirs: &HashMap<String, PathBuf>, subfolder: &str, dest_file: &Path) -> Option<PathBuf> {
+ let name = dest_file.file_name()?;
+ dirs.iter()
+ .filter(|(k, _)| k.as_str() != subfolder)
+ .map(|(_, d)| d.join(name))
+ .find(|p| p.is_file() && !p.with_extension("download").exists())
+}
+
+/// A27: after a finished transfer, move the file to the folder its header
+/// names. The new path when it moved.
+async fn settle_finished(dest_file: &Path, subfolder: &str, dirs: Option<HashMap<String, PathBuf>>) -> Option<PathBuf> {
+ let dirs = dirs?;
+ let file = dest_file.to_path_buf();
+ let guessed = subfolder.to_string();
+ let moved = tauri::async_runtime::spawn_blocking(move || {
+ crate::commands::model_sniff::settle_by_header(&file, &guessed, &dirs)
+ })
+ .await
+ .ok()
+ .flatten()?;
+ println!("[Download] {} is a {} file by its header, moved to {}", dest_file.display(), moved.0, moved.1.display());
+ Some(moved.1)
+}
+
// Eight arguments since C60's chatOrigin; a Tauri command takes them flat
// from the frontend's object, so they stay arguments.
#[allow(non_snake_case, clippy::too_many_arguments)]
@@ -1197,6 +1270,11 @@ pub async fn download_model(
// .safetensors or .gguf file, only a model folder of ComfyUI; checked here
// and not only in the frontend, which a prompt-injected run could reach.
chatOrigin: Option<bool>,
+ // A27 (3.1.0, GitHub #234): the folder was picked from a title (the
+ // CivitAI search, a chat link), not from a catalog. Then the header of
+ // the finished file decides between checkpoints, diffusion_models, vae
+ // and text_encoders, and the file moves there (`settle_by_header`).
+ sniffFolder: Option<bool>,
state: State<'_, AppState>,
) -> Result<serde_json::Value, String> {
if chatOrigin == Some(true) {
@@ -1217,12 +1295,19 @@ pub async fn download_model(
let dest_dir = comfy_models_dir(&state, &comfy_path, &subfolder).await?;
let dest_file = dest_dir.join(sanitize_filename(&filename));
+ let header_dirs = if sniffFolder == Some(true) { header_folder_dirs(&state, &comfy_path, &subfolder).await } else { None };
let expected_sha256 = match expectedSha256.as_deref() {
Some(s) => Some(normalize_sha256(s)?),
None => None,
};
+ // A27: an earlier download of this file was moved by its header. It is
+ // there, complete (a finished transfer only gets its name at the end).
+ if let Some(found) = header_dirs.as_ref().and_then(|d| already_settled(d, &subfolder, &dest_file)) {
+ return Ok(serde_json::json!({"status": "exists", "path": found.to_string_lossy()}));
+ }
+
if dest_file.exists() {
let actual = dest_file.metadata().map(|m| m.len()).unwrap_or(0);
// Ask the SERVER how big the file is. The catalog's `expectedBytes` is a
@@ -1293,9 +1378,13 @@ pub async fn download_model(
match do_download(&url, &dest_file, &downloads_arc, &id_clone, token, resume_offset,
CatalogClaims { expected_bytes, expected_sha256, auth_token }).await {
Ok(_) => {
+ let moved = settle_finished(&dest_file, &subfolder, header_dirs).await;
if let Ok(mut dl) = downloads_arc.lock() {
if let Some(p) = dl.get_mut(&id_clone) {
p.status = "complete".to_string();
+ if let Some(path) = &moved {
+ p.dest = path.to_string_lossy().into_owned();
+ }
}
}
println!("[Download] Complete: {}", filename_clone);
@@ -2717,6 +2806,7 @@ pub fn delete_orphan_download(
// the same name, and one name can carry only one command macro.
#[cfg_attr(desktop, tauri::command)]
#[cfg_attr(mobile, allow(dead_code))]
+#[allow(clippy::too_many_arguments)]
pub async fn resume_download(
id: String,
url: String,
@@ -2724,6 +2814,8 @@ pub async fn resume_download(
expectedBytes: Option<u64>,
expectedSha256: Option<String>,
authToken: Option<String>,
+ // A27: as in `download_model`.
+ sniffFolder: Option<bool>,
state: State<'_, AppState>,
) -> Result<serde_json::Value, String> {
let expected_bytes = expectedBytes;
@@ -2739,6 +2831,7 @@ pub async fn resume_download(
let dest_dir = comfy_models_dir(&state, &comfy_path, &subfolder).await?;
let dest_file = dest_dir.join(&id);
+ let header_dirs = if sniffFolder == Some(true) { header_folder_dirs(&state, &comfy_path, &subfolder).await } else { None };
let tmp_path = dest_file.with_extension("download");
let resume_offset = if tmp_path.exists() {
@@ -2780,9 +2873,13 @@ pub async fn resume_download(
match do_download(&url, &dest_file, &downloads_arc, &id_clone, token, resume_offset,
CatalogClaims { expected_bytes, expected_sha256, auth_token }).await {
Ok(_) => {
+ let moved = settle_finished(&dest_file, &subfolder, header_dirs).await;
if let Ok(mut dl) = downloads_arc.lock() {
if let Some(p) = dl.get_mut(&id_clone) {
p.status = "complete".to_string();
+ if let Some(path) = &moved {
+ p.dest = path.to_string_lossy().into_owned();
+ }
}
}
println!("[Download] Complete: {}", id_clone);
diff --git a/src-tauri/src/commands/model_sniff.rs b/src-tauri/src/commands/model_sniff.rs
index e2532029..26a209e7 100644
--- a/src-tauri/src/commands/model_sniff.rs
+++ b/src-tauri/src/commands/model_sniff.rs
@@ -146,6 +146,13 @@ pub fn classify<'a>(tensors: impl IntoIterator<Item = (&'a str, Option<&'a [u64]
/// Read and classify one file's header. None when it is not a readable
/// safetensors file.
pub fn sniff_file(path: &Path) -> Option<Sniff> {
+ let shapes = header_tensors(path)?;
+ Some(classify(shapes.iter().map(|(k, s)| (k.as_str(), s.as_deref()))))
+}
+
+/// The tensor names and shapes of a safetensors header. None when the file
+/// is not one.
+fn header_tensors(path: &Path) -> Option<Vec<(String, Option<Vec<u64>>)>> {
let mut f = File::open(path).ok()?;
let total = f.metadata().ok()?.len();
let mut len = [0u8; 8];
@@ -164,7 +171,135 @@ pub fn sniff_file(path: &Path) -> Option<Sniff> {
(k.clone(), shape)
})
.collect();
- Some(classify(shapes.iter().map(|(k, s)| (k.as_str(), s.as_deref()))))
+ Some(shapes)
+}
+
+// ── A27: which models folder a file belongs in ─────────────────────────────
+//
+// GitHub #234 (Kubuntu, RTX 5090): diffusion and video models downloaded
+// through the CivitAI search landed in models/checkpoints. The folder came
+// from the title alone (flux, wan, hunyuan, .gguf); LTX, MiniMax H3,
+// Qwen-Image, Z-Image, Chroma, Krea, Mochi, CogVideoX and every Wan offshoot
+// without "wan" in its title went to checkpoints, where ComfyUI's
+// CheckpointLoaderSimple cannot load a bare diffusion model. The header says
+// which it is.
+
+/// The ComfyUI folders a header can send a file to.
+pub const HEADER_FOLDERS: &[&str] = &["checkpoints", "diffusion_models", "vae", "text_encoders"];
+
+/// The folder a file with these tensors belongs in, or None when the header
+/// does not say (a LoRA, an unknown layout): then the caller keeps its own
+/// guess. Pure, so the tests can feed it real headers.
+///
+/// * a bare VAE → vae, a bare text encoder → text_encoders;
+/// * a diffusion model that carries its own VAE → checkpoints, the one
+/// folder CheckpointLoaderSimple reads (SD 1.5, SDXL, the FLUX all-in-one,
+/// LTX-Video, which ComfyUI loads as a checkpoint);
+/// * a diffusion model without one → diffusion_models (UNETLoader).
+pub fn folder_for_tensors<'a>(tensors: &[(&'a str, Option<&'a [u64]>)]) -> Option<&'static str> {
+ // A LoRA names the blocks it changes, which would read as their model:
+ // kohya (`lora_unet_…`), diffusers (`….lora_A.weight`), XLabs
+ // (`….proj_lora1.down.weight`), LyCORIS (`lokr_`, `hada_`).
+ let lora = tensors.iter().any(|(k, _)| {
+ let k = k.to_ascii_lowercase();
+ k.contains("lora") || k.contains("lokr_") || k.contains("hada_w") || k.contains("lycoris")
+ });
+ if lora {
+ return None;
+ }
+ let sniff = classify(tensors.iter().copied());
+ let diffusion = match sniff.arch.as_deref() {
+ Some("vae") => return Some("vae"),
+ Some("text_encoder") => return Some("text_encoders"),
+ Some(_) => true,
+ None => video_layout(tensors),
+ };
+ if !diffusion {
+ return None;
+ }
+ Some(if sniff.has_vae { "checkpoints" } else { "diffusion_models" })
+}
+
+/// The video families `classify` leaves unnamed, because LU has no pipeline
+/// of its own keyed on them. Layouts read off real headers on 14.11.2026:
+/// LTX-Video 0.9.5 and 0.9.7 (Lightricks), Mochi and HunyuanVideo (the
+/// Comfy-Org repacks, Hunyuan under `model.model.`), CogVideoX (THUDM).
+fn video_layout(tensors: &[(&str, Option<&[u64]>)]) -> bool {
+ let mut stems: HashSet<&str> = HashSet::new();
+ for (key, _) in tensors {
+ let bare = ["model.diffusion_model.", "diffusion_model.", "model.model.", "model."]
+ .iter()
+ .find_map(|p| key.strip_prefix(p))
+ .unwrap_or(key);
+ if let Some(stem) = bare.split('.').next() {
+ stems.insert(stem);
+ }
+ }
+ let has = |s: &str| stems.contains(s);
+ (has("transformer_blocks") && (has("patchify_proj") || has("adaln_single")))
+ || (has("transformer_blocks") && has("patch_embed") && has("time_embedding"))
+ || (has("blocks") && has("t5_y_embedder"))
+ || (has("double_blocks") && has("single_blocks"))
+}
+
+/// The folder for one file on disk; None as for `folder_for_tensors`, and
+/// for a file that is not safetensors (a GGUF keeps the rule it has).
+pub fn folder_for_file(path: &Path) -> Option<&'static str> {
+ let shapes = header_tensors(path)?;
+ let view: Vec<(&str, Option<&[u64]>)> = shapes.iter().map(|(k, s)| (k.as_str(), s.as_deref())).collect();
+ folder_for_tensors(&view)
+}
+
+/// `unet` is ComfyUI's older name for diffusion_models.
+fn same_folder(a: &str, b: &str) -> bool {
+ fn n(x: &str) -> &str {
+ if x == "unet" { "diffusion_models" } else { x }
+ }
+ n(a) == n(b)
+}
+
+/// Where a file downloaded into `guessed` (a folder picked from a title)
+/// belongs by its header, and the move there. `dirs` maps each of
+/// `HEADER_FOLDERS` to its directory. Returns the folder and the new path
+/// when the file was moved. Leaves the file where it is when the header does
+/// not say, when it already sits right, or when a file of that name is
+/// already in the other folder (nothing is overwritten).
+pub fn settle_by_header(file: &Path, guessed: &str, dirs: &HashMap<String, PathBuf>) -> Option<(&'static str, PathBuf)> {
+ if !["checkpoints", "diffusion_models", "unet"].contains(&guessed) {
+ return None;
+ }
+ let target = folder_for_file(file)?;
+ if same_folder(guessed, target) {
+ return None;
+ }
+ let dir = dirs.get(target)?;
+ let dest = dir.join(file.file_name()?);
+ if dest.exists() {
+ tracing::warn!("{} belongs in {target}, but {} is taken; it stays", file.display(), dest.display());
+ return None;
+ }
+ if let Err(e) = std::fs::create_dir_all(dir) {
+ tracing::warn!("could not create {}: {}", dir.display(), crate::os_error::english(&e));
+ return None;
+ }
+ if std::fs::rename(file, &dest).is_err() {
+ // Another volume (a Storage folder on a second disk): copy, then remove.
+ if let Err(e) = std::fs::copy(file, &dest) {
+ let _ = std::fs::remove_file(&dest);
+ tracing::warn!("could not move {} to {target}: {}", file.display(), crate::os_error::english(&e));
+ return None;
+ }
+ let _ = std::fs::remove_file(file);
+ }
+ tracing::info!("{} read as a {target} file, moved to {}", file.display(), dest.display());
+ Some((target, dest))
+}
+
+/// Which folder a file that already sits in a main model folder belongs in,
+/// when that is another one: for the hint in Models → Details. Never moves.
+pub fn belongs_elsewhere(file: &Path, found_in: &str) -> Option<&'static str> {
+ let target = folder_for_file(file)?;
+ (!same_folder(found_in, target)).then_some(target)
}
type CacheKey = (PathBuf, u64, Option<SystemTime>);
@@ -328,6 +463,131 @@ mod tests {
}
}
+ /// A27 (GitHub #234): the folder of real files, from their real headers
+ /// (src-tauri/tests/fixtures/model_headers, read by range request on
+ /// 14.11.2026; the keys of block 0 and everything outside the blocks).
+ #[test]
+ fn real_headers_name_their_folder() {
+ let dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/model_headers");
+ let want: &[(&str, Option<&str>)] = &[
+ // Video models, the ones the title rule sent to checkpoints.
+ ("ltxv-2b-0.9.5", Some("checkpoints")), // carries its VAE; ComfyUI loads LTX as a checkpoint
+ ("ltxv-13b-0.9.7", Some("checkpoints")),
+ ("mochi", Some("diffusion_models")),
+ ("hunyuanvideo", Some("diffusion_models")),
+ ("cogvideox-2b", Some("diffusion_models")),
+ ("wan21-1.3b", Some("diffusion_models")),
+ ("wan22-5b", Some("diffusion_models")),
+ // Image models.
+ ("qwen-image", Some("diffusion_models")),
+ ("chroma1-hd", Some("diffusion_models")),
+ ("zimage-turbo", Some("diffusion_models")),
+ // All-in-one checkpoints stay checkpoints, also with flux in the title.
+ ("flux-schnell-aio", Some("checkpoints")),
+ ("sdxl-base", Some("checkpoints")),
+ ("sd15", Some("checkpoints")),
+ // A LoRA says nothing about a main model folder.
+ ("flux-lora-xlabs", None),
+ ("flux-lora-diffusers", None),
+ ];
+ for (name, folder) in want {
+ let raw = std::fs::read(dir.join(format!("{name}.json"))).unwrap_or_else(|e| panic!("{name}: {e}"));
+ let v: serde_json::Value = serde_json::from_slice(&raw).unwrap();
+ let shapes: Vec<(String, Option<Vec<u64>>)> = v["keys"]
+ .as_array()
+ .unwrap()
+ .iter()
+ .map(|k| {
+ let k = k.as_str().unwrap().to_string();
+ let s = v["shapes"].get(&k).and_then(|s| s.as_array()).map(|a| a.iter().filter_map(|x| x.as_u64()).collect());
+ (k, s)
+ })
+ .collect();
+ let view: Vec<(&str, Option<&[u64]>)> = shapes.iter().map(|(k, s)| (k.as_str(), s.as_deref())).collect();
+ assert_eq!(folder_for_tensors(&view), *folder, "{name}");
+ }
+ }
+
+ #[test]
+ fn a_bare_vae_or_text_encoder_has_its_own_folder() {
+ let f = |keys: &[&str]| folder_for_tensors(&keys.iter().map(|k| (*k, None)).collect::<Vec<_>>());
+ assert_eq!(f(&["encoder.conv_in.weight", "decoder.conv_out.weight"]), Some("vae"));
+ assert_eq!(f(&["encoder.block.0.x", "shared.weight"]), Some("text_encoders"));
+ assert_eq!(f(&["foo.weight"]), None);
+ }
+
+ /// One safetensors file on disk with these keys, for the move tests.
+ fn write_model(path: &Path, keys: &[&str]) {
+ let mut header = serde_json::Map::new();
+ for (i, k) in keys.iter().enumerate() {
+ header.insert(k.to_string(), serde_json::json!({"dtype": "BF16", "shape": [1], "data_offsets": [i * 2, i * 2 + 2]}));
+ }
+ let header = serde_json::Value::Object(header).to_string();
+ let mut bytes = (header.len() as u64).to_le_bytes().to_vec();
+ bytes.extend_from_slice(header.as_bytes());
+ bytes.extend(std::iter::repeat_n(0u8, keys.len() * 2));
+ std::fs::create_dir_all(path.parent().unwrap()).unwrap();
+ std::fs::write(path, bytes).unwrap();
+ }
+
+ fn model_dirs(root: &Path) -> HashMap<String, PathBuf> {
+ HEADER_FOLDERS.iter().map(|k| (k.to_string(), root.join(k))).collect()
+ }
+
+ const LTX_BARE: &[&str] = &["model.diffusion_model.transformer_blocks.0.attn1.to_q.weight", "model.diffusion_model.patchify_proj.weight", "model.diffusion_model.adaln_single.linear.weight"];
+
+ #[test]
+ fn a_download_into_checkpoints_moves_to_diffusion_models_by_its_header() {
+ let root = tempfile::tempdir().unwrap();
+ let dirs = model_dirs(root.path());
+ // "Wan 2.2 Rapid" and "LTX 2B distilled" from the CivitAI search: no flux/wan/hunyuan in the title.
+ let file = root.path().join("checkpoints").join("ltx_distilled_bare.safetensors");
+ write_model(&file, LTX_BARE);
+ let (folder, dest) = settle_by_header(&file, "checkpoints", &dirs).expect("moved");
+ assert_eq!(folder, "diffusion_models");
+ assert_eq!(dest, root.path().join("diffusion_models").join("ltx_distilled_bare.safetensors"));
+ assert!(dest.is_file() && !file.exists());
+ // An all-in-one with flux in the title goes the other way.
+ let aio = root.path().join("diffusion_models").join("flux_aio.safetensors");
+ write_model(&aio, &["model.diffusion_model.double_blocks.0.x", "model.diffusion_model.single_blocks.0.x", "text_encoders.t5xxl.x", "vae.decoder.conv_in.weight"]);
+ assert_eq!(settle_by_header(&aio, "diffusion_models", &dirs).map(|m| m.0), Some("checkpoints"));
+ }
+
+ #[test]
+ fn nothing_moves_when_the_header_agrees_says_nothing_or_the_name_is_taken() {
+ let root = tempfile::tempdir().unwrap();
+ let dirs = model_dirs(root.path());
+ let right = root.path().join("diffusion_models").join("ltx.safetensors");
+ write_model(&right, LTX_BARE);
+ assert!(settle_by_header(&right, "diffusion_models", &dirs).is_none());
+ assert!(settle_by_header(&right, "unet", &dirs).is_none(), "unet is diffusion_models");
+ let lora = root.path().join("checkpoints").join("style.safetensors");
+ write_model(&lora, &["lora_unet_double_blocks_0_img_attn_proj.lora_down.weight"]);
+ assert!(settle_by_header(&lora, "checkpoints", &dirs).is_none());
+ let gguf = root.path().join("checkpoints").join("wan.gguf");
+ std::fs::write(&gguf, b"GGUF....").unwrap();
+ assert!(settle_by_header(&gguf, "checkpoints", &dirs).is_none());
+ // Never overwrites: the same name in the target folder keeps both where they are.
+ let twin = root.path().join("checkpoints").join("ltx.safetensors");
+ write_model(&twin, LTX_BARE);
+ assert!(settle_by_header(&twin, "checkpoints", &dirs).is_none());
+ assert!(twin.is_file() && right.is_file());
+ // A LoRA download is never asked.
+ let loras = root.path().join("loras").join("bare.safetensors");
+ write_model(&loras, LTX_BARE);
+ assert!(settle_by_header(&loras, "loras", &dirs).is_none());
+ }
+
+ #[test]
+ fn a_file_already_in_the_wrong_folder_is_named_not_moved() {
+ let root = tempfile::tempdir().unwrap();
+ let file = root.path().join("checkpoints").join("sub").join("qwen.safetensors");
+ write_model(&file, &["transformer_blocks.0.x", "img_in.weight", "txt_in.weight", "txt_norm.weight"]);
+ assert_eq!(belongs_elsewhere(&file, "checkpoints"), Some("diffusion_models"));
+ assert!(file.is_file());
+ assert_eq!(belongs_elsewhere(&file, "diffusion_models"), None);
+ }
+
#[test]
fn reads_a_real_header_and_refuses_garbage() {
let dir = std::env::temp_dir().join(format!("lu-sniff-{}", std::process::id()));
diff --git a/src-tauri/tests/fixtures/model_headers/chroma1-hd.json b/src-tauri/tests/fixtures/model_headers/chroma1-hd.json
new file mode 100644
index 00000000..b0de31c0
--- /dev/null
+++ b/src-tauri/tests/fixtures/model_headers/chroma1-hd.json
@@ -0,0 +1,45 @@
+{
+"source": "huggingface.co/lodestones/Chroma1-HD Chroma1-HD.safetensors",
+"note": "real safetensors header, read 14.11.2026 by range request; keys of block 0 and the keys outside the blocks, no weights",
+"tensors": 643,
+"keys": [
+"distilled_guidance_layer.in_proj.bias",
+"distilled_guidance_layer.in_proj.weight",
+"distilled_guidance_layer.layers.0.in_layer.bias",
+"distilled_guidance_layer.layers.0.in_layer.weight",
+"distilled_guidance_layer.layers.0.out_layer.bias",
+"distilled_guidance_layer.layers.0.out_layer.weight",
+"distilled_guidance_layer.norms.0.scale",
+"distilled_guidance_layer.out_proj.bias",
+"distilled_guidance_layer.out_proj.weight",
+"double_blocks.0.img_attn.norm.key_norm.scale",
+"double_blocks.0.img_attn.norm.query_norm.scale",
+"double_blocks.0.img_attn.proj.bias",
+"double_blocks.0.img_attn.proj.weight",
+"double_blocks.0.img_attn.qkv.bias",
+"double_blocks.0.img_attn.qkv.weight",
+"double_blocks.0.img_mlp.0.bias",
+"double_blocks.0.img_mlp.0.weight",
+"double_blocks.0.txt_attn.norm.key_norm.scale",
+"double_blocks.0.txt_attn.norm.query_norm.scale",
+"double_blocks.0.txt_attn.proj.bias",
+"double_blocks.0.txt_attn.proj.weight",
+"double_blocks.0.txt_attn.qkv.bias",
+"double_blocks.0.txt_attn.qkv.weight",
+"double_blocks.0.txt_mlp.0.bias",
+"double_blocks.0.txt_mlp.0.weight",
+"final_layer.linear.bias",
+"final_layer.linear.weight",
+"img_in.bias",
+"img_in.weight",
+"single_blocks.0.linear1.bias",
+"single_blocks.0.linear1.weight",
+"single_blocks.0.linear2.bias",
+"single_blocks.0.linear2.weight",
+"single_blocks.0.norm.key_norm.scale",
+"single_blocks.0.norm.query_norm.scale",
+"txt_in.bias",
+"txt_in.weight"
+],
+"shapes": {}
+}
\ No newline at end of file
diff --git a/src-tauri/tests/fixtures/model_headers/cogvideox-2b.json b/src-tauri/tests/fixtures/model_headers/cogvideox-2b.json
new file mode 100644
index 00000000..7ba9ae8b
--- /dev/null
+++ b/src-tauri/tests/fixtures/model_headers/cogvideox-2b.json
@@ -0,0 +1,46 @@
+{
+"source": "huggingface.co/THUDM/CogVideoX-2b transformer/diffusion_pytorch_model.safetensors",
+"note": "real safetensors header, read 14.11.2026 by range request; keys of block 0 and the keys outside the blocks, no weights",
+"tensors": 736,
+"keys": [
+"norm_final.bias",
+"norm_final.weight",
+"norm_out.linear.bias",
+"norm_out.linear.weight",
+"norm_out.norm.bias",
+"norm_out.norm.weight",
+"patch_embed.proj.bias",
+"patch_embed.proj.weight",
+"patch_embed.text_proj.bias",
+"patch_embed.text_proj.weight",
+"proj_out.bias",
+"proj_out.weight",
+"time_embedding.linear_1.bias",
+"time_embedding.linear_1.weight",
+"time_embedding.linear_2.bias",
+"time_embedding.linear_2.weight",
+"transformer_blocks.0.attn1.norm_k.bias",
+"transformer_blocks.0.attn1.norm_k.weight",
+"transformer_blocks.0.attn1.norm_q.bias",
+"transformer_blocks.0.attn1.norm_q.weight",
+"transformer_blocks.0.attn1.to_k.bias",
+"transformer_blocks.0.attn1.to_k.weight",
+"transformer_blocks.0.attn1.to_out.0.bias",
+"transformer_blocks.0.attn1.to_out.0.weight",
+"transformer_blocks.0.attn1.to_q.bias",
+"transformer_blocks.0.attn1.to_q.weight",
+"transformer_blocks.0.attn1.to_v.bias",
+"transformer_blocks.0.attn1.to_v.weight",
+"transformer_blocks.0.ff.net.0.proj.bias",
+"transformer_blocks.0.ff.net.0.proj.weight",
+"transformer_blocks.0.norm1.linear.bias",
+"transformer_blocks.0.norm1.linear.weight",
+"transformer_blocks.0.norm1.norm.bias",
+"transformer_blocks.0.norm1.norm.weight",
+"transformer_blocks.0.norm2.linear.bias",
+"transformer_blocks.0.norm2.linear.weight",
+"transformer_blocks.0.norm2.norm.bias",
+"transformer_blocks.0.norm2.norm.weight"
+],
+"shapes": {}
+}
\ No newline at end of file
diff --git a/src-tauri/tests/fixtures/model_headers/flux-lora-diffusers.json b/src-tauri/tests/fixtures/model_headers/flux-lora-diffusers.json
new file mode 100644
index 00000000..d032fa94
--- /dev/null
+++ b/src-tauri/tests/fixtures/model_headers/flux-lora-diffusers.json
@@ -0,0 +1,44 @@
+{
+"source": "huggingface.co/alvdansen/frosting_lane_flux flux_dev_frostinglane_araminta_k.safetensors",
+"note": "real safetensors header, read 14.11.2026 by range request; keys of block 0 and the keys outside the blocks, no weights",
+"tensors": 988,
+"keys": [
+"transformer.single_transformer_blocks.0.attn.to_k.lora_A.weight",
+"transformer.single_transformer_blocks.0.attn.to_k.lora_B.weight",
+"transformer.single_transformer_blocks.0.attn.to_q.lora_A.weight",
+"transformer.single_transformer_blocks.0.attn.to_q.lora_B.weight",
+"transformer.single_transformer_blocks.0.attn.to_v.lora_A.weight",
+"transformer.single_transformer_blocks.0.attn.to_v.lora_B.weight",
+"transformer.single_transformer_blocks.0.norm.linear.lora_A.weight",
+"transformer.single_transformer_blocks.0.norm.linear.lora_B.weight",
+"transformer.single_transformer_blocks.0.proj_mlp.lora_A.weight",
+"transformer.single_transformer_blocks.0.proj_mlp.lora_B.weight",
+"transformer.single_transformer_blocks.0.proj_out.lora_A.weight",
+"transformer.single_transformer_blocks.0.proj_out.lora_B.weight",
+"transformer.transformer_blocks.0.attn.add_k_proj.lora_A.weight",
+"transformer.transformer_blocks.0.attn.add_k_proj.lora_B.weight",
+"transformer.transformer_blocks.0.attn.add_q_proj.lora_A.weight",
+"transformer.transformer_blocks.0.attn.add_q_proj.lora_B.weight",
+"transformer.transformer_blocks.0.attn.add_v_proj.lora_A.weight",
+"transformer.transformer_blocks.0.attn.add_v_proj.lora_B.weight",
+"transformer.transformer_blocks.0.attn.to_add_out.lora_A.weight",
+"transformer.transformer_blocks.0.attn.to_add_out.lora_B.weight",
+"transformer.transformer_blocks.0.attn.to_k.lora_A.weight",
+"transformer.transformer_blocks.0.attn.to_k.lora_B.weight",
+"transformer.transformer_blocks.0.attn.to_out.0.lora_A.weight",
+"transformer.transformer_blocks.0.attn.to_out.0.lora_B.weight",
+"transformer.transformer_blocks.0.attn.to_q.lora_A.weight",
+"transformer.transformer_blocks.0.attn.to_q.lora_B.weight",
+"transformer.transformer_blocks.0.attn.to_v.lora_A.weight",
+"transformer.transformer_blocks.0.attn.to_v.lora_B.weight",
+"transformer.transformer_blocks.0.ff.net.0.proj.lora_A.weight",
+"transformer.transformer_blocks.0.ff.net.0.proj.lora_B.weight",
+"transformer.transformer_blocks.0.ff_context.net.0.proj.lora_A.weight",
+"transformer.transformer_blocks.0.ff_context.net.0.proj.lora_B.weight",
+"transformer.transformer_blocks.0.norm1.linear.lora_A.weight",
+"transformer.transformer_blocks.0.norm1.linear.lora_B.weight",
+"transformer.transformer_blocks.0.norm1_context.linear.lora_A.weight",
+"transformer.transformer_blocks.0.norm1_context.linear.lora_B.weight"
+],
+"shapes": {}
+}
\ No newline at end of file
diff --git a/src-tauri/tests/fixtures/model_headers/flux-lora-xlabs.json b/src-tauri/tests/fixtures/model_headers/flux-lora-xlabs.json
new file mode 100644
index 00000000..5b11c036
--- /dev/null
+++ b/src-tauri/tests/fixtures/model_headers/flux-lora-xlabs.json
@@ -0,0 +1,16 @@
+{
+"source": "huggingface.co/XLabs-AI/flux-lora-collection anime_lora.safetensors",
+"note": "real safetensors header, read 14.11.2026 by range request; keys of block 0 and the keys outside the blocks, no weights",
+"tensors": 152,
+"keys": [
+"double_blocks.0.processor.proj_lora1.down.weight",
+"double_blocks.0.processor.proj_lora1.up.weight",
+"double_blocks.0.processor.proj_lora2.down.weight",
+"double_blocks.0.processor.proj_lora2.up.weight",
+"double_blocks.0.processor.qkv_lora1.down.weight",
+"double_blocks.0.processor.qkv_lora1.up.weight",
+"double_blocks.0.processor.qkv_lora2.down.weight",
+"double_blocks.0.processor.qkv_lora2.up.weight"
+],
+"shapes": {}
+}
\ No newline at end of file
diff --git a/src-tauri/tests/fixtures/model_headers/flux-schnell-aio.json b/src-tauri/tests/fixtures/model_headers/flux-schnell-aio.json
new file mode 100644
index 00000000..6567234a
--- /dev/null
+++ b/src-tauri/tests/fixtures/model_headers/flux-schnell-aio.json
@@ -0,0 +1,165 @@
+{
+"source": "huggingface.co/Comfy-Org/flux1-schnell flux1-schnell-fp8.safetensors",
+"note": "real safetensors header, read 14.11.2026 by range request; keys of block 0 and the keys outside the blocks, no weights",
+"tensors": 1438,
+"keys": [
+"model.diffusion_model.double_blocks.0.img_attn.norm.key_norm.scale",
+"model.diffusion_model.double_blocks.0.img_attn.norm.query_norm.scale",
+"model.diffusion_model.double_blocks.0.img_attn.proj.bias",
+"model.diffusion_model.double_blocks.0.img_attn.proj.weight",
+"model.diffusion_model.double_blocks.0.img_attn.qkv.bias",
+"model.diffusion_model.double_blocks.0.img_attn.qkv.weight",
+"model.diffusion_model.double_blocks.0.img_mlp.0.bias",
+"model.diffusion_model.double_blocks.0.img_mlp.0.weight",
+"model.diffusion_model.double_blocks.0.img_mod.lin.bias",
+"model.diffusion_model.double_blocks.0.img_mod.lin.weight",
+"model.diffusion_model.double_blocks.0.txt_attn.norm.key_norm.scale",
+"model.diffusion_model.double_blocks.0.txt_attn.norm.query_norm.scale",
+"model.diffusion_model.double_blocks.0.txt_attn.proj.bias",
+"model.diffusion_model.double_blocks.0.txt_attn.proj.weight",
+"model.diffusion_model.double_blocks.0.txt_attn.qkv.bias",
+"model.diffusion_model.double_blocks.0.txt_attn.qkv.weight",
+"model.diffusion_model.double_blocks.0.txt_mlp.0.bias",
+"model.diffusion_model.double_blocks.0.txt_mlp.0.weight",
+"model.diffusion_model.double_blocks.0.txt_mod.lin.bias",
+"model.diffusion_model.double_blocks.0.txt_mod.lin.weight",
+"model.diffusion_model.final_layer.linear.bias",
+"model.diffusion_model.final_layer.linear.weight",
+"model.diffusion_model.img_in.bias",
+"model.diffusion_model.img_in.weight",
+"model.diffusion_model.single_blocks.0.linear1.bias",
+"model.diffusion_model.single_blocks.0.linear1.weight",
+"model.diffusion_model.single_blocks.0.linear2.bias",
+"model.diffusion_model.single_blocks.0.linear2.weight",
+"model.diffusion_model.single_blocks.0.modulation.lin.bias",
+"model.diffusion_model.single_blocks.0.modulation.lin.weight",
+"model.diffusion_model.single_blocks.0.norm.key_norm.scale",
+"model.diffusion_model.single_blocks.0.norm.query_norm.scale",
+"model.diffusion_model.time_in.in_layer.bias",
+"model.diffusion_model.time_in.in_layer.weight",
+"model.diffusion_model.time_in.out_layer.bias",
+"model.diffusion_model.time_in.out_layer.weight",
+"model.diffusion_model.txt_in.bias",
+"model.diffusion_model.txt_in.weight",
+"model.diffusion_model.vector_in.in_layer.bias",
+"model.diffusion_model.vector_in.in_layer.weight",
+"model.diffusion_model.vector_in.out_layer.bias",
+"model.diffusion_model.vector_in.out_layer.weight",
+"text_encoders.clip_l.logit_scale",
+"text_encoders.clip_l.transformer.text_model.embeddings.position_embedding.weight",
+"text_encoders.clip_l.transformer.text_model.embeddings.token_embedding.weight",
+"text_encoders.clip_l.transformer.text_model.encoder.layers.0.layer_norm1.bias",
+"text_encoders.clip_l.transformer.text_model.encoder.layers.0.layer_norm1.weight",
+"text_encoders.clip_l.transformer.text_model.encoder.layers.0.layer_norm2.bias",
+"text_encoders.clip_l.transformer.text_model.encoder.layers.0.layer_norm2.weight",
+"text_encoders.clip_l.transformer.text_model.encoder.layers.0.mlp.fc1.bias",
+"text_encoders.clip_l.transformer.text_model.encoder.layers.0.mlp.fc1.weight",
+"text_encoders.clip_l.transformer.text_model.encoder.layers.0.mlp.fc2.bias",
+"text_encoders.clip_l.transformer.text_model.encoder.layers.0.mlp.fc2.weight",
+"text_encoders.clip_l.transformer.text_model.encoder.layers.0.self_attn.k_proj.bias",
+"text_encoders.clip_l.transformer.text_model.encoder.layers.0.self_attn.k_proj.weight",
+"text_encoders.clip_l.transformer.text_model.encoder.layers.0.self_attn.out_proj.bias",
+"text_encoders.clip_l.transformer.text_model.encoder.layers.0.self_attn.out_proj.weight",
+"text_encoders.clip_l.transformer.text_model.encoder.layers.0.self_attn.q_proj.bias",
+"text_encoders.clip_l.transformer.text_model.encoder.layers.0.self_attn.q_proj.weight",
+"text_encoders.clip_l.transformer.text_model.encoder.layers.0.self_attn.v_proj.bias",
+"text_encoders.clip_l.transformer.text_model.encoder.layers.0.self_attn.v_proj.weight",
+"text_encoders.clip_l.transformer.text_model.final_layer_norm.bias",
+"text_encoders.clip_l.transformer.text_model.final_layer_norm.weight",
+"text_encoders.clip_l.transformer.text_projection.weight",
+"text_encoders.t5xxl.logit_scale",
+"text_encoders.t5xxl.transformer.encoder.block.0.layer.0.SelfAttention.k.weight",
+"text_encoders.t5xxl.transformer.encoder.block.0.layer.0.SelfAttention.o.weight",
+"text_encoders.t5xxl.transformer.encoder.block.0.layer.0.SelfAttention.q.weight",
+"text_encoders.t5xxl.transformer.encoder.block.0.layer.0.SelfAttention.relative_attention_bias.weight",
+"text_encoders.t5xxl.transformer.encoder.block.0.layer.0.SelfAttention.v.weight",
+"text_encoders.t5xxl.transformer.encoder.block.0.layer.0.layer_norm.weight",
+"text_encoders.t5xxl.transformer.encoder.final_layer_norm.weight",
+"text_encoders.t5xxl.transformer.shared.weight",
+"vae.decoder.conv_in.bias",
+"vae.decoder.conv_in.weight",
+"vae.decoder.conv_out.bias",
+"vae.decoder.conv_out.weight",
+"vae.decoder.mid.attn_1.k.bias",
+"vae.decoder.mid.attn_1.k.weight",
+"vae.decoder.mid.attn_1.norm.bias",
+"vae.decoder.mid.attn_1.norm.weight",
+"vae.decoder.mid.attn_1.proj_out.bias",
+"vae.decoder.mid.attn_1.proj_out.weight",
+"vae.decoder.mid.attn_1.q.bias",
+"vae.decoder.mid.attn_1.q.weight",
+"vae.decoder.mid.attn_1.v.bias",
+"vae.decoder.mid.attn_1.v.weight",
+"vae.decoder.mid.block_1.conv1.bias",
+"vae.decoder.mid.block_1.conv1.weight",
+"vae.decoder.mid.block_1.conv2.bias",
+"vae.decoder.mid.block_1.conv2.weight",
+"vae.decoder.mid.block_1.norm1.bias",
+"vae.decoder.mid.block_1.norm1.weight",
+"vae.decoder.mid.block_1.norm2.bias",
+"vae.decoder.mid.block_1.norm2.weight",
+"vae.decoder.mid.block_2.conv1.bias",
+"vae.decoder.mid.block_2.conv1.weight",
+"vae.decoder.mid.block_2.conv2.bias",
+"vae.decoder.mid.block_2.conv2.weight",
+"vae.decoder.mid.block_2.norm1.bias",
+"vae.decoder.mid.block_2.norm1.weight",
+"vae.decoder.mid.block_2.norm2.bias",
+"vae.decoder.mid.block_2.norm2.weight",
+"vae.decoder.norm_out.bias",
+"vae.decoder.norm_out.weight",
+"vae.decoder.up.0.block.0.conv1.bias",
+"vae.decoder.up.0.block.0.conv1.weight",
+"vae.decoder.up.0.block.0.conv2.bias",
+"vae.decoder.up.0.block.0.conv2.weight",
+"vae.decoder.up.0.block.0.nin_shortcut.bias",
+"vae.decoder.up.0.block.0.nin_shortcut.weight",
+"vae.decoder.up.0.block.0.norm1.bias",
+"vae.decoder.up.0.block.0.norm1.weight",
+"vae.decoder.up.0.block.0.norm2.bias",
+"vae.decoder.up.0.block.0.norm2.weight",
+"vae.encoder.conv_in.bias",
+"vae.encoder.conv_in.weight",
+"vae.encoder.conv_out.bias",
+"vae.encoder.conv_out.weight",
+"vae.encoder.down.0.block.0.conv1.bias",
+"vae.encoder.down.0.block.0.conv1.weight",
+"vae.encoder.down.0.block.0.conv2.bias",
+"vae.encoder.down.0.block.0.conv2.weight",
+"vae.encoder.down.0.block.0.norm1.bias",
+"vae.encoder.down.0.block.0.norm1.weight",
+"vae.encoder.down.0.block.0.norm2.bias",
+"vae.encoder.down.0.block.0.norm2.weight",
+"vae.encoder.down.0.downsample.conv.bias",
+"vae.encoder.down.0.downsample.conv.weight",
+"vae.encoder.mid.attn_1.k.bias",
+"vae.encoder.mid.attn_1.k.weight",
+"vae.encoder.mid.attn_1.norm.bias",
+"vae.encoder.mid.attn_1.norm.weight",
+"vae.encoder.mid.attn_1.proj_out.bias",
+"vae.encoder.mid.attn_1.proj_out.weight",
+"vae.encoder.mid.attn_1.q.bias",
+"vae.encoder.mid.attn_1.q.weight",
+"vae.encoder.mid.attn_1.v.bias",
+"vae.encoder.mid.attn_1.v.weight",
+"vae.encoder.mid.block_1.conv1.bias",
+"vae.encoder.mid.block_1.conv1.weight",
+"vae.encoder.mid.block_1.conv2.bias",
+"vae.encoder.mid.block_1.conv2.weight",
+"vae.encoder.mid.block_1.norm1.bias",
+"vae.encoder.mid.block_1.norm1.weight",
+"vae.encoder.mid.block_1.norm2.bias",
+"vae.encoder.mid.block_1.norm2.weight",
+"vae.encoder.mid.block_2.conv1.bias",
+"vae.encoder.mid.block_2.conv1.weight",
+"vae.encoder.mid.block_2.conv2.bias",
+"vae.encoder.mid.block_2.conv2.weight",
+"vae.encoder.mid.block_2.norm1.bias",
+"vae.encoder.mid.block_2.norm1.weight",
+"vae.encoder.mid.block_2.norm2.bias",
+"vae.encoder.mid.block_2.norm2.weight",
+"vae.encoder.norm_out.bias",
+"vae.encoder.norm_out.weight"
+],
+"shapes": {}
+}
\ No newline at end of file
diff --git a/src-tauri/tests/fixtures/model_headers/hunyuanvideo.json b/src-tauri/tests/fixtures/model_headers/hunyuanvideo.json
new file mode 100644
index 00000000..8d908173
--- /dev/null
+++ b/src-tauri/tests/fixtures/model_headers/hunyuanvideo.json
@@ -0,0 +1,72 @@
+{
+"source": "huggingface.co/Comfy-Org/HunyuanVideo_repackaged split_files/diffusion_models/hunyuan_video_t2v_720p_bf16.safetensors",
+"note": "real safetensors header, read 14.11.2026 by range request; keys of block 0 and the keys outside the blocks, no weights",
+"tensors": 856,
+"keys": [
+"model.model.double_blocks.0.img_attn.norm.key_norm.scale",
+"model.model.double_blocks.0.img_attn.norm.query_norm.scale",
+"model.model.double_blocks.0.img_attn.proj.bias",
+"model.model.double_blocks.0.img_attn.proj.weight",
+"model.model.double_blocks.0.img_attn.qkv.bias",
+"model.model.double_blocks.0.img_attn.qkv.weight",
+"model.model.double_blocks.0.img_mlp.0.bias",
+"model.model.double_blocks.0.img_mlp.0.weight",
+"model.model.double_blocks.0.img_mod.lin.bias",
+"model.model.double_blocks.0.img_mod.lin.weight",
+"model.model.double_blocks.0.txt_attn.norm.key_norm.scale",
+"model.model.double_blocks.0.txt_attn.norm.query_norm.scale",
+"model.model.double_blocks.0.txt_attn.proj.bias",
+"model.model.double_blocks.0.txt_attn.proj.weight",
+"model.model.double_blocks.0.txt_attn.qkv.bias",
+"model.model.double_blocks.0.txt_attn.qkv.weight",
+"model.model.double_blocks.0.txt_mlp.0.bias",
+"model.model.double_blocks.0.txt_mlp.0.weight",
+"model.model.double_blocks.0.txt_mod.lin.bias",
+"model.model.double_blocks.0.txt_mod.lin.weight",
+"model.model.final_layer.linear.bias",
+"model.model.final_layer.linear.weight",
+"model.model.guidance_in.in_layer.bias",
+"model.model.guidance_in.in_layer.weight",
+"model.model.guidance_in.out_layer.bias",
+"model.model.guidance_in.out_layer.weight",
+"model.model.img_in.proj.bias",
+"model.model.img_in.proj.weight",
+"model.model.single_blocks.0.linear1.bias",
+"model.model.single_blocks.0.linear1.weight",
+"model.model.single_blocks.0.linear2.bias",
+"model.model.single_blocks.0.linear2.weight",
+"model.model.single_blocks.0.modulation.lin.bias",
+"model.model.single_blocks.0.modulation.lin.weight",
+"model.model.single_blocks.0.norm.key_norm.scale",
+"model.model.single_blocks.0.norm.query_norm.scale",
+"model.model.time_in.in_layer.bias",
+"model.model.time_in.in_layer.weight",
+"model.model.time_in.out_layer.bias",
+"model.model.time_in.out_layer.weight",
+"model.model.txt_in.c_embedder.in_layer.bias",
+"model.model.txt_in.c_embedder.in_layer.weight",
+"model.model.txt_in.c_embedder.out_layer.bias",
+"model.model.txt_in.c_embedder.out_layer.weight",
+"model.model.txt_in.individual_token_refiner.blocks.0.mlp.0.bias",
+"model.model.txt_in.individual_token_refiner.blocks.0.mlp.0.weight",
+"model.model.txt_in.individual_token_refiner.blocks.0.norm1.bias",
+"model.model.txt_in.individual_token_refiner.blocks.0.norm1.weight",
+"model.model.txt_in.individual_token_refiner.blocks.0.norm2.bias",
+"model.model.txt_in.individual_token_refiner.blocks.0.norm2.weight",
+"model.model.txt_in.individual_token_refiner.blocks.0.self_attn.proj.bias",
+"model.model.txt_in.individual_token_refiner.blocks.0.self_attn.proj.weight",
+"model.model.txt_in.individual_token_refiner.blocks.0.self_attn.qkv.bias",
+"model.model.txt_in.individual_token_refiner.blocks.0.self_attn.qkv.weight",
+"model.model.txt_in.input_embedder.bias",
+"model.model.txt_in.input_embedder.weight",
+"model.model.txt_in.t_embedder.in_layer.bias",
+"model.model.txt_in.t_embedder.in_layer.weight",
+"model.model.txt_in.t_embedder.out_layer.bias",
+"model.model.txt_in.t_embedder.out_layer.weight",
+"model.model.vector_in.in_layer.bias",
+"model.model.vector_in.in_layer.weight",
+"model.model.vector_in.out_layer.bias",
+"model.model.vector_in.out_layer.weight"
+],
+"shapes": {}
+}
\ No newline at end of file
diff --git a/src-tauri/tests/fixtures/model_headers/ltxv-13b-0.9.7.json b/src-tauri/tests/fixtures/model_headers/ltxv-13b-0.9.7.json
new file mode 100644
index 00000000..5184a09b
--- /dev/null
+++ b/src-tauri/tests/fixtures/model_headers/ltxv-13b-0.9.7.json
@@ -0,0 +1,78 @@
+{
+"source": "huggingface.co/Lightricks/LTX-Video ltxv-13b-0.9.7-dev.safetensors",
+"note": "real safetensors header, read 14.11.2026 by range request; keys of block 0 and the keys outside the blocks, no weights",
+"tensors": 1444,
+"keys": [
+"model.diffusion_model.adaln_single.emb.timestep_embedder.linear_1.bias",
+"model.diffusion_model.adaln_single.emb.timestep_embedder.linear_1.weight",
+"model.diffusion_model.adaln_single.emb.timestep_embedder.linear_2.bias",
+"model.diffusion_model.adaln_single.emb.timestep_embedder.linear_2.weight",
+"model.diffusion_model.adaln_single.linear.bias",
+"model.diffusion_model.adaln_single.linear.weight",
+"model.diffusion_model.caption_projection.linear_1.bias",
+"model.diffusion_model.caption_projection.linear_1.weight",
+"model.diffusion_model.caption_projection.linear_2.bias",
+"model.diffusion_model.caption_projection.linear_2.weight",
+"model.diffusion_model.patchify_proj.bias",
+"model.diffusion_model.patchify_proj.weight",
+"model.diffusion_model.proj_out.bias",
+"model.diffusion_model.proj_out.weight",
+"model.diffusion_model.scale_shift_table",
+"model.diffusion_model.transformer_blocks.0.attn1.k_norm.weight",
+"model.diffusion_model.transformer_blocks.0.attn1.q_norm.weight",
+"model.diffusion_model.transformer_blocks.0.attn1.to_k.bias",
+"model.diffusion_model.transformer_blocks.0.attn1.to_k.weight",
+"model.diffusion_model.transformer_blocks.0.attn1.to_out.0.bias",
+"model.diffusion_model.transformer_blocks.0.attn1.to_out.0.weight",
+"model.diffusion_model.transformer_blocks.0.attn1.to_q.bias",
+"model.diffusion_model.transformer_blocks.0.attn1.to_q.weight",
+"model.diffusion_model.transformer_blocks.0.attn1.to_v.bias",
+"model.diffusion_model.transformer_blocks.0.attn1.to_v.weight",
+"model.diffusion_model.transformer_blocks.0.attn2.k_norm.weight",
+"model.diffusion_model.transformer_blocks.0.attn2.q_norm.weight",
+"model.diffusion_model.transformer_blocks.0.attn2.to_k.bias",
+"model.diffusion_model.transformer_blocks.0.attn2.to_k.weight",
+"model.diffusion_model.transformer_blocks.0.attn2.to_out.0.bias",
+"model.diffusion_model.transformer_blocks.0.attn2.to_out.0.weight",
+"model.diffusion_model.transformer_blocks.0.attn2.to_q.bias",
+"model.diffusion_model.transformer_blocks.0.attn2.to_q.weight",
+"model.diffusion_model.transformer_blocks.0.attn2.to_v.bias",
+"model.diffusion_model.transformer_blocks.0.attn2.to_v.weight",
+"model.diffusion_model.transformer_blocks.0.ff.net.0.proj.bias",
+"model.diffusion_model.transformer_blocks.0.ff.net.0.proj.weight",
+"model.diffusion_model.transformer_blocks.0.scale_shift_table",
+"vae.decoder.conv_in.conv.bias",
+"vae.decoder.conv_in.conv.weight",
+"vae.decoder.conv_out.conv.bias",
+"vae.decoder.conv_out.conv.weight",
+"vae.decoder.last_scale_shift_table",
+"vae.decoder.last_time_embedder.timestep_embedder.linear_1.bias",
+"vae.decoder.last_time_embedder.timestep_embedder.linear_1.weight",
+"vae.decoder.last_time_embedder.timestep_embedder.linear_2.bias",
+"vae.decoder.last_time_embedder.timestep_embedder.linear_2.weight",
+"vae.decoder.timestep_scale_multiplier",
+"vae.decoder.up_blocks.0.res_blocks.0.conv1.conv.bias",
+"vae.decoder.up_blocks.0.res_blocks.0.conv1.conv.weight",
+"vae.decoder.up_blocks.0.res_blocks.0.conv2.conv.bias",
+"vae.decoder.up_blocks.0.res_blocks.0.conv2.conv.weight",
+"vae.decoder.up_blocks.0.res_blocks.0.scale_shift_table",
+"vae.decoder.up_blocks.0.time_embedder.timestep_embedder.linear_1.bias",
+"vae.decoder.up_blocks.0.time_embedder.timestep_embedder.linear_1.weight",
+"vae.decoder.up_blocks.0.time_embedder.timestep_embedder.linear_2.bias",
+"vae.decoder.up_blocks.0.time_embedder.timestep_embedder.linear_2.weight",
+"vae.encoder.conv_in.conv.bias",
+"vae.encoder.conv_in.conv.weight",
+"vae.encoder.conv_out.conv.bias",
+"vae.encoder.conv_out.conv.weight",
+"vae.encoder.down_blocks.0.res_blocks.0.conv1.conv.bias",
+"vae.encoder.down_blocks.0.res_blocks.0.conv1.conv.weight",
+"vae.encoder.down_blocks.0.res_blocks.0.conv2.conv.bias",
+"vae.encoder.down_blocks.0.res_blocks.0.conv2.conv.weight",
+"vae.per_channel_statistics.channel",
+"vae.per_channel_statistics.mean-of-means",
+"vae.per_channel_statistics.mean-of-stds",
+"vae.per_channel_statistics.mean-of-stds_over_std-of-means",
+"vae.per_channel_statistics.std-of-means"
+],
+"shapes": {}
+}
\ No newline at end of file
diff --git a/src-tauri/tests/fixtures/model_headers/ltxv-2b-0.9.5.json b/src-tauri/tests/fixtures/model_headers/ltxv-2b-0.9.5.json
new file mode 100644
index 00000000..9aebd5d3
--- /dev/null
+++ b/src-tauri/tests/fixtures/model_headers/ltxv-2b-0.9.5.json
@@ -0,0 +1,78 @@
+{
+"source": "huggingface.co/Lightricks/LTX-Video ltx-video-2b-v0.9.5.safetensors",
+"note": "real safetensors header, read 14.11.2026 by range request; keys of block 0 and the keys outside the blocks, no weights",
+"tensors": 944,
+"keys": [
+"model.diffusion_model.adaln_single.emb.timestep_embedder.linear_1.bias",
+"model.diffusion_model.adaln_single.emb.timestep_embedder.linear_1.weight",
+"model.diffusion_model.adaln_single.emb.timestep_embedder.linear_2.bias",
+"model.diffusion_model.adaln_single.emb.timestep_embedder.linear_2.weight",
+"model.diffusion_model.adaln_single.linear.bias",
+"model.diffusion_model.adaln_single.linear.weight",
+"model.diffusion_model.caption_projection.linear_1.bias",
+"model.diffusion_model.caption_projection.linear_1.weight",
+"model.diffusion_model.caption_projection.linear_2.bias",
+"model.diffusion_model.caption_projection.linear_2.weight",
+"model.diffusion_model.patchify_proj.bias",
+"model.diffusion_model.patchify_proj.weight",
+"model.diffusion_model.proj_out.bias",
+"model.diffusion_model.proj_out.weight",
+"model.diffusion_model.scale_shift_table",
+"model.diffusion_model.transformer_blocks.0.attn1.k_norm.weight",
+"model.diffusion_model.transformer_blocks.0.attn1.q_norm.weight",
+"model.diffusion_model.transformer_blocks.0.attn1.to_k.bias",
+"model.diffusion_model.transformer_blocks.0.attn1.to_k.weight",
+"model.diffusion_model.transformer_blocks.0.attn1.to_out.0.bias",
+"model.diffusion_model.transformer_blocks.0.attn1.to_out.0.weight",
+"model.diffusion_model.transformer_blocks.0.attn1.to_q.bias",
+"model.diffusion_model.transformer_blocks.0.attn1.to_q.weight",
+"model.diffusion_model.transformer_blocks.0.attn1.to_v.bias",
+"model.diffusion_model.transformer_blocks.0.attn1.to_v.weight",
+"model.diffusion_model.transformer_blocks.0.attn2.k_norm.weight",
+"model.diffusion_model.transformer_blocks.0.attn2.q_norm.weight",
+"model.diffusion_model.transformer_blocks.0.attn2.to_k.bias",
+"model.diffusion_model.transformer_blocks.0.attn2.to_k.weight",
+"model.diffusion_model.transformer_blocks.0.attn2.to_out.0.bias",
+"model.diffusion_model.transformer_blocks.0.attn2.to_out.0.weight",
+"model.diffusion_model.transformer_blocks.0.attn2.to_q.bias",
+"model.diffusion_model.transformer_blocks.0.attn2.to_q.weight",
+"model.diffusion_model.transformer_blocks.0.attn2.to_v.bias",
+"model.diffusion_model.transformer_blocks.0.attn2.to_v.weight",
+"model.diffusion_model.transformer_blocks.0.ff.net.0.proj.bias",
+"model.diffusion_model.transformer_blocks.0.ff.net.0.proj.weight",
+"model.diffusion_model.transformer_blocks.0.scale_shift_table",
+"vae.decoder.conv_in.conv.bias",
+"vae.decoder.conv_in.conv.weight",
+"vae.decoder.conv_out.conv.bias",
+"vae.decoder.conv_out.conv.weight",
+"vae.decoder.last_scale_shift_table",
+"vae.decoder.last_time_embedder.timestep_embedder.linear_1.bias",
+"vae.decoder.last_time_embedder.timestep_embedder.linear_1.weight",
+"vae.decoder.last_time_embedder.timestep_embedder.linear_2.bias",
+"vae.decoder.last_time_embedder.timestep_embedder.linear_2.weight",
+"vae.decoder.timestep_scale_multiplier",
+"vae.decoder.up_blocks.0.res_blocks.0.conv1.conv.bias",
+"vae.decoder.up_blocks.0.res_blocks.0.conv1.conv.weight",
+"vae.decoder.up_blocks.0.res_blocks.0.conv2.conv.bias",
+"vae.decoder.up_blocks.0.res_blocks.0.conv2.conv.weight",
+"vae.decoder.up_blocks.0.res_blocks.0.scale_shift_table",
+"vae.decoder.up_blocks.0.time_embedder.timestep_embedder.linear_1.bias",
+"vae.decoder.up_blocks.0.time_embedder.timestep_embedder.linear_1.weight",
+"vae.decoder.up_blocks.0.time_embedder.timestep_embedder.linear_2.bias",
+"vae.decoder.up_blocks.0.time_embedder.timestep_embedder.linear_2.weight",
+"vae.encoder.conv_in.conv.bias",
+"vae.encoder.conv_in.conv.weight",
+"vae.encoder.conv_out.conv.bias",
+"vae.encoder.conv_out.conv.weight",
+"vae.encoder.down_blocks.0.res_blocks.0.conv1.conv.bias",
+"vae.encoder.down_blocks.0.res_blocks.0.conv1.conv.weight",
+"vae.encoder.down_blocks.0.res_blocks.0.conv2.conv.bias",
+"vae.encoder.down_blocks.0.res_blocks.0.conv2.conv.weight",
+"vae.per_channel_statistics.channel",
+"vae.per_channel_statistics.mean-of-means",
+"vae.per_channel_statistics.mean-of-stds",
+"vae.per_channel_statistics.mean-of-stds_over_std-of-means",
+"vae.per_channel_statistics.std-of-means"
+],
+"shapes": {}
+}
\ No newline at end of file
diff --git a/src-tauri/tests/fixtures/model_headers/mochi.json b/src-tauri/tests/fixtures/model_headers/mochi.json
new file mode 100644
index 00000000..50b19cc1
--- /dev/null
+++ b/src-tauri/tests/fixtures/model_headers/mochi.json
@@ -0,0 +1,43 @@
+{
+"source": "huggingface.co/Comfy-Org/mochi_preview_repackaged split_files/diffusion_models/mochi_preview_bf16.safetensors",
+"note": "real safetensors header, read 14.11.2026 by range request; keys of block 0 and the keys outside the blocks, no weights",
+"tensors": 879,
+"keys": [
+"model.diffusion_model.blocks.0.attn.k_norm_x.weight",
+"model.diffusion_model.blocks.0.attn.k_norm_y.weight",
+"model.diffusion_model.blocks.0.attn.proj_x.bias",
+"model.diffusion_model.blocks.0.attn.proj_x.weight",
+"model.diffusion_model.blocks.0.attn.proj_y.bias",
+"model.diffusion_model.blocks.0.attn.proj_y.weight",
+"model.diffusion_model.blocks.0.attn.q_norm_x.weight",
+"model.diffusion_model.blocks.0.attn.q_norm_y.weight",
+"model.diffusion_model.blocks.0.attn.qkv_x.weight",
+"model.diffusion_model.blocks.0.attn.qkv_y.weight",
+"model.diffusion_model.blocks.0.mlp_x.w1.weight",
+"model.diffusion_model.blocks.0.mlp_x.w2.weight",
+"model.diffusion_model.blocks.0.mlp_y.w1.weight",
+"model.diffusion_model.blocks.0.mlp_y.w2.weight",
+"model.diffusion_model.blocks.0.mod_x.bias",
+"model.diffusion_model.blocks.0.mod_x.weight",
+"model.diffusion_model.blocks.0.mod_y.bias",
+"model.diffusion_model.blocks.0.mod_y.weight",
+"model.diffusion_model.final_layer.linear.bias",
+"model.diffusion_model.final_layer.linear.weight",
+"model.diffusion_model.final_layer.mod.bias",
+"model.diffusion_model.final_layer.mod.weight",
+"model.diffusion_model.pos_frequencies",
+"model.diffusion_model.t5_y_embedder.to_kv.bias",
+"model.diffusion_model.t5_y_embedder.to_kv.weight",
+"model.diffusion_model.t5_y_embedder.to_out.bias",
+"model.diffusion_model.t5_y_embedder.to_out.weight",
+"model.diffusion_model.t5_y_embedder.to_q.bias",
+"model.diffusion_model.t5_y_embedder.to_q.weight",
+"model.diffusion_model.t5_yproj.bias",
+"model.diffusion_model.t5_yproj.weight",
+"model.diffusion_model.t_embedder.mlp.0.bias",
+"model.diffusion_model.t_embedder.mlp.0.weight",
+"model.diffusion_model.x_embedder.proj.bias",
+"model.diffusion_model.x_embedder.proj.weight"
+],
+"shapes": {}
+}
\ No newline at end of file
diff --git a/src-tauri/tests/fixtures/model_headers/qwen-image.json b/src-tauri/tests/fixtures/model_headers/qwen-image.json
new file mode 100644
index 00000000..66667c76
--- /dev/null
+++ b/src-tauri/tests/fixtures/model_headers/qwen-image.json
@@ -0,0 +1,45 @@
+{
+"source": "huggingface.co/Comfy-Org/Qwen-Image_ComfyUI split_files/diffusion_models/qwen_image_fp8_e4m3fn.safetensors",
+"note": "real safetensors header, read 14.11.2026 by range request; keys of block 0 and the keys outside the blocks, no weights",
+"tensors": 1933,
+"keys": [
+"img_in.bias",
+"img_in.weight",
+"norm_out.linear.bias",
+"norm_out.linear.weight",
+"proj_out.bias",
+"proj_out.weight",
+"time_text_embed.timestep_embedder.linear_1.bias",
+"time_text_embed.timestep_embedder.linear_1.weight",
+"time_text_embed.timestep_embedder.linear_2.bias",
+"time_text_embed.timestep_embedder.linear_2.weight",
+"transformer_blocks.0.attn.add_k_proj.bias",
+"transformer_blocks.0.attn.add_k_proj.weight",
+"transformer_blocks.0.attn.add_q_proj.bias",
+"transformer_blocks.0.attn.add_q_proj.weight",
+"transformer_blocks.0.attn.add_v_proj.bias",
+"transformer_blocks.0.attn.add_v_proj.weight",
+"transformer_blocks.0.attn.norm_added_k.weight",
+"transformer_blocks.0.attn.norm_added_q.weight",
+"transformer_blocks.0.attn.norm_k.weight",
+"transformer_blocks.0.attn.norm_q.weight",
+"transformer_blocks.0.attn.to_add_out.bias",
+"transformer_blocks.0.attn.to_add_out.weight",
+"transformer_blocks.0.attn.to_k.bias",
+"transformer_blocks.0.attn.to_k.weight",
+"transformer_blocks.0.attn.to_out.0.bias",
+"transformer_blocks.0.attn.to_out.0.weight",
+"transformer_blocks.0.attn.to_q.bias",
+"transformer_blocks.0.attn.to_q.weight",
+"transformer_blocks.0.attn.to_v.bias",
+"transformer_blocks.0.attn.to_v.weight",
+"transformer_blocks.0.img_mlp.net.0.proj.bias",
+"transformer_blocks.0.img_mlp.net.0.proj.weight",
+"transformer_blocks.0.txt_mlp.net.0.proj.bias",
+"transformer_blocks.0.txt_mlp.net.0.proj.weight",
+"txt_in.bias",
+"txt_in.weight",
+"txt_norm.weight"
+],
+"shapes": {}
+}
\ No newline at end of file
diff --git a/src-tauri/tests/fixtures/model_headers/sd15.json b/src-tauri/tests/fixtures/model_headers/sd15.json
new file mode 100644
index 00000000..3984f11a
--- /dev/null
+++ b/src-tauri/tests/fixtures/model_headers/sd15.json
@@ -0,0 +1,147 @@
+{
+"source": "huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5 v1-5-pruned-emaonly.safetensors",
+"note": "real safetensors header, read 14.11.2026 by range request; keys of block 0 and the keys outside the blocks, no weights",
+"tensors": 1145,
+"keys": [
+"alphas_cumprod",
+"alphas_cumprod_prev",
+"betas",
+"cond_stage_model.transformer.text_model.embeddings.position_embedding.weight",
+"cond_stage_model.transformer.text_model.embeddings.position_ids",
+"cond_stage_model.transformer.text_model.embeddings.token_embedding.weight",
+"cond_stage_model.transformer.text_model.encoder.layers.0.layer_norm1.bias",
+"cond_stage_model.transformer.text_model.encoder.layers.0.layer_norm1.weight",
+"cond_stage_model.transformer.text_model.encoder.layers.0.layer_norm2.bias",
+"cond_stage_model.transformer.text_model.encoder.layers.0.layer_norm2.weight",
+"cond_stage_model.transformer.text_model.encoder.layers.0.mlp.fc1.bias",
+"cond_stage_model.transformer.text_model.encoder.layers.0.mlp.fc1.weight",
+"cond_stage_model.transformer.text_model.encoder.layers.0.mlp.fc2.bias",
+"cond_stage_model.transformer.text_model.encoder.layers.0.mlp.fc2.weight",
+"cond_stage_model.transformer.text_model.encoder.layers.0.self_attn.k_proj.bias",
+"cond_stage_model.transformer.text_model.encoder.layers.0.self_attn.k_proj.weight",
+"cond_stage_model.transformer.text_model.encoder.layers.0.self_attn.out_proj.bias",
+"cond_stage_model.transformer.text_model.encoder.layers.0.self_attn.out_proj.weight",
+"cond_stage_model.transformer.text_model.encoder.layers.0.self_attn.q_proj.bias",
+"cond_stage_model.transformer.text_model.encoder.layers.0.self_attn.q_proj.weight",
+"cond_stage_model.transformer.text_model.encoder.layers.0.self_attn.v_proj.bias",
+"cond_stage_model.transformer.text_model.encoder.layers.0.self_attn.v_proj.weight",
+"cond_stage_model.transformer.text_model.final_layer_norm.bias",
+"cond_stage_model.transformer.text_model.final_layer_norm.weight",
+"first_stage_model.decoder.conv_in.bias",
+"first_stage_model.decoder.conv_in.weight",
+"first_stage_model.decoder.conv_out.bias",
+"first_stage_model.decoder.conv_out.weight",
+"first_stage_model.decoder.mid.attn_1.k.bias",
+"first_stage_model.decoder.mid.attn_1.k.weight",
+"first_stage_model.decoder.mid.attn_1.norm.bias",
+"first_stage_model.decoder.mid.attn_1.norm.weight",
+"first_stage_model.decoder.mid.attn_1.proj_out.bias",
+"first_stage_model.decoder.mid.attn_1.proj_out.weight",
+"first_stage_model.decoder.mid.attn_1.q.bias",
+"first_stage_model.decoder.mid.attn_1.q.weight",
+"first_stage_model.decoder.mid.attn_1.v.bias",
+"first_stage_model.decoder.mid.attn_1.v.weight",
+"first_stage_model.decoder.mid.block_1.conv1.bias",
+"first_stage_model.decoder.mid.block_1.conv1.weight",
+"first_stage_model.decoder.mid.block_1.conv2.bias",
+"first_stage_model.decoder.mid.block_1.conv2.weight",
+"first_stage_model.decoder.mid.block_1.norm1.bias",
+"first_stage_model.decoder.mid.block_1.norm1.weight",
+"first_stage_model.decoder.mid.block_1.norm2.bias",
+"first_stage_model.decoder.mid.block_1.norm2.weight",
+"first_stage_model.decoder.mid.block_2.conv1.bias",
+"first_stage_model.decoder.mid.block_2.conv1.weight",
+"first_stage_model.decoder.mid.block_2.conv2.bias",
+"first_stage_model.decoder.mid.block_2.conv2.weight",
+"first_stage_model.decoder.mid.block_2.norm1.bias",
+"first_stage_model.decoder.mid.block_2.norm1.weight",
+"first_stage_model.decoder.mid.block_2.norm2.bias",
+"first_stage_model.decoder.mid.block_2.norm2.weight",
+"first_stage_model.decoder.norm_out.bias",
+"first_stage_model.decoder.norm_out.weight",
+"first_stage_model.decoder.up.0.block.0.conv1.bias",
+"first_stage_model.decoder.up.0.block.0.conv1.weight",
+"first_stage_model.decoder.up.0.block.0.conv2.bias",
+"first_stage_model.decoder.up.0.block.0.conv2.weight",
+"first_stage_model.decoder.up.0.block.0.nin_shortcut.bias",
+"first_stage_model.decoder.up.0.block.0.nin_shortcut.weight",
+"first_stage_model.decoder.up.0.block.0.norm1.bias",
+"first_stage_model.decoder.up.0.block.0.norm1.weight",
+"first_stage_model.decoder.up.0.block.0.norm2.bias",
+"first_stage_model.decoder.up.0.block.0.norm2.weight",
+"first_stage_model.encoder.conv_in.bias",
+"first_stage_model.encoder.conv_in.weight",
+"first_stage_model.encoder.conv_out.bias",
+"first_stage_model.encoder.conv_out.weight",
+"first_stage_model.encoder.down.0.block.0.conv1.bias",
+"first_stage_model.encoder.down.0.block.0.conv1.weight",
+"first_stage_model.encoder.down.0.block.0.conv2.bias",
+"first_stage_model.encoder.down.0.block.0.conv2.weight",
+"first_stage_model.encoder.down.0.block.0.norm1.bias",
+"first_stage_model.encoder.down.0.block.0.norm1.weight",
+"first_stage_model.encoder.down.0.block.0.norm2.bias",
+"first_stage_model.encoder.down.0.block.0.norm2.weight",
+"first_stage_model.encoder.down.0.downsample.conv.bias",
+"first_stage_model.encoder.down.0.downsample.conv.weight",
+"first_stage_model.encoder.mid.attn_1.k.bias",
+"first_stage_model.encoder.mid.attn_1.k.weight",
+"first_stage_model.encoder.mid.attn_1.norm.bias",
+"first_stage_model.encoder.mid.attn_1.norm.weight",
+"first_stage_model.encoder.mid.attn_1.proj_out.bias",
+"first_stage_model.encoder.mid.attn_1.proj_out.weight",
+"first_stage_model.encoder.mid.attn_1.q.bias",
+"first_stage_model.encoder.mid.attn_1.q.weight",
+"first_stage_model.encoder.mid.attn_1.v.bias",
+"first_stage_model.encoder.mid.attn_1.v.weight",
+"first_stage_model.encoder.mid.block_1.conv1.bias",
+"first_stage_model.encoder.mid.block_1.conv1.weight",
+"first_stage_model.encoder.mid.block_1.conv2.bias",
+"first_stage_model.encoder.mid.block_1.conv2.weight",
+"first_stage_model.encoder.mid.block_1.norm1.bias",
+"first_stage_model.encoder.mid.block_1.norm1.weight",
+"first_stage_model.encoder.mid.block_1.norm2.bias",
+"first_stage_model.encoder.mid.block_1.norm2.weight",
+"first_stage_model.encoder.mid.block_2.conv1.bias",
+"first_stage_model.encoder.mid.block_2.conv1.weight",
+"first_stage_model.encoder.mid.block_2.conv2.bias",
+"first_stage_model.encoder.mid.block_2.conv2.weight",
+"first_stage_model.encoder.mid.block_2.norm1.bias",
+"first_stage_model.encoder.mid.block_2.norm1.weight",
+"first_stage_model.encoder.mid.block_2.norm2.bias",
+"first_stage_model.encoder.mid.block_2.norm2.weight",
+"first_stage_model.encoder.norm_out.bias",
+"first_stage_model.encoder.norm_out.weight",
+"first_stage_model.post_quant_conv.bias",
+"first_stage_model.post_quant_conv.weight",
+"first_stage_model.quant_conv.bias",
+"first_stage_model.quant_conv.weight",
+"log_one_minus_alphas_cumprod",
+"model.diffusion_model.input_blocks.0.0.bias",
+"model.diffusion_model.input_blocks.0.0.weight",
+"model.diffusion_model.middle_block.0.in_layers.0.bias",
+"model.diffusion_model.middle_block.0.in_layers.0.weight",
+"model.diffusion_model.middle_block.0.out_layers.0.bias",
+"model.diffusion_model.middle_block.0.out_layers.0.weight",
+"model.diffusion_model.out.0.bias",
+"model.diffusion_model.out.0.weight",
+"model.diffusion_model.output_blocks.0.0.in_layers.0.bias",
+"model.diffusion_model.output_blocks.0.0.in_layers.0.weight",
+"model.diffusion_model.output_blocks.0.0.out_layers.0.bias",
+"model.diffusion_model.output_blocks.0.0.out_layers.0.weight",
+"model.diffusion_model.output_blocks.0.0.skip_connection.bias",
+"model.diffusion_model.output_blocks.0.0.skip_connection.weight",
+"model.diffusion_model.time_embed.0.bias",
+"model.diffusion_model.time_embed.0.weight",
+"model_ema.decay",
+"model_ema.num_updates",
+"posterior_log_variance_clipped",
+"posterior_mean_coef1",
+"posterior_mean_coef2",
+"posterior_variance",
+"sqrt_alphas_cumprod",
+"sqrt_one_minus_alphas_cumprod",
+"sqrt_recip_alphas_cumprod",
+"sqrt_recipm1_alphas_cumprod"
+],
+"shapes": {}
+}
\ No newline at end of file
diff --git a/src-tauri/tests/fixtures/model_headers/sdxl-base.json b/src-tauri/tests/fixtures/model_headers/sdxl-base.json
new file mode 100644
index 00000000..9b74fd2e
--- /dev/null
+++ b/src-tauri/tests/fixtures/model_headers/sdxl-base.json
@@ -0,0 +1,161 @@
+{
+"source": "huggingface.co/stabilityai/stable-diffusion-xl-base-1.0 sd_xl_base_1.0.safetensors",
+"note": "real safetensors header, read 14.11.2026 by range request; keys of block 0 and the keys outside the blocks, no weights",
+"tensors": 2515,
+"keys": [
+"conditioner.embedders.0.transformer.text_model.embeddings.position_embedding.weight",
+"conditioner.embedders.0.transformer.text_model.embeddings.position_ids",
+"conditioner.embedders.0.transformer.text_model.embeddings.token_embedding.weight",
+"conditioner.embedders.0.transformer.text_model.encoder.layers.0.layer_norm1.bias",
+"conditioner.embedders.0.transformer.text_model.encoder.layers.0.layer_norm1.weight",
+"conditioner.embedders.0.transformer.text_model.encoder.layers.0.layer_norm2.bias",
+"conditioner.embedders.0.transformer.text_model.encoder.layers.0.layer_norm2.weight",
+"conditioner.embedders.0.transformer.text_model.encoder.layers.0.mlp.fc1.bias",
+"conditioner.embedders.0.transformer.text_model.encoder.layers.0.mlp.fc1.weight",
+"conditioner.embedders.0.transformer.text_model.encoder.layers.0.mlp.fc2.bias",
+"conditioner.embedders.0.transformer.text_model.encoder.layers.0.mlp.fc2.weight",
+"conditioner.embedders.0.transformer.text_model.encoder.layers.0.self_attn.k_proj.bias",
+"conditioner.embedders.0.transformer.text_model.encoder.layers.0.self_attn.k_proj.weight",
+"conditioner.embedders.0.transformer.text_model.encoder.layers.0.self_attn.out_proj.bias",
+"conditioner.embedders.0.transformer.text_model.encoder.layers.0.self_attn.out_proj.weight",
+"conditioner.embedders.0.transformer.text_model.encoder.layers.0.self_attn.q_proj.bias",
+"conditioner.embedders.0.transformer.text_model.encoder.layers.0.self_attn.q_proj.weight",
+"conditioner.embedders.0.transformer.text_model.encoder.layers.0.self_attn.v_proj.bias",
+"conditioner.embedders.0.transformer.text_model.encoder.layers.0.self_attn.v_proj.weight",
+"conditioner.embedders.0.transformer.text_model.final_layer_norm.bias",
+"conditioner.embedders.0.transformer.text_model.final_layer_norm.weight",
+"first_stage_model.decoder.conv_in.bias",
+"first_stage_model.decoder.conv_in.weight",
+"first_stage_model.decoder.conv_out.bias",
+"first_stage_model.decoder.conv_out.weight",
+"first_stage_model.decoder.mid.attn_1.k.bias",
+"first_stage_model.decoder.mid.attn_1.k.weight",
+"first_stage_model.decoder.mid.attn_1.norm.bias",
+"first_stage_model.decoder.mid.attn_1.norm.weight",
+"first_stage_model.decoder.mid.attn_1.proj_out.bias",
+"first_stage_model.decoder.mid.attn_1.proj_out.weight",
+"first_stage_model.decoder.mid.attn_1.q.bias",
+"first_stage_model.decoder.mid.attn_1.q.weight",
+"first_stage_model.decoder.mid.attn_1.v.bias",
+"first_stage_model.decoder.mid.attn_1.v.weight",
+"first_stage_model.decoder.mid.block_1.conv1.bias",
+"first_stage_model.decoder.mid.block_1.conv1.weight",
+"first_stage_model.decoder.mid.block_1.conv2.bias",
+"first_stage_model.decoder.mid.block_1.conv2.weight",
+"first_stage_model.decoder.mid.block_1.norm1.bias",
+"first_stage_model.decoder.mid.block_1.norm1.weight",
+"first_stage_model.decoder.mid.block_1.norm2.bias",
+"first_stage_model.decoder.mid.block_1.norm2.weight",
+"first_stage_model.decoder.mid.block_2.conv1.bias",
+"first_stage_model.decoder.mid.block_2.conv1.weight",
+"first_stage_model.decoder.mid.block_2.conv2.bias",
+"first_stage_model.decoder.mid.block_2.conv2.weight",
+"first_stage_model.decoder.mid.block_2.norm1.bias",
+"first_stage_model.decoder.mid.block_2.norm1.weight",
+"first_stage_model.decoder.mid.block_2.norm2.bias",
+"first_stage_model.decoder.mid.block_2.norm2.weight",
+"first_stage_model.decoder.norm_out.bias",
+"first_stage_model.decoder.norm_out.weight",
+"first_stage_model.decoder.up.0.block.0.conv1.bias",
+"first_stage_model.decoder.up.0.block.0.conv1.weight",
+"first_stage_model.decoder.up.0.block.0.conv2.bias",
+"first_stage_model.decoder.up.0.block.0.conv2.weight",
+"first_stage_model.decoder.up.0.block.0.nin_shortcut.bias",
+"first_stage_model.decoder.up.0.block.0.nin_shortcut.weight",
+"first_stage_model.decoder.up.0.block.0.norm1.bias",
+"first_stage_model.decoder.up.0.block.0.norm1.weight",
+"first_stage_model.decoder.up.0.block.0.norm2.bias",
+"first_stage_model.decoder.up.0.block.0.norm2.weight",
+"first_stage_model.encoder.conv_in.bias",
+"first_stage_model.encoder.conv_in.weight",
+"first_stage_model.encoder.conv_out.bias",
+"first_stage_model.encoder.conv_out.weight",
+"first_stage_model.encoder.down.0.block.0.conv1.bias",
+"first_stage_model.encoder.down.0.block.0.conv1.weight",
+"first_stage_model.encoder.down.0.block.0.conv2.bias",
+"first_stage_model.encoder.down.0.block.0.conv2.weight",
+"first_stage_model.encoder.down.0.block.0.norm1.bias",
+"first_stage_model.encoder.down.0.block.0.norm1.weight",
+"first_stage_model.encoder.down.0.block.0.norm2.bias",
+"first_stage_model.encoder.down.0.block.0.norm2.weight",
+"first_stage_model.encoder.down.0.downsample.conv.bias",
+"first_stage_model.encoder.down.0.downsample.conv.weight",
+"first_stage_model.encoder.mid.attn_1.k.bias",
+"first_stage_model.encoder.mid.attn_1.k.weight",
+"first_stage_model.encoder.mid.attn_1.norm.bias",
+"first_stage_model.encoder.mid.attn_1.norm.weight",
+"first_stage_model.encoder.mid.attn_1.proj_out.bias",
+"first_stage_model.encoder.mid.attn_1.proj_out.weight",
+"first_stage_model.encoder.mid.attn_1.q.bias",
+"first_stage_model.encoder.mid.attn_1.q.weight",
+"first_stage_model.encoder.mid.attn_1.v.bias",
+"first_stage_model.encoder.mid.attn_1.v.weight",
+"first_stage_model.encoder.mid.block_1.conv1.bias",
+"first_stage_model.encoder.mid.block_1.conv1.weight",
+"first_stage_model.encoder.mid.block_1.conv2.bias",
+"first_stage_model.encoder.mid.block_1.conv2.weight",
+"first_stage_model.encoder.mid.block_1.norm1.bias",
+"first_stage_model.encoder.mid.block_1.norm1.weight",
+"first_stage_model.encoder.mid.block_1.norm2.bias",
+"first_stage_model.encoder.mid.block_1.norm2.weight",
+"first_stage_model.encoder.mid.block_2.conv1.bias",
+"first_stage_model.encoder.mid.block_2.conv1.weight",
+"first_stage_model.encoder.mid.block_2.conv2.bias",
+"first_stage_model.encoder.mid.block_2.conv2.weight",
+"first_stage_model.encoder.mid.block_2.norm1.bias",
+"first_stage_model.encoder.mid.block_2.norm1.weight",
+"first_stage_model.encoder.mid.block_2.norm2.bias",
+"first_stage_model.encoder.mid.block_2.norm2.weight",
+"first_stage_model.encoder.norm_out.bias",
+"first_stage_model.encoder.norm_out.weight",
+"first_stage_model.post_quant_conv.bias",
+"first_stage_model.post_quant_conv.weight",
+"first_stage_model.quant_conv.bias",
+"first_stage_model.quant_conv.weight",
+"model.diffusion_model.input_blocks.0.0.bias",
+"model.diffusion_model.input_blocks.0.0.weight",
+"model.diffusion_model.label_emb.0.0.bias",
+"model.diffusion_model.label_emb.0.0.weight",
+"model.diffusion_model.label_emb.0.2.bias",
+"model.diffusion_model.label_emb.0.2.weight",
+"model.diffusion_model.middle_block.0.in_layers.0.bias",
+"model.diffusion_model.middle_block.0.in_layers.0.weight",
+"model.diffusion_model.middle_block.0.out_layers.0.bias",
+"model.diffusion_model.middle_block.0.out_layers.0.weight",
+"model.diffusion_model.out.0.bias",
+"model.diffusion_model.out.0.weight",
+"model.diffusion_model.output_blocks.0.0.in_layers.0.bias",
+"model.diffusion_model.output_blocks.0.0.in_layers.0.weight",
+"model.diffusion_model.output_blocks.0.0.out_layers.0.bias",
+"model.diffusion_model.output_blocks.0.0.out_layers.0.weight",
+"model.diffusion_model.output_blocks.0.0.skip_connection.bias",
+"model.diffusion_model.output_blocks.0.0.skip_connection.weight",
+"model.diffusion_model.output_blocks.0.1.norm.bias",
+"model.diffusion_model.output_blocks.0.1.norm.weight",
+"model.diffusion_model.output_blocks.0.1.proj_in.bias",
+"model.diffusion_model.output_blocks.0.1.proj_in.weight",
+"model.diffusion_model.output_blocks.0.1.proj_out.bias",
+"model.diffusion_model.output_blocks.0.1.proj_out.weight",
+"model.diffusion_model.output_blocks.0.1.transformer_blocks.0.attn1.to_k.weight",
+"model.diffusion_model.output_blocks.0.1.transformer_blocks.0.attn1.to_out.0.bias",
+"model.diffusion_model.output_blocks.0.1.transformer_blocks.0.attn1.to_out.0.weight",
+"model.diffusion_model.output_blocks.0.1.transformer_blocks.0.attn1.to_q.weight",
+"model.diffusion_model.output_blocks.0.1.transformer_blocks.0.attn1.to_v.weight",
+"model.diffusion_model.output_blocks.0.1.transformer_blocks.0.attn2.to_k.weight",
+"model.diffusion_model.output_blocks.0.1.transformer_blocks.0.attn2.to_out.0.bias",
+"model.diffusion_model.output_blocks.0.1.transformer_blocks.0.attn2.to_out.0.weight",
+"model.diffusion_model.output_blocks.0.1.transformer_blocks.0.attn2.to_q.weight",
+"model.diffusion_model.output_blocks.0.1.transformer_blocks.0.attn2.to_v.weight",
+"model.diffusion_model.output_blocks.0.1.transformer_blocks.0.ff.net.0.proj.bias",
+"model.diffusion_model.output_blocks.0.1.transformer_blocks.0.ff.net.0.proj.weight",
+"model.diffusion_model.output_blocks.0.1.transformer_blocks.0.norm1.bias",
+"model.diffusion_model.output_blocks.0.1.transformer_blocks.0.norm1.weight",
+"model.diffusion_model.output_blocks.0.1.transformer_blocks.0.norm2.bias",
+"model.diffusion_model.output_blocks.0.1.transformer_blocks.0.norm2.weight",
+"model.diffusion_model.output_blocks.0.1.transformer_blocks.0.norm3.bias",
+"model.diffusion_model.output_blocks.0.1.transformer_blocks.0.norm3.weight",
+"model.diffusion_model.time_embed.0.bias",
+"model.diffusion_model.time_embed.0.weight"
+],
+"shapes": {}
+}
\ No newline at end of file
diff --git a/src-tauri/tests/fixtures/model_headers/wan21-1.3b.json b/src-tauri/tests/fixtures/model_headers/wan21-1.3b.json
new file mode 100644
index 00000000..58e7c5ac
--- /dev/null
+++ b/src-tauri/tests/fixtures/model_headers/wan21-1.3b.json
@@ -0,0 +1,42 @@
+{
+"source": "huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged split_files/diffusion_models/wan2.1_t2v_1.3B_bf16.safetensors",
+"note": "real safetensors header, read 14.11.2026 by range request; keys of block 0 and the keys outside the blocks, no weights",
+"tensors": 825,
+"keys": [
+"model.diffusion_model.blocks.0.cross_attn.k.bias",
+"model.diffusion_model.blocks.0.cross_attn.k.weight",
+"model.diffusion_model.blocks.0.cross_attn.norm_k.weight",
+"model.diffusion_model.blocks.0.cross_attn.norm_q.weight",
+"model.diffusion_model.blocks.0.cross_attn.o.bias",
+"model.diffusion_model.blocks.0.cross_attn.o.weight",
+"model.diffusion_model.blocks.0.cross_attn.q.bias",
+"model.diffusion_model.blocks.0.cross_attn.q.weight",
+"model.diffusion_model.blocks.0.cross_attn.v.bias",
+"model.diffusion_model.blocks.0.cross_attn.v.weight",
+"model.diffusion_model.blocks.0.ffn.0.bias",
+"model.diffusion_model.blocks.0.ffn.0.weight",
+"model.diffusion_model.blocks.0.modulation",
+"model.diffusion_model.blocks.0.norm3.bias",
+"model.diffusion_model.blocks.0.norm3.weight",
+"model.diffusion_model.blocks.0.self_attn.k.bias",
+"model.diffusion_model.blocks.0.self_attn.k.weight",
+"model.diffusion_model.blocks.0.self_attn.norm_k.weight",
+"model.diffusion_model.blocks.0.self_attn.norm_q.weight",
+"model.diffusion_model.blocks.0.self_attn.o.bias",
+"model.diffusion_model.blocks.0.self_attn.o.weight",
+"model.diffusion_model.blocks.0.self_attn.q.bias",
+"model.diffusion_model.blocks.0.self_attn.q.weight",
+"model.diffusion_model.blocks.0.self_attn.v.bias",
+"model.diffusion_model.blocks.0.self_attn.v.weight",
+"model.diffusion_model.head.head.bias",
+"model.diffusion_model.head.head.weight",
+"model.diffusion_model.head.modulation",
+"model.diffusion_model.patch_embedding.bias",
+"model.diffusion_model.patch_embedding.weight",
+"model.diffusion_model.text_embedding.0.bias",
+"model.diffusion_model.text_embedding.0.weight",
+"model.diffusion_model.time_embedding.0.bias",
+"model.diffusion_model.time_embedding.0.weight"
+],
+"shapes": {}
+}
\ No newline at end of file
diff --git a/src-tauri/tests/fixtures/model_headers/wan22-5b.json b/src-tauri/tests/fixtures/model_headers/wan22-5b.json
new file mode 100644
index 00000000..e4f6c407
--- /dev/null
+++ b/src-tauri/tests/fixtures/model_headers/wan22-5b.json
@@ -0,0 +1,42 @@
+{
+"source": "huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged split_files/diffusion_models/wan2.2_ti2v_5B_fp16.safetensors",
+"note": "real safetensors header, read 14.11.2026 by range request; keys of block 0 and the keys outside the blocks, no weights",
+"tensors": 825,
+"keys": [
+"blocks.0.cross_attn.k.bias",
+"blocks.0.cross_attn.k.weight",
+"blocks.0.cross_attn.norm_k.weight",
+"blocks.0.cross_attn.norm_q.weight",
+"blocks.0.cross_attn.o.bias",
+"blocks.0.cross_attn.o.weight",
+"blocks.0.cross_attn.q.bias",
+"blocks.0.cross_attn.q.weight",
+"blocks.0.cross_attn.v.bias",
+"blocks.0.cross_attn.v.weight",
+"blocks.0.ffn.0.bias",
+"blocks.0.ffn.0.weight",
+"blocks.0.modulation",
+"blocks.0.norm3.bias",
+"blocks.0.norm3.weight",
+"blocks.0.self_attn.k.bias",
+"blocks.0.self_attn.k.weight",
+"blocks.0.self_attn.norm_k.weight",
+"blocks.0.self_attn.norm_q.weight",
+"blocks.0.self_attn.o.bias",
+"blocks.0.self_attn.o.weight",
+"blocks.0.self_attn.q.bias",
+"blocks.0.self_attn.q.weight",
+"blocks.0.self_attn.v.bias",
+"blocks.0.self_attn.v.weight",
+"head.head.bias",
+"head.head.weight",
+"head.modulation",
+"patch_embedding.bias",
+"patch_embedding.weight",
+"text_embedding.0.bias",
+"text_embedding.0.weight",
+"time_embedding.0.bias",
+"time_embedding.0.weight"
+],
+"shapes": {}
+}
\ No newline at end of file
diff --git a/src-tauri/tests/fixtures/model_headers/zimage-turbo.json b/src-tauri/tests/fixtures/model_headers/zimage-turbo.json
new file mode 100644
index 00000000..42029862
--- /dev/null
+++ b/src-tauri/tests/fixtures/model_headers/zimage-turbo.json
@@ -0,0 +1,58 @@
+{
+"source": "huggingface.co/Comfy-Org/z_image_turbo split_files/diffusion_models/z_image_turbo_bf16.safetensors",
+"note": "real safetensors header, read 14.11.2026 by range request; keys of block 0 and the keys outside the blocks, no weights",
+"tensors": 453,
+"keys": [
+"cap_embedder.0.weight",
+"cap_pad_token",
+"context_refiner.0.attention.k_norm.weight",
+"context_refiner.0.attention.out.weight",
+"context_refiner.0.attention.q_norm.weight",
+"context_refiner.0.attention.qkv.weight",
+"context_refiner.0.attention_norm1.weight",
+"context_refiner.0.attention_norm2.weight",
+"context_refiner.0.feed_forward.w1.weight",
+"context_refiner.0.feed_forward.w2.weight",
+"context_refiner.0.feed_forward.w3.weight",
+"context_refiner.0.ffn_norm1.weight",
+"context_refiner.0.ffn_norm2.weight",
+"final_layer.linear.bias",
+"final_layer.linear.weight",
+"layers.0.adaLN_modulation.0.bias",
+"layers.0.adaLN_modulation.0.weight",
+"layers.0.attention.k_norm.weight",
+"layers.0.attention.out.weight",
+"layers.0.attention.q_norm.weight",
+"layers.0.attention.qkv.weight",
+"layers.0.attention_norm1.weight",
+"layers.0.attention_norm2.weight",
+"layers.0.feed_forward.w1.weight",
+"layers.0.feed_forward.w2.weight",
+"layers.0.feed_forward.w3.weight",
+"layers.0.ffn_norm1.weight",
+"layers.0.ffn_norm2.weight",
+"noise_refiner.0.adaLN_modulation.0.bias",
+"noise_refiner.0.adaLN_modulation.0.weight",
+"noise_refiner.0.attention.k_norm.weight",
+"noise_refiner.0.attention.out.weight",
+"noise_refiner.0.attention.q_norm.weight",
+"noise_refiner.0.attention.qkv.weight",
+"noise_refiner.0.attention_norm1.weight",
+"noise_refiner.0.attention_norm2.weight",
+"noise_refiner.0.feed_forward.w1.weight",
+"noise_refiner.0.feed_forward.w2.weight",
+"noise_refiner.0.feed_forward.w3.weight",
+"noise_refiner.0.ffn_norm1.weight",
+"noise_refiner.0.ffn_norm2.weight",
+"t_embedder.mlp.0.bias",
+"t_embedder.mlp.0.weight",
+"x_embedder.bias",
+"x_embedder.weight",
+"x_pad_token"
+],
+"shapes": {
+"cap_embedder.0.weight": [
+2560
+]
+}
+}
\ No newline at end of file
diff --git a/src/api/__tests__/a-civitai-hit-on-disk-says-installed.test.ts b/src/api/__tests__/a-civitai-hit-on-disk-says-installed.test.ts
index 809bf8ee..72f8061a 100644
--- a/src/api/__tests__/a-civitai-hit-on-disk-says-installed.test.ts
+++ b/src/api/__tests__/a-civitai-hit-on-disk-says-installed.test.ts
@@ -60,7 +60,10 @@ describe('checkCivitaiInstalled', () => {
it('marks only the hit whose file lies in its own folder with its own size', async () => {
const same = hit(1, 'juggernautXL_v9.safetensors', 'checkpoints', 6_938_040_682)
const otherVersion = hit(2, 'detail_tweaker.safetensors', 'loras', 151_110_000)
- const otherFolder = hit(3, 'flux_dev_fp8.safetensors', 'diffusion_models', 11_900_000_000)
+ // A27 (3.1.0): checkpoints and diffusion_models count as one place here,
+ // since a download from the search moves between them by its header. A
+ // LoRA folder is still another place.
+ const otherFolder = hit(3, 'flux_dev_fp8.safetensors', 'loras', 11_900_000_000)
disk['checkpoints/juggernautXL_v9.safetensors'] = 6_938_040_682
disk['loras/detail_tweaker.safetensors'] = 151_110_000 + 37_000_000
disk['checkpoints/flux_dev_fp8.safetensors'] = 11_900_000_000
@@ -71,7 +74,7 @@ describe('checkCivitaiInstalled', () => {
// One question to the existing per-file check, no folder scan of its own.
expect(backendCall).toHaveBeenCalledTimes(1)
expect(backendCall.mock.calls[0][1].files.map((f: { subfolder: string }) => f.subfolder))
- .toEqual(['checkpoints', 'loras', 'diffusion_models'])
+ .toEqual(['checkpoints', 'diffusion_models', 'loras', 'loras'])
})
it('takes the name alone where CivitAI states no size', async () => {
diff --git a/src/api/__tests__/a-downloaded-model-lands-in-the-folder-its-header-names.test.ts b/src/api/__tests__/a-downloaded-model-lands-in-the-folder-its-header-names.test.ts
new file mode 100644
index 00000000..c2962509
--- /dev/null
+++ b/src/api/__tests__/a-downloaded-model-lands-in-the-folder-its-header-names.test.ts
@@ -0,0 +1,121 @@
+/**
+ * A27 (3.1.0, GitHub #234, Kubuntu, RTX 5090): diffusion and video models
+ * downloaded through the CivitAI search landed in models/checkpoints. The
+ * folder came from the title alone; only flux, wan, hunyuan and .gguf went
+ * to diffusion_models. LTX, MiniMax H3, Qwen-Image, Z-Image, Chroma, Krea,
+ * Mochi, CogVideoX and Wan offshoots went to checkpoints, where ComfyUI's
+ * checkpoint loader cannot load a bare diffusion model.
+ *
+ * The fix is in Rust (model_sniff.rs settle_by_header, tested there against
+ * real headers): after the transfer the file's header names its folder and
+ * the file moves there. This side only has to ask for it on every download
+ * whose folder is a guess, and on no other one.
+ *
+ * Run: npx vitest run src/api/__tests__/a-downloaded-model-lands-in-the-folder-its-header-names.test.ts
+ */
+import { describe, it, expect, beforeEach, vi } from 'vitest'
+
+const backendCall = vi.fn()
+vi.mock('../backend', () => ({
+ backendCall: (...args: unknown[]) => backendCall(...args),
+ fetchExternal: vi.fn(),
+ isTauri: () => true,
+ isMacOS: () => false,
+ secretGet: vi.fn().mockRejectedValue(new Error('no keychain here')),
+ secretSet: vi.fn(),
+ secretDelete: vi.fn(),
+}))
+
+import {
+ civitaiSubfolder, checkCivitaiInstalled, folderIsAGuess, resumeDownload, startChatLinkDownload,
+ startCivitaiDownload, startModelDownload, type CivitAIModelResult,
+} from '../discover'
+import { wrongFolderNote } from '../../components/models/ModelFileInfo'
+
+const callsTo = (cmd: string) => backendCall.mock.calls.filter((c) => c[0] === cmd).map((c) => c[1] as Record<string, unknown>)
+
+beforeEach(() => {
+ backendCall.mockReset()
+ backendCall.mockImplementation(async () => ({ status: 'started', id: 'x' }))
+})
+
+describe('the bug: the title alone picks the folder', () => {
+ it.each([
+ 'LTX Video 2B distilled', 'MiniMax H3', 'Qwen-Image 2512', 'Z-Image Turbo', 'Chroma1-HD',
+ 'Krea 2', 'Mochi 1 preview', 'CogVideoX 5B', 'Rapid AIO Mega v12',
+ ])('%s goes to checkpoints by its title', (title) => {
+ expect(civitaiSubfolder('Checkpoint', title, 'model.safetensors')).toBe('checkpoints')
+ })
+
+ it('which is why a title guess is marked for the header to decide', () => {
+ expect(folderIsAGuess('checkpoints')).toBe(true)
+ expect(folderIsAGuess('diffusion_models')).toBe(true)
+ expect(folderIsAGuess('unet')).toBe(true)
+ for (const f of ['loras', 'vae', 'embeddings', 'text_encoders', 'upscale_models']) expect(folderIsAGuess(f)).toBe(false)
+ })
+})
+
+describe('which downloads ask the header', () => {
+ it('a CivitAI checkpoint hit does', async () => {
+ await startCivitaiDownload({ downloadUrl: 'https://civitai.com/api/download/models/1', filename: 'ltx.safetensors', subfolder: 'checkpoints' })
+ expect(callsTo('download_model')[0]).toMatchObject({ subfolder: 'checkpoints', filename: 'ltx.safetensors', sniffFolder: true })
+ })
+
+ it('a CivitAI LoRA does not: its search type says what it is', async () => {
+ await startCivitaiDownload({ downloadUrl: 'https://civitai.com/api/download/models/2', filename: 'style.safetensors', subfolder: 'loras' })
+ expect(callsTo('download_model')[0]).not.toHaveProperty('sniffFolder')
+ })
+
+ it('a link the chat agent downloads into a main model folder does', async () => {
+ await startChatLinkDownload('https://huggingface.co/a/b/resolve/main/m.safetensors', 'diffusion_models', 'm.safetensors')
+ await startChatLinkDownload('https://huggingface.co/a/b/resolve/main/l.safetensors', 'loras', 'l.safetensors')
+ const [main, lora] = callsTo('download_model')
+ expect(main).toMatchObject({ chatOrigin: true, sniffFolder: true })
+ expect(lora).not.toHaveProperty('sniffFolder')
+ })
+
+ it('NEGATIVE CONTROL: a catalog bundle file does not; its folder is the catalog\'s and its install check looks there', async () => {
+ await startModelDownload('https://huggingface.co/Comfy-Org/x/resolve/main/m.safetensors', 'checkpoints', 'm.safetensors', 1000, 'a'.repeat(64))
+ expect(callsTo('download_model')[0]).not.toHaveProperty('sniffFolder')
+ })
+
+ it('a resume keeps asking', async () => {
+ await resumeDownload('ltx.safetensors', 'https://civitai.com/api/download/models/1', 'checkpoints', undefined, undefined, true)
+ await resumeDownload('m.safetensors', 'https://huggingface.co/x/m.safetensors', 'checkpoints')
+ const [civitai, catalog] = callsTo('resume_download')
+ expect(civitai).toMatchObject({ sniffFolder: true })
+ expect(catalog).not.toHaveProperty('sniffFolder')
+ })
+})
+
+describe('after the move', () => {
+ const hit = (subfolder: string): CivitAIModelResult => ({
+ id: 7, name: 'LTX distilled', description: '', type: 'Checkpoint', sourceUrl: 'https://civitai.com/models/7',
+ downloadUrl: 'https://civitai.com/api/download/models/7', filename: 'ltx.safetensors', subfolder, sizeBytes: 2048,
+ })
+
+ it('the hit still shows as installed when its file now sits in diffusion_models', async () => {
+ backendCall.mockImplementation(async (cmd: string, args: { files: Array<{ subfolder: string; filename: string }> }) => {
+ if (cmd !== 'check_model_sizes') throw new Error(cmd)
+ return args.files.map((f) => ({ filename: f.filename, exists: f.subfolder === 'diffusion_models', actualBytes: f.subfolder === 'diffusion_models' ? 2048 : 0 }))
+ })
+ expect(await checkCivitaiInstalled([hit('checkpoints')])).toEqual(new Set([7]))
+ })
+
+ it('NEGATIVE CONTROL: a LoRA hit is looked for in loras only', async () => {
+ backendCall.mockImplementation(async (_cmd: string, args: { files: Array<{ subfolder: string; filename: string }> }) =>
+ args.files.map((f) => ({ filename: f.filename, exists: f.subfolder !== 'loras', actualBytes: 2048 })))
+ const lora = { ...hit('loras'), type: 'LORA' }
+ expect(await checkCivitaiInstalled([lora])).toEqual(new Set())
+ expect(callsTo('check_model_sizes')[0].files).toEqual([{ subfolder: 'loras', filename: 'ltx.safetensors', expectedBytes: 2048 }])
+ })
+})
+
+describe('a file that already sits in the wrong folder', () => {
+ it('is named in Details, with where it belongs and why, and never moved', () => {
+ const note = wrongFolderNote('checkpoints', 'diffusion_models')
+ expect(note).toContain('belongs in diffusion_models, not checkpoints')
+ expect(note).toContain('Move it there by hand')
+ expect(wrongFolderNote('diffusion_models', 'checkpoints')).toContain('its own VAE')
+ })
+})
diff --git a/src/api/discover.ts b/src/api/discover.ts
index b293d765..c36ae96c 100644
--- a/src/api/discover.ts
+++ b/src/api/discover.ts
@@ -1,4 +1,5 @@
import { backendCall, fetchExternal } from "./backend"
+import { folderIsAGuess } from '../lib/model-folder-guess'
import { readComfyFolderLists, filterPartialFiles, refreshComfyModels } from "./comfyui"
import { COMPONENT_REGISTRY, type ComponentSpec, type ComponentRequirements } from './component-registry'
import { clearNodeCache, getAllNodeInfo } from "./comfyui-nodes"
@@ -77,7 +78,12 @@ export function civitaiAuthToken(url: string): string | null {
return key ? key : null
}
-export async function startModelDownload(url: string, subfolder: string, filename: string, expectedBytes?: number, sha256?: string): Promise<{ status: string; id: string; error?: string }> {
+export { folderIsAGuess }
+
+export async function startModelDownload(
+ url: string, subfolder: string, filename: string, expectedBytes?: number, sha256?: string,
+ opts: { sniffFolder?: boolean } = {},
+): Promise<{ status: string; id: string; error?: string }> {
// D1: the page this file came from, for Details in Models.
recordSourceFromDownload(filename, url)
return backendCall("download_model", {
@@ -87,6 +93,7 @@ export async function startModelDownload(url: string, subfolder: string, filenam
expectedBytes: expectedBytes ?? null,
expectedSha256: sha256 ?? null,
authToken: civitaiAuthToken(url),
+ ...(opts.sniffFolder ? { sniffFolder: true } : {}),
})
}
@@ -105,6 +112,8 @@ export async function startChatLinkDownload(url: string, subfolder: string, file
expectedSha256: null,
authToken: civitaiAuthToken(url),
chatOrigin: true,
+ // A27: the agent picks the folder from the link and the page, a guess.
+ ...(folderIsAGuess(subfolder) ? { sniffFolder: true } : {}),
})
}
@@ -119,6 +128,10 @@ export interface ComfyFileFacts {
ownFolder: boolean
/** How many copies of that name the model folders hold. */
copies: number
+ /** A27: the main model folder the file's header names, when it sits in another one. */
+ belongsIn?: string
+ /** A27: the main model folder it sits in, set with `belongsIn`. */
+ foundIn?: string
}
/** Details for a ComfyUI file of the Installed list. Throws with the reason. */
@@ -228,7 +241,7 @@ export function isPermanentDownloadError(error?: string | null): boolean {
return !!error && PERMANENT_HTTP.test(error)
}
-export async function resumeDownload(id: string, url: string, subfolder: string, expectedBytes?: number, sha256?: string): Promise<void> {
+export async function resumeDownload(id: string, url: string, subfolder: string, expectedBytes?: number, sha256?: string, sniffFolder?: boolean): Promise<void> {
await backendCall("resume_download", {
id,
url,
@@ -236,6 +249,7 @@ export async function resumeDownload(id: string, url: string, subfolder: string,
expectedBytes: expectedBytes ?? null,
expectedSha256: sha256 ?? null,
authToken: civitaiAuthToken(url),
+ ...(sniffFolder ? { sniffFolder: true } : {}),
...titleArg(id),
})
}
@@ -2577,7 +2591,8 @@ export function isGgufFile(filename: string | undefined): boolean {
*/
export async function startCivitaiDownload(model: { downloadUrl?: string; filename?: string; subfolder?: string }): Promise<void> {
if (!model.downloadUrl || !model.filename || !model.subfolder) return
- await startModelDownload(model.downloadUrl, model.subfolder, model.filename)
+ // A27: the folder came from the title; the header of the file decides.
+ await startModelDownload(model.downloadUrl, model.subfolder, model.filename, undefined, undefined, { sniffFolder: folderIsAGuess(model.subfolder) })
if (!isGgufFile(model.filename)) return
const target = await comfyModelTarget()
if (target.remote) return
@@ -2611,13 +2626,17 @@ export async function checkCivitaiInstalled(models: readonly CivitAIModelResult[
const installed = new Set<number>()
const asked = models.filter((m) => m.filename && m.subfolder)
if (asked.length === 0) return installed
+ // A27: a download from here may have been moved by its header to the other
+ // main model folder; the hit is installed there too.
+ const sibling = (f: string) => (f === 'checkpoints' ? 'diffusion_models' : 'checkpoints')
+ const pairs = asked.flatMap((m) => (folderIsAGuess(m.subfolder!) ? [m.subfolder!, sibling(m.subfolder!)] : [m.subfolder!]).map((subfolder) => ({ m, subfolder })))
try {
const results: Array<{ filename: string; exists: boolean; actualBytes: number }> = await backendCall('check_model_sizes', {
- files: asked.map((m) => ({ subfolder: m.subfolder!, filename: m.filename!, expectedBytes: m.sizeBytes ?? 0 })),
+ files: pairs.map(({ m, subfolder }) => ({ subfolder, filename: m.filename!, expectedBytes: m.sizeBytes ?? 0 })),
})
// One answer per file and in order: two hits may share a file name and
// differ only in their folder, so the name alone cannot pair them up.
- asked.forEach((m, i) => {
+ pairs.forEach(({ m }, i) => {
const r = results[i]
if (r && r.filename === m.filename && r.exists && civitaiFileMatches(m, r.actualBytes)) installed.add(m.id)
})
diff --git a/src/components/models/CivitaiSearchPanel.tsx b/src/components/models/CivitaiSearchPanel.tsx
index e926602c..5c6af6f8 100644
--- a/src/components/models/CivitaiSearchPanel.tsx
+++ b/src/components/models/CivitaiSearchPanel.tsx
@@ -10,6 +10,7 @@
import { useEffect, useMemo, useRef, useState } from 'react'
import { Search, Loader2, ExternalLink, Download, CheckCircle, Info } from 'lucide-react'
import { useModelSourceStore } from '../../stores/modelSourceStore'
+import { folderIsAGuess } from '../../lib/model-folder-guess'
import { checkCivitaiInstalled, civitaiHitWithFile, civitaiInstalledInFolder, searchCivitaiModels, startCivitaiDownload, startModelDownloadToPath, type CivitAIModelResult } from '../../api/discover'
import { CivitaiHitDetails } from './CivitaiHitDetails'
import { usePageMemoryStore } from '../../stores/pageMemoryStore'
@@ -148,7 +149,9 @@ export function CivitaiSearchPanel({ modelType, title, placeholder, search = '',
dlStore.getState().startPolling()
return
}
- dlStore.getState().setMeta(model.filename, model.downloadUrl, model.subfolder)
+ // A27: kept for a resume, so the header still decides the folder after a restart.
+ if (folderIsAGuess(model.subfolder)) dlStore.getState().setMeta(model.filename, model.downloadUrl, model.subfolder, undefined, { sniffFolder: true })
+ else dlStore.getState().setMeta(model.filename, model.downloadUrl, model.subfolder)
await startCivitaiDownload(model)
dlStore.getState().startPolling()
}
diff --git a/src/components/models/ModelFileInfo.tsx b/src/components/models/ModelFileInfo.tsx
index d0bcb3fb..10478955 100644
--- a/src/components/models/ModelFileInfo.tsx
+++ b/src/components/models/ModelFileInfo.tsx
@@ -5,6 +5,7 @@
import { ExternalLink, Loader2 } from 'lucide-react'
import { Modal } from '../ui/Modal'
import { ModalActions, ModalButton } from '../ui/ModalActions'
+import { Hinweis } from '../ui/Hinweis'
import { formatBytes } from '../../lib/formatters'
import { openExternal } from '../../api/backend'
import type { ComfyFileFacts } from '../../api/discover'
@@ -22,6 +23,22 @@ export interface ModelFileInfoState {
page: string | null
}
+/**
+ * A27 (GitHub #234): the file's header names another models folder than the
+ * one it sits in. LU does not move a file the user put there; it says where
+ * ComfyUI expects it.
+ */
+export function wrongFolderNote(foundIn: string, belongsIn: string): string {
+ const why = belongsIn === 'diffusion_models'
+ ? 'it is a bare diffusion model, without its own VAE, and ComfyUI loads those from models/diffusion_models'
+ : belongsIn === 'checkpoints'
+ ? 'it carries its own VAE, and ComfyUI loads such all-in-one files from models/checkpoints'
+ : belongsIn === 'vae'
+ ? 'it is a VAE, and ComfyUI loads those from models/vae'
+ : `ComfyUI loads files like it from models/${belongsIn}`
+ return `By its file header this file belongs in ${belongsIn}, not ${foundIn}: ${why}. Move it there by hand, then restart ComfyUI so it lists the file.`
+}
+
function when(secs: number | null): string | null {
if (secs == null) return null
return new Date(secs * 1000).toLocaleString()
@@ -56,6 +73,11 @@ export function ModelFileInfo({ info, onClose }: { info: ModelFileInfoState | nu
This file is in your own model folder (Settings, Storage). LU reads it from there and does not delete it.
</p>
)}
+ {facts?.belongsIn && (
+ <Hinweis className="mb-3">
+ <span data-testid="model-file-wrong-folder">{wrongFolderNote(facts.foundIn ?? 'this folder', facts.belongsIn)}</span>
+ </Hinweis>
+ )}
{facts && facts.copies > 1 && (
<p className="t-micro text-gray-600 dark:text-gray-300 mb-3">
There are {facts.copies} files of this name in the model folders. This is the first one.
diff --git a/src/lib/model-folder-guess.ts b/src/lib/model-folder-guess.ts
new file mode 100644
index 00000000..7d420d4c
--- /dev/null
+++ b/src/lib/model-folder-guess.ts
@@ -0,0 +1,12 @@
+/**
+ * A27 (3.1.0, GitHub #234): a main model folder picked from a title (the
+ * CivitAI search, a chat link), not from a catalog. Such a download asks the
+ * backend to read the finished file's header and move it to the folder the
+ * header names: checkpoints, diffusion_models, vae or text_encoders
+ * (src-tauri/src/commands/model_sniff.rs, `settle_by_header`).
+ *
+ * A module of its own so a panel can ask without importing api/discover.
+ */
+export function folderIsAGuess(subfolder: string): boolean {
+ return subfolder === 'checkpoints' || subfolder === 'diffusion_models' || subfolder === 'unet'
+}
diff --git a/src/stores/downloadStore.ts b/src/stores/downloadStore.ts
index e9abe5dc..dea2d0b7 100644
--- a/src/stores/downloadStore.ts
+++ b/src/stores/downloadStore.ts
@@ -108,6 +108,8 @@ export interface DownloadMeta {
expectedBytes?: number
/** Content digest, when the catalog states one. */
sha256?: string
+ /** A27: the folder came from a title; the file's header decides where it ends up. */
+ sniffFolder?: boolean
}
/** One file of a download that goes to a folder by path (every GGUF of the built-in engine). */
@@ -184,7 +186,7 @@ interface DownloadStoreState {
refresh: () => Promise<void>
startPolling: () => void
stopPolling: () => void
- setMeta: (filename: string, url: string, subfolder: string, destDir?: string, extra?: { expectedBytes?: number; sha256?: string }) => void
+ setMeta: (filename: string, url: string, subfolder: string, destDir?: string, extra?: { expectedBytes?: number; sha256?: string; sniffFolder?: boolean }) => void
/** Start one file into a folder: remember how to start it again, save that at
* once, start, and say how the start ended. */
startToPath: (file: PathDownload, destDir: string) => Promise<PathStartAnswer>
@@ -526,7 +528,8 @@ export const useDownloadStore = create<DownloadStoreState>()(persist((set, get)
}
if (res?.status === 'error') return false
} else {
- await resumeDownload(id, meta.url, meta.subfolder, meta.expectedBytes, meta.sha256)
+ // A27: the header question only travels when it was asked at the start.
+ await resumeDownload(id, meta.url, meta.subfolder, meta.expectedBytes, meta.sha256, ...(meta.sniffFolder ? [true] : []))
}
set(s => ({ orphans: withoutFilename(s.orphans, id) }))
get().startPolling()
@@ -575,7 +578,7 @@ export const useDownloadStore = create<DownloadStoreState>()(persist((set, get)
if (meta.destDir) {
await startModelDownloadToPath(meta.url, meta.destDir, id, meta.expectedBytes, meta.sha256)
} else {
- await startModelDownload(meta.url, meta.subfolder, id, meta.expectedBytes, meta.sha256)
+ await startModelDownload(meta.url, meta.subfolder, id, meta.expectedBytes, meta.sha256, ...(meta.sniffFolder ? [{ sniffFolder: true }] : []))
}
get().startPolling()
},