Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

jedediahg/stinfo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

7 Commits

Repository files navigation

stinfo (Safetensors Info)

This program reads the JSON metadata from a .safetensors file and provides tools for inspection, listing tensors, and extracting specific metadata.

Usage

stinfo [options]

Options

  • -v: Verbose output, prints the JSON header size.
  • -p: Prettify the JSON output with indentation.
  • -m: Print only the __metadata__ object from the JSON.
  • -l: List all tensors with their data type, shape, and calculated size.
  • -k <key>: Extract a specific value from the __metadata__ object by its key.
  • -j: Output the raw JSON header directly.
  • --?: Show this help message and exit.

Example Usage

  • List all tensors in a model:
stinfo -l model.safetensors
  • Extract the format from metadata:
stinfo -k format model.safetensors
  • Pretty-print only the metadata:
stinfo -m -p model.safetensors
  • Output raw header for processing with jq:
stinfo -j model.safetensors | jq .

Building the Program

To compile the program, you can use GCC:

gcc stinfo.c -o stinfo

License

This project is licensed under the MIT License.

About

Safetensors Info command line tool

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages

AltStyle によって変換されたページ (->オリジナル) /