Back to directory

hf-mem

A lightweight Python CLI that estimates the inference memory a Hugging Face model needs, reading only its Safetensors or GGUF metadata over HTTP range requests rather than downloading the model.

hf-mem

hf-mem estimates the inference memory requirements for any model on the Hugging Face Hub that ships Safetensors or GGUF weights, including Transformers, Diffusers and Sentence Transformers models. It stays lightweight by depending only on httpx2 and pulling metadata through HTTP range requests instead of downloading the model itself, and is recommended to run with uv.

It can be run directly as a CLI with uvx hf-mem --model-id, or called programmatically from Python with a synchronous run() function or an asynchronous arun() for use inside an async application, both returning a result with the estimated memory, KV cache size and total memory.

An experimental flag adds KV cache memory estimation for causal language models and vision-language models, with configurable maximum model length, batch size and KV cache data type, plus a weights-only breakdown of the base model and combined experts for mixture-of-experts models. The project is still experimental and may have breaking changes before a 1.0 release.

More in Inference

See all 770
  • OpenDecision

    deepanwadhwa.github.io

    An open-source Python package that answers typed questions about application state or documents using a local natural-language-inference model, returning structured choice, score, yes/no or evidence-relation values instead of free text.

  • Lifeboat

    iterate.ai

    A local inference server that puts an OpenAI- and Anthropic-compatible API in front of open-weight language models running on hardware you control, from a laptop to a GPU cluster.

  • Claude S40

    github.com

    An unofficial Claude chat client for 2007-era Nokia Series 40 phones, built as a Java ME app plus a small Go relay server, with web search, reading mode and saved chats.