Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
huggingface avatar

Hf Mem

  • 384 installs
  • 10.9k repo stars
  • Updated August 4, 2026
  • huggingface/skills

hf-mem is an agent skill that estimates Hugging Face Hub model inference memory for Safetensors and GGUF weights using the hf-mem CLI.

About

The hf-mem skill wraps the Hugging Face hf-mem CLI that estimates inference memory for models on the Hub using HTTP Range requests, so weights never need to be downloaded or loaded locally. It supports Safetensors repositories including sharded model.safetensors.index.json and Diffusers model_index.json layouts, plus GGUF files where users may need --gguf-file to target a specific quantization. Basic usage runs uvx hf-mem --model-id with --json-output, while the --experimental flag adds KV cache memory estimates for LLMs, VLMs, and GGUF models with configurable --max-model-len, --batch-size, and --kv-cache-dtype options aligned with vLLM conventions. Gated or private models require HF_TOKEN or --hf-token. Example invocations cover Transformers causal LM, Diffusers, Sentence Transformers, and large GGUF quantizations such as Q4_K_M. Triggers include how much VRAM a model needs, whether a model fits on a GPU, or memory requirements for a Hugging Face model ID. Use whenever builders need fast Hub-side memory estimates before provisioning inference hardware or choosing quantization.

  • Estimates inference memory via HTTP Range requests without local downloads.
  • Supports Safetensors, Diffusers, Sentence Transformers, and GGUF formats.
  • Experimental KV cache estimation with vLLM-aligned length and dtype flags.
  • Runs through uvx hf-mem with JSON output for agent parsing.
  • Handles gated models with HF_TOKEN when required.

Hf Mem by the numbers

  • 384 all-time installs (skills.sh)
  • +42 installs in the week ending Aug 2, 2026 (Skillselion tracking)
  • Ranked #2,023 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

hf-mem capabilities & compatibility

Capabilities
hub side weight memory estimation via range requ · safetensors and gguf format detection · experimental kv cache sizing for llms and vlms · uvx cli invocation with json output · gated model token handling
Works with
openai
Use cases
token optimization · research
From the docs

What hf-mem says it does

without downloading or loading any weights locally.
SKILL.md
npx skills add https://github.com/huggingface/skills --skill hf-mem

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs384
repo stars10.9k
Last updatedAugust 4, 2026
Repositoryhuggingface/skills

How much VRAM or memory does a Hugging Face model need for inference on my GPU?

Estimate VRAM and memory required to load Hugging Face Hub Safetensors or GGUF model weights for inference using hf-mem without downloading full weights locally.

Who is it for?

Builders checking whether a Hub model fits available GPU memory before download or deployment.

Skip if: Skip for non-Hugging-Face models, training memory planning, or runtime profiling on loaded models.

When should I use this skill?

User asks about VRAM, memory requirements, or GPU fit for a Hugging Face model ID or URL.

What you get

JSON memory estimates for model weights and optional KV cache without downloading full model files.

Files

SKILL.mdMarkdownGitHub ↗

hf_mem estimates the required memory for inference, including model weights and an optional KV cache, for Safetensors and GGUF for models on the Hugging Face Hub using HTTP Range requests i.e., without downloading or loading any weights locally.

When to use?

  • User asks how much VRAM or memory a model needs to run
  • User wants to know if a model fits on their GPU or a given instance
  • User references a Hugging Face model ID or URL and asks about inference requirements

What are the requirements?

  • uv installed (for uvx)
  • HF_TOKEN env var or --hf-token flag (for gated or private models only)

How to run?

Run with --model-id pointing to the Hugging Face Hub repository which will check that it either contains Safetensors (via model.safetensors, model.safetensors.index.json if sharded, or model_index.json for Diffusers) or GGUF model weights within.

uvx hf-mem --model-id <model-id> --json-output

If the repository contains GGUF model weights in multiple precisions / quantizations, the estimations will be on a per-file basis, whereas for inference you won't load all of those but rather only a single precision. This being said, for GGUF you might as well need to provide --gguf-file to target the specific file (or path if sharded) you want to run.

uvx hf-mem --model-id <model-id> --gguf-file <file-or-path> --json-output

Additionally, hf-mem comes with an --experimental flag that will also calculate the KV cache memory requirements too, useful for large-language models, meaning it applies to LLMs (...ForCausalLM), VLMs (...ForConditionalGeneration), and GGUF models.

As per the context window, it will be read from the default or overridden with --max-model-len a la vLLM. And, same goes for the KV cache precision, which will default to the model precision unless manually set via --kv-cache-dtype a la vLLM too.

For Safetensors use as:

uvx hf-mem --model-id <model-id> --experimental [--max-model-len N] [--batch-size N] [--kv-cache-dtype auto|bfloat16|fp8|fp8_ds_mla|fp8_e4m3|fp8_e5m2|fp8_inc] --json-output

And, for GGUF use as:

uvx hf-mem --model-id <model-id> --gguf-file <file-or-path> --experimental [--max-model-len N] [--batch-size N] [--kv-cache-dtype auto|F32|F16|Q4_0|Q4_1|Q5_0|Q5_1|Q8_0|Q8_1|Q2_K|Q3_K|Q4_K|Q5_K|Q6_K|Q8_K|IQ2_XXS|IQ2_XS|IQ3_XXS|IQ1_S|IQ4_NL|IQ3_S|IQ2_S|IQ4_XS|I8|I16|I32|I64|F64|IQ1_M|BF16|TQ1_0|TQ2_0|MXFP4] --json-output

Examples

For Transformers with Safetensors weights:

uvx hf-mem --model-id MiniMaxAI/MiniMax-M2 --json-output

For Diffusers with Safetensors weights:

uvx hf-mem --model-id Qwen/Qwen-Image --json-output

For Sentence Transformers with Safetensors weights:

uvx hf-mem --model-id google/embeddinggemma-300m --json-output

With --experimental to include the KV cache estimation for LLMs and VLMs:

uvx hf-mem --model-id mistralai/Mistral-7B-v0.1 --experimental --json-output

And, for LLMs or VLMs with GGUF weights:

uvx hf-mem --model-id unsloth/Qwen3.5-397B-A17B-GGUF --gguf-file Q4_K_M --experimental --json-output

Related skills

FAQ

What does hf-mem produce?

JSON output estimating inference memory for Safetensors or GGUF Hub models, optionally including KV cache.

When should I use hf-mem?

When estimating whether a Hugging Face model fits a GPU or instance before downloading weights.

Is hf-mem safe to install?

Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.