A command-line utility for batch extracting metadata from safetensors files. This tool can process individual files or recursively scan directories to extract metadata from all safetensors files.
- Process single safetensors files or entire directories
- Support for glob patterns to match multiple files
- Recursive directory scanning
- Asynchronous processing for better performance
- Detailed metadata extraction from safetensors files
Ensure you have Rust installed on your system, then you can install using cargo:
cargo install extract-metadata
Or build from source:
git clone https://github.com/rakki194/extract-metadata
cd extract-metadata
cargo build --release
The tool supports several usage patterns:
-
Process a single file:
extract-metadata path/to/model.safetensors
-
Process all safetensors files in a directory (recursive):
extract-metadata path/to/directory
-
Use glob patterns to match specific files:
extract-metadata "models/*.safetensors"
- tokio - Async runtime
- anyhow - Error handling
- glob - File pattern matching
- env_logger - Logging functionality
- dset - Internal safetensors processing
- xio - File system operations
The tool includes robust error handling and will:
- Skip invalid files while continuing to process others
- Provide clear error messages for invalid paths or patterns
- Handle IO errors gracefully
MIT License
Contributions are welcome! Please feel free to submit a Pull Request.