| Crates.io | woolly-gguf |
| lib.rs | woolly-gguf |
| version | 0.1.0 |
| created_at | 2025-06-26 16:51:57.340169+00 |
| updated_at | 2025-06-26 16:51:57.340169+00 |
| description | Zero-copy, memory-mapped GGUF format loader for Rust |
| homepage | https://github.com/Enreign/woolly |
| repository | https://github.com/Enreign/woolly |
| max_upload_size | |
| id | 1727560 |
| size | 85,152 |
Zero-copy, memory-mapped GGUF format loader for Rust.
use woolly_gguf::{GGUFLoader, Result};
fn main() -> Result<()> {
// Load a GGUF file
let loader = GGUFLoader::from_path("model.gguf")?;
// Access metadata
if let Some(arch) = loader.architecture() {
println!("Architecture: {}", arch);
}
// List all tensors
for name in loader.tensor_names() {
let info = loader.tensor_info(name).unwrap();
println!("{}: {:?} ({})", name, info.shape(), info.ggml_type);
}
// Access tensor data
let tensor_data = loader.tensor_data("model.embed_tokens.weight")?;
Ok(())
}
The crate includes comprehensive integration tests that verify all functionality:
# Run all tests for the woolly-gguf crate
cargo test -p woolly-gguf
# Run only the integration tests
cargo test -p woolly-gguf --test load_model
# Run only unit tests
cargo test -p woolly-gguf --lib
# Run a specific test
cargo test -p woolly-gguf test_load_with_metadata
# Run tests with output visible
cargo test -p woolly-gguf -- --nocapture
# Run tests in release mode (faster for large data)
cargo test -p woolly-gguf --release
The integration tests (tests/load_model.rs) cover:
Since the tests need valid GGUF files, the integration tests include a MockGGUFBuilder that creates minimal but valid GGUF files for testing. This allows testing without requiring actual model files.
The tests ensure:
MIT OR Apache-2.0