Catalog
huggingface/hf-mem

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.

NewUpdated Nov 18, 2026

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) or 8x80 (8 GPUs): adds fit.
  • --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 as q8_0 for GGUF).
  • --file <file or variant> and --format safetensors|gguf|onnx to pick the weights.
  • --max-num-batched-tokens 2048 on A100s.
  • Gated or private models need HF_TOKEN or --hf-token.

JSON (sizes in bytes, divide by 2^30 for GiB):

  • total is the GPU memory for one copy of the model: weights + kv_cache + overhead (vLLM for Safetensors, llama.cpp for GGUF, none for ONNX).
  • offloaded are weights the engine keeps in CPU memory: excluded from weights and total, but needed as free system RAM.
  • fit (with --gpu-memory): fits, needed GPUs, max_model_len (the longest context that fits), and the required vs usable memory across the given GPUs. Use required / GPUs for the memory per GPU, not total / GPUs, as each GPU also holds its own overhead and replicated KV cache.
  • GGUF and ONNX repositories with several files return a files list to compare quantizations; pick one with :TAG or --file to get fit.
  • Report warnings to the user, and errors explain how to fix them.
Files1
1 files · 11.1 KB

Select a file to preview

Overall Score

76/100

Grade

B

Good

Grades are signals, not a certification. Always review a skill yourself before use.

Safety

78

Quality

73

Clarity

82

Completeness

68

Summary

This skill estimates GPU memory requirements for Hugging Face models without downloading them, using the `hf-mem` command-line tool. It guides agents on how to invoke the tool with model IDs, specify GPU configurations, context lengths, batch sizes, and cache data types, then interpret the JSON output to determine whether models fit on available hardware and what trade-offs are needed.

Detected Capabilities

command execution (uvx)environment variable access (HF_TOKEN)hugging face hub queriesjson output parsing

Trigger Keywords

Phrases that agents use to match this skill to user intent.

calculate model vramestimate gpu memorycheck if model fitshugging face memoryfind longest contextcompare quantizations

Risk Signals

INFO

Environment variable HF_TOKEN referenced for authentication

SKILL.md, options section
WARNING

No explicit scope boundary or guardrails on models accessed

SKILL.md, model parameter description
INFO

Implicit trust in uvx tool and remote Hugging Face Hub

SKILL.md, entire skill

Referenced Domains

External domains referenced in skill content, detected by static analysis.

www.apache.org

Use Cases

  • Determine VRAM requirements before model deployment
  • Calculate maximum context length for given GPU memory
  • Compare GGUF quantizations for memory efficiency
  • Validate model compatibility across heterogeneous GPU clusters
  • Estimate inference overhead for batch processing workflows

Quality Notes

  • Strength: Clear, structured documentation with specific command-line syntax and option examples
  • Strength: Well-organized JSON output specification with field-by-field explanations
  • Strength: Includes error/warning handling expectations and guidance for interpreting results
  • Strength: Covers edge cases (gated models, multiple GGUF quantizations, various weight formats)
  • Weakness: No example invocation or sample output provided to illustrate typical usage
  • Weakness: Assumes familiarity with Hugging Face Hub terminology (revisions, Hub URLs, model IDs)
  • Weakness: Limited guidance on when to use each option (e.g., when is `max-num-batched-tokens` necessary?)
  • Weakness: No explicit scope boundary on model access — skill allows any public or authenticated model
  • Weakness: Credential handling (HF_TOKEN) is mentioned but not explained in detail (best practices for token storage)
Model: claude-haiku-4-5-20251001Analyzed: Nov 18, 2026

Reviews

Add this skill to your library to leave a review.

No reviews yet

Be the first to share your experience.

Version History

  1. v2.0

    Contract changed: description

    ✦ AIRewrites documentation and usage; expands scope to estimate GPU fit and context length not just weights.

    triggeringlicense2026-11-18

    LATEST
  2. v1.0

    2026-07-11

    View This VersionInitial version

Use huggingface/hf-mem in your dev environment

Command Palette

Search for a command to run...