This program reads the JSON metadata from a .safetensors file and provides tools for inspection, listing tensors, and extracting specific metadata.
stinfo [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.
- 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 .
To compile the program, you can use GCC:
gcc stinfo.c -o stinfo
This project is licensed under the MIT License.