{"id":23739869,"url":"https://github.com/p1atdev/safemetadata","last_synced_at":"2025-09-04T15:31:49.063Z","repository":{"id":252056422,"uuid":"838980273","full_name":"p1atdev/safemetadata","owner":"p1atdev","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-02T04:33:07.000Z","size":226,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-22T00:47:53.647Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/p1atdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-06T18:12:01.000Z","updated_at":"2024-10-02T21:10:26.000Z","dependencies_parsed_at":"2024-08-10T21:22:05.481Z","dependency_job_id":null,"html_url":"https://github.com/p1atdev/safemetadata","commit_stats":null,"previous_names":["p1atdev/safemetadata"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p1atdev%2Fsafemetadata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p1atdev%2Fsafemetadata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p1atdev%2Fsafemetadata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p1atdev%2Fsafemetadata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/p1atdev","download_url":"https://codeload.github.com/p1atdev/safemetadata/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231970931,"owners_count":18453925,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-31T09:39:37.518Z","updated_at":"2024-12-31T09:39:38.451Z","avatar_url":"https://github.com/p1atdev.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# safemetadata\n\n\u003e [!WARNING]\n\u003e WIP\n\nA CLI tool for viewing metadata of [🤗safetensors](https://github.com/huggingface/safetensors) files.\n\n- Supports viewing model parameters, layers and modelspec.\n- Supports remote files on Hugging Face Hub without full model download. ([See details](https://huggingface.co/docs/safetensors/metadata_parsing))\n\n## Installation\n\n```bash\ncargo install --git https://github.com/p1atdev/safemetadata\n```\n\n## Usage\n\n### Param size\n\n```bash\nsafemtetadata params ./Qwen2-0.5B-Instruct/model.safetensors # local file\n```\n\nor\n\n```bash\nsafemtetadata params model.safetensors --repo-id Qwen/Qwen2-0.5B-Instruct # on huggingface hub\n```\n\nOutput:\n\n\n```\nTotal parameters: 0.5B params\n```\n\n### Layers\n\n```bash\nsafemtetadata layers ./Qwen2-0.5B-Instruct/model.safetensors\n```\n\nor\n\n```bash\nsafemtetadata layers model.safetensors --repo-id Qwen/Qwen2-0.5B-Instruct\n```\n\nOutput:\n\n```\nTensor format: PyTorch\n╭────────────────────────────────────────────┬──────────┬───────────────╮\n│ Parameter Name                             │ DType    │ Shape         │\n├────────────────────────────────────────────┼──────────┼───────────────┤\n│ model.embed_tokens.weight                  │ bfloat16 │ [151936, 896] │\n│ model.layers.0.input_layernorm.weight      │ bfloat16 │ [896]         │\n│ model.layers.0.mlp.down_proj.weight        │ bfloat16 │ [896, 4864]   │\n│ model.layers.0.mlp.gate_proj.weight        │ bfloat16 │ [4864, 896]   │\n│ model.layers.0.mlp.up_proj.weight          │ bfloat16 │ [4864, 896]   │\n│ model.layers.0.post_attention_layernorm.we │ bfloat16 │ [896]         │\n│ ight                                       │          │               │\n│ model.layers.0.self_attn.k_proj.bias       │ bfloat16 │ [128]         │\n...\n```\n\n### SAI ModelSpec\n\n```bash\nsafemtetadata modelspec ./sd_xl_base_1.0_0.9vae.safetensors\n```\n\nor\n\n```bash\nsafemtetadata modelspec sd_xl_base_1.0_0.9vae.safetensors --repo-id stabilityai/stable-diffusion-xl-base-1.0\n```\n\nOutput:\n\n```\nStability AI Model Metadata Standard Specification\n╭───────────────────────────┬────────────────────────────────────────────╮\n│ Key                       │ Value                                      │\n├───────────────────────────┼────────────────────────────────────────────┤\n│ modelspec.architecture    │ \"stable-diffusion-xl-v1-base\"              │\n│ modelspec.author          │ \"StabilityAI\"                              │\n│ modelspec.date            │ \"2023-07-26\"                               │\n│ modelspec.description     │ \"SDXL 1.0 Base Model, compositional expert │\n│                           │ . SDXL, the most advanced development in t │\n│                           │ he Stable Diffusion text-to-image suite of │\n│                           │  models. SDXL produces massively improved  │\n│                           │ image and composition detail over its pred │\n│                           │ ecessors. The ability to generate hyper-re │\n│                           │ alistic creations for films, television, m │\n│                           │ usic, and instructional videos, as well as │\n│                           │  offering advancements for design and indu │\n│                           │ strial use, places SDXL at the forefront o │\n│                           │ f real world applications for AI imagery.\" │\n│ modelspec.hash_sha256     │ \"0x5e756477ea9ddde7a552c6e2d7926f849e8b0df │\n│                           │ d2f0b513ff17b7d31faedd79f\"                 │\n│ modelspec.implementation  │ \"https://github.com/Stability-AI/generativ │\n│                           │ e-models\"                                  │\n│ modelspec.license         │ \"CreativeML Open RAIL++-M License\"         │\n│ modelspec.prediction_type │ \"epsilon\"                                  │\n│ modelspec.resolution      │ \"1024x1024\"                                │\n│ modelspec.sai_model_spec  │ \"1.0.0\"                                    │\n...\n```\n\n### Metadata\n\nShows all metadata (`__metadata__` field) of the model.\n\n```bash\nsafemtetadata metadata ./sd_xl_base_1.0_0.9vae.safetensors\n```\n\nor\n\n```bash\nsafemtetadata metadata sd_xl_base_1.0_0.9vae.safetensors --repo-id stabilityai/stable-diffusion-xl-base-1.0\n```\n\n\n### Clean metadata\n\nRemoves metadata from the model. Only supports local files.\n\n```bash\nsafemtetadata clean ./sd_xl_base_1.0_0.9vae.safetensors -o ./sd_xl_base_1.0_0.9vae-cleaned.safetensors\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp1atdev%2Fsafemetadata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fp1atdev%2Fsafemetadata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp1atdev%2Fsafemetadata/lists"}