CivArchive
    ← All articles
    Published September 2, 2025by mistporyvaev

    How to get metadata from safetensors?

    76 views1 reactions2 comments on CivitAI2 collected
    metadatatool guidesafetensors

    Sometimes you need to get metadata from a safetensors file. To do this, you can use the Python script attached to this article. This script allows you to output metadata to the console from both a file in the local file system and from a URL, without having to download the safetensors file.

    To print local file metadata to the screen, call a command like

    python sft_meta.py FluxFusionV2_fp8_unet+clip+vae_checkpoint.safetensors

    To print online file metadata to the screen, call a command like

    python sft_meta.py https://huggingface.co/Kijai/WanVideo_comfy_fp8_scaled/resolve/main/I2V/Wan2_2-I2V-A14B-HIGH_fp8_e5m2_scaled_KJ.safetensors

    To save metadata to a file, append

    > metadata.json 

    to the end of the command. For example:

    python sft_meta.py https://huggingface.co/Kijai/WanVideo_comfy_fp8_scaled/resolve/main/I2V/Wan2_2-I2V-A14B-HIGH_fp8_e5m2_scaled_KJ.safetensors > metadata.json

    If the Python script does not run, first install the missing modules with the command

    pip install requests argparse

    Attachments