Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/p1atdev/safemetadata
https://github.com/p1atdev/safemetadata
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/p1atdev/safemetadata
- Owner: p1atdev
- License: apache-2.0
- Created: 2024-08-06T18:12:01.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-10-02T04:33:07.000Z (3 months ago)
- Last Synced: 2024-11-22T00:47:53.647Z (about 2 months ago)
- Language: Jupyter Notebook
- Size: 221 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# safemetadata
> [!WARNING]
> WIPA CLI tool for viewing metadata of [๐คsafetensors](https://github.com/huggingface/safetensors) files.
- Supports viewing model parameters, layers and modelspec.
- Supports remote files on Hugging Face Hub without full model download. ([See details](https://huggingface.co/docs/safetensors/metadata_parsing))## Installation
```bash
cargo install --git https://github.com/p1atdev/safemetadata
```## Usage
### Param size
```bash
safemtetadata params ./Qwen2-0.5B-Instruct/model.safetensors # local file
```or
```bash
safemtetadata params model.safetensors --repo-id Qwen/Qwen2-0.5B-Instruct # on huggingface hub
```Output:
```
Total parameters: 0.5B params
```### Layers
```bash
safemtetadata layers ./Qwen2-0.5B-Instruct/model.safetensors
```or
```bash
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] โ
...
```### SAI ModelSpec
```bash
safemtetadata modelspec ./sd_xl_base_1.0_0.9vae.safetensors
```or
```bash
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" โ
...
```### Metadata
Shows all metadata (`__metadata__` field) of the model.
```bash
safemtetadata metadata ./sd_xl_base_1.0_0.9vae.safetensors
```or
```bash
safemtetadata metadata sd_xl_base_1.0_0.9vae.safetensors --repo-id stabilityai/stable-diffusion-xl-base-1.0
```### Clean metadata
Removes metadata from the model. Only supports local files.
```bash
safemtetadata clean ./sd_xl_base_1.0_0.9vae.safetensors -o ./sd_xl_base_1.0_0.9vae-cleaned.safetensors
```