Hf Mem skill for Claude
Estimate the GPU memory needed to run a Hugging Face model (weights, KV cache and inference overhead) and whether it fits on given GPUs, without downloading it.
When Claude uses it
Use when asked how much VRAM a model needs, whether it fits on a GPU, the longest context that fits, or which GGUF quantization to pick.
Hf Mem SKILL.md
The full skill file from huggingface/skills (mit).
hf-mem
uvx hf-mem <model> -o json [options]
<model> is a Hub ID (org/name, org/name@revision), a Hub URL, a local path, or org/name-GGUF:Q4_K_M for one GGUF quantization.
Options:
--gpu-memory 24(GiB per GPU) or8x80(8 GPUs): addsfit.--max-model-len N: context length, defaults to the model's maximum, which can dominate the total.--batch-size N: concurrent sequences, defaults to 1.--kv-cache-dtype fp8(vLLM names for Safetensors, llama.cpp cache types such asq8_0for GGUF).--file <file or variant>and--format safetensors|gguf|onnxto pick the weights.--max-num-batched-tokens 2048on A100s.- Gated or private models need
HF_TOKENor--hf-token.
JSON (sizes in bytes, divide by 2^30 for GiB):
totalis the GPU memory for one copy of the model:weights+kv_cache+overhead(vLLM for Safetensors, llama.cpp for GGUF, none for ONNX).offloadedare weights the engine keeps in CPU memory: excluded fromweightsandtotal, but needed as free system RAM.fit(with--gpu-memory):fits,neededGPUs,max_model_len(the longest context that fits), and therequiredvsusablememory across the given GPUs. Userequired/ GPUs for the memory per GPU, nottotal/ GPUs, as each GPU also holds its own overhead and replicated KV cache.- GGUF and ONNX repositories with several files return a
fileslist to compare quantizations; pick one with:TAGor--fileto getfit. - Report
warningsto the user, and errors explain how to fix them.
How to install Hf Mem
Claude Code
Copy the skill into your personal skills folder (or into .claude/skills/ inside a project):
npx degit huggingface/skills/skills/hf-mem#main ~/.claude/skills/hf-memCodex
npx degit huggingface/skills/skills/hf-mem#main ~/.codex/skills/hf-memClaude.ai and Claude Desktop
Download the skill folder from GitHub, zip it, and upload it under Settings → Capabilities → Skills.
Frequently asked questions
+What does the Hf Mem skill do?
Estimate the GPU memory needed to run a Hugging Face model (weights, KV cache and inference overhead) and whether it fits on given GPUs, without downloading it. Use when asked how much VRAM a model needs, whether it fits on a GPU, the longest context that fits, or which GGUF quantization to pick.
+How do I install Hf Mem in Claude Code?
Copy the skill folder into ~/.claude/skills/hf-mem, for example with "npx degit huggingface/skills/skills/hf-mem#main ~/.claude/skills/hf-mem". Claude Code loads it automatically and uses it when a task matches.
+Does Hf Mem work with ChatGPT or Codex?
Yes. Hf Mem uses the open SKILL.md format. In Codex, put the folder in ~/.codex/skills/hf-mem. In Claude.ai, zip the folder and upload it under Settings → Capabilities → Skills.
+Is Hf Mem free?
Hf Mem is published on GitHub by huggingface under the mit license, which allows free use.