//! Diagnostic: read a GGUF file and print tensor names + shapes + dtypes. use anyhow::Result; use candle_core::quantized::gguf_file; fn main() -> Result<()> { let path = std::env::args().nth(1).expect("usage: inspect_gguf "); let mut f = std::fs::File::open(&path)?; let ct = gguf_file::Content::read(&mut f)?; println!("metadata entries: {}", ct.metadata.len()); println!("tensor entries: {}", ct.tensor_infos.len()); let mut keys: Vec<_> = ct.tensor_infos.iter().collect(); keys.sort_by_key(|(k, _)| k.clone()); for (name, info) in keys.iter().take(20) { println!( " {:<60} shape={:?} dtype={:?}", name, info.shape, info.ggml_dtype ); } if keys.len() > 20 { println!(" ... ({} more)", keys.len() - 20); } // Specifically check a known weight that exists in csm if let Some((_, info)) = keys .iter() .find(|(k, _)| k.contains("backbone.layers.0.attn.q_proj.weight")) { println!( "\nbackbone.layers.0.attn.q_proj.weight: shape={:?} dtype={:?}", info.shape, info.ggml_dtype ); } Ok(()) }