~/tools / Model files and chat templates / Safetensors Metadata Viewer
Safetensors Metadata Viewer — Open safetensors files: dtypes, parameters, weight size, KV cache
Open the safetensors files of a Hugging Face model in your browser and see what is inside without loading the weights: every tensor with its data type and shape, the parameter count, the size of the weights and the __metadata__. For a model split into several files, add model.safetensors.index.json to find missing or incomplete files, and add config.json to see the architecture, the context length and the KV cache. The tool checks each file the way the official safetensors library does. Only the start of each file is read, and nothing is uploaded.
Or drop files here: .safetensors files, model.safetensors.index.json and config.json. Only the start of each .safetensors file is read, and nothing leaves your computer.
curl -L -r 0-1048575 -o model.safetensors https://huggingface.co/OWNER/REPO/resolve/main/model.safetensorsThe parameter count adds up the elements of every tensor in the files (the product of its shape), the same way the Hugging Face Hub counts the parameters it shows for a model. The size of the weights is the data the files hold, in the data types of the files.
KV cache = 2 × layers × KV heads × head size × 2 bytes (f16) × context length. The values come from config.json (num_hidden_layers, num_key_value_heads, head_dim, or hidden_size ÷ num_attention_heads). For models whose text part is in text_config, the tool reads it from there.
Checked on 2026-11-09 against these sources and the official safetensors 0.8.0: safetensors format · Hugging Face: reading the metadata · Ollama: importing a model
Everything runs in your browser. Only the start of each .safetensors file is read, and nothing is sent anywhere.
safetensors is the file format Hugging Face uses for model weights. A safetensors file starts with 8 bytes that give the length of a JSON header. The header lists every tensor with its data type (dtype), shape and position (data_offsets), and can hold a __metadata__ map of strings such as {"format": "pt"}. The weights follow. This tool reads only that header, using the format described in the safetensors repository, so a file of several gigabytes opens in a moment: in Qwen2.5-7B-Instruct each header is 7 to 11 KiB, in files of 3.3 to 3.7 GiB. It counts the parameters the way the Hugging Face Hub does (the product of each tensor's shape, added up for each data type), adds up the size of the weights, and checks what the official safetensors library checks: the header length, the JSON, the data types, that the tensors fill the data without gaps or overlaps, that each tensor's size matches its type and shape, and that the file ends right after the last tensor. A model split into several files comes with model.safetensors.index.json, which says which file holds each tensor. Choose the files together, and the tool lists missing files, tensors that are not where the index says, and whether the total size matches. Add config.json, and it shows the architecture, the context length, the layers and attention heads, and the KV cache at f16, Ollama's default: 2 × layers × KV heads × head size × 2 bytes × context length. We checked the tool with the headers of Qwen2.5-7B-Instruct (4 files) and Qwen2.5-0.5B-Instruct from Hugging Face: the parameter counts matched what the Hub reports (7,615,616,512 and 494,032,768), and the size computed from each header matched the file to the byte. We also opened 52 valid and broken files with the official Python package safetensors 0.8.0, and the tool accepts and refuses the same files.
The core logic of this tool is open source under the MIT License. github.com/seigo5555/toolkitbox-lib/src/safetensors.ts
Use Cases
- Check the safetensors files of a Hugging Face model before you convert or import it: data types, parameter count and whether every file is complete
- Find the file that is missing or cut short in a model split into several files, with model.safetensors.index.json
- Look inside a model on Hugging Face without downloading the weights, by saving only the start of each file
Usage
- Choose the .safetensors files (several at once for a split model) and, if you have them, model.safetensors.index.json and config.json. You can also drop them on the box.
- To look at a model without downloading it, save only the start of each file with the curl command shown (a Range request, the method in Hugging Face's documentation) and tick "Only the start of the file".
- You can also paste index.json, config.json or a header (the JSON after the first 8 bytes) into the text box and add it.
FAQ
Is the file uploaded?
No. The browser reads the files on your computer, and the tool reads only the start of each .safetensors file: the 8 bytes with the header length and the header. The weights are not read.
Why does the parameter count differ from the model name?
The tool counts every tensor in the files, as the Hugging Face Hub does. Names such as 7B are rounded. Some models also share a tensor between the input and the output: Qwen2.5-0.5B-Instruct has tie_word_embeddings in its config.json, and its file has no lm_head.weight.
What does "file not fully covered" mean?
The official safetensors library refuses a file whose size is not exactly 8 bytes + the header + the end of the last tensor, with "incomplete metadata, file not fully covered". If the file is shorter, part of the weights is missing, for example because a download stopped early.
Why are some problems red and others yellow?
Red problems are ones the official library refuses. Yellow ones break the specification, but the official library still reads the file: a tensor name that appears twice (the library keeps the last one), or a header that starts with whitespace or is padded with characters other than spaces.
How do I import safetensors into Ollama?
Ollama's import guide points FROM at the folder that holds the safetensors weights, then runs ollama create. In our test with Ollama 0.40.11 on macOS, a folder without config.json was refused, and so was a Qwen2 model (Qwen2ForCausalLM) as an unsupported architecture. If your model cannot be imported, convert it to GGUF first, for example with llama.cpp's convert_hf_to_gguf.py.
How accurate is the KV cache size?
The formula matched Ollama's log in our test (224 MiB for qwen2.5:7b at 4096 tokens), and the config.json of Qwen2.5-7B-Instruct gives the same 224 MiB. It is for f16, Ollama's default. Models with a sliding window, compressed KV (kv_lora_rank) or layers other than full attention use a different amount; the tool says so when config.json shows it.