#extract #metadata #directory #target-directory #safetensors #glob-pattern #process

app extract-metadata

A tool to extract metadata from .safetensors files in a target directory and its subdirectories

3 releases

new 0.1.2 Feb 19, 2025
0.1.1 Feb 16, 2025
0.1.0 Feb 15, 2025

#145 in Filesystem

Download history 193/week @ 2025-02-11

193 downloads per month

MIT license

9KB
112 lines

extract-metadata

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.

Features

  • 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

Installation

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

Usage

The tool supports several usage patterns:

  1. Process a single file:

    extract-metadata path/to/model.safetensors
    
  2. Process all safetensors files in a directory (recursive):

    extract-metadata path/to/directory
    
  3. Use glob patterns to match specific files:

    extract-metadata "models/*.safetensors"
    

Dependencies

  • tokio - Async runtime
  • anyhow - Error handling
  • glob - File pattern matching
  • env_logger - Logging functionality
  • dset - Internal safetensors processing
  • xio - File system operations

Error Handling

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

License

MIT License

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Dependencies

~7–16MB
~203K SLoC