Warning
WIP
A CLI tool for viewing metadata of ๐คsafetensors files.
- Supports viewing model parameters, layers and modelspec.
- Supports remote files on Hugging Face Hub without full model download. (See details)
cargo install --git https://github.com/p1atdev/safemetadata
safemtetadata params ./Qwen2-0.5B-Instruct/model.safetensors # local file
or
safemtetadata params model.safetensors --repo-id Qwen/Qwen2-0.5B-Instruct # on huggingface hub
Output:
Total parameters: 0.5B params
safemtetadata layers ./Qwen2-0.5B-Instruct/model.safetensors
or
safemtetadata layers model.safetensors --repo-id Qwen/Qwen2-0.5B-Instruct
Output:
Tensor format: PyTorch
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโโโโโฎ
โ Parameter Name โ DType โ Shape โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโโโโค
โ model.embed_tokens.weight โ bfloat16 โ [151936, 896] โ
โ model.layers.0.input_layernorm.weight โ bfloat16 โ [896] โ
โ model.layers.0.mlp.down_proj.weight โ bfloat16 โ [896, 4864] โ
โ model.layers.0.mlp.gate_proj.weight โ bfloat16 โ [4864, 896] โ
โ model.layers.0.mlp.up_proj.weight โ bfloat16 โ [4864, 896] โ
โ model.layers.0.post_attention_layernorm.we โ bfloat16 โ [896] โ
โ ight โ โ โ
โ model.layers.0.self_attn.k_proj.bias โ bfloat16 โ [128] โ
...
safemtetadata modelspec ./sd_xl_base_1.0_0.9vae.safetensors
or
safemtetadata modelspec sd_xl_base_1.0_0.9vae.safetensors --repo-id stabilityai/stable-diffusion-xl-base-1.0
Output:
Stability AI Model Metadata Standard Specification
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Key โ Value โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ modelspec.architecture โ "stable-diffusion-xl-v1-base" โ
โ modelspec.author โ "StabilityAI" โ
โ modelspec.date โ "2023-07-26" โ
โ modelspec.description โ "SDXL 1.0 Base Model, compositional expert โ
โ โ . SDXL, the most advanced development in t โ
โ โ he Stable Diffusion text-to-image suite of โ
โ โ models. SDXL produces massively improved โ
โ โ image and composition detail over its pred โ
โ โ ecessors. The ability to generate hyper-re โ
โ โ alistic creations for films, television, m โ
โ โ usic, and instructional videos, as well as โ
โ โ offering advancements for design and indu โ
โ โ strial use, places SDXL at the forefront o โ
โ โ f real world applications for AI imagery." โ
โ modelspec.hash_sha256 โ "0x5e756477ea9ddde7a552c6e2d7926f849e8b0df โ
โ โ d2f0b513ff17b7d31faedd79f" โ
โ modelspec.implementation โ "https://github.com/Stability-AI/generativ โ
โ โ e-models" โ
โ modelspec.license โ "CreativeML Open RAIL++-M License" โ
โ modelspec.prediction_type โ "epsilon" โ
โ modelspec.resolution โ "1024x1024" โ
โ modelspec.sai_model_spec โ "1.0.0" โ
...
Shows all metadata (__metadata__
field) of the model.
safemtetadata metadata ./sd_xl_base_1.0_0.9vae.safetensors
or
safemtetadata metadata sd_xl_base_1.0_0.9vae.safetensors --repo-id stabilityai/stable-diffusion-xl-base-1.0
Removes metadata from the model. Only supports local files.
safemtetadata clean ./sd_xl_base_1.0_0.9vae.safetensors -o ./sd_xl_base_1.0_0.9vae-cleaned.safetensors