Check GPU hunger before you download
hf-mem estimates inference memory for Hugging Face models by reading Safetensors or GGUF metadata over the wire, without downloading the weights.

What it does
hf-mem is a lightweight Python CLI that tallies up the RAM and VRAM needed to run inference on a Hugging Face model. It inspects Safetensors or GGUF metadata via HTTP Range requests, so it never fetches the actual weight blobs. The tool handles Transformers, Diffusers, and Sentence Transformers checkpoints, and can optionally factor in KV-cache overhead and Mixture-of-Experts weight splits.
The interesting bit
Rather than pulling gigabytes of parameters just to see if your GPU will survive, it leans on httpx to grab only file headers and derives memory costs from tensor shapes and data types. That turns a “download and pray” workflow into a quick sniff test before you waste disk space.
Key highlights
- Parses both Safetensors and GGUF metadata, covering most Hub model formats.
- Experimental mode projects KV-cache memory for LLMs and VLMs, and breaks out base versus expert weights for MoE models.
- Drops into the Hugging Face Hub CLI as an extension or into agent loops via a supplied
SKILL.md. - Carries only
httpxas a dependency, keeping the tool small.
Caveats
- The README slaps an experimental warning on the whole project: expect breaking changes until v1.0.0.
- KV-cache and MoE breakdowns live behind an
--experimentalflag, so those estimates are still taking shape. - The author notes the linked explainer post is out of date.
Verdict Worth a look if you routinely shop for models on bandwidth or VRAM budgets. Less useful if you already run everything in the cloud and don’t care about local footprint.
Frequently asked
- What is alvarobartt/hf-mem?
- hf-mem estimates inference memory for Hugging Face models by reading Safetensors or GGUF metadata over the wire, without downloading the weights.
- Is hf-mem open source?
- Yes — alvarobartt/hf-mem is open source, released under the MIT license.
- What language is hf-mem written in?
- alvarobartt/hf-mem is primarily written in Python.
- How popular is hf-mem?
- alvarobartt/hf-mem has 938 stars on GitHub.
- Where can I find hf-mem?
- alvarobartt/hf-mem is on GitHub at https://github.com/alvarobartt/hf-mem.