hf-mem
Agent skill fromhuggingface/skills
Hugging Face CLI to estimate the required memory to load Safetensors or GGUF model weights for inference from the Hugging Face Hub
How to install hf-mem
install hf-mem
# install the skills pack with the skills CLI
npx skills add huggingface/skills# or add only this skill to Claude Code: copy the folder
skills/hf-mem/
# into
~/.claude/skills/hf-mem/ (all projects)
.claude/skills/hf-mem/ (one project)
1`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.23## When to use?45- User asks how much VRAM or memory a model needs to run6- User wants to know if a model fits on their GPU or a given instance7- User references a Hugging Face model ID or URL and asks about inference requirements89## What are the requirements?1011- `uv` installed (for `uvx`)12- `HF_TOKEN` env var or `--hf-token` flag (for gated or private models only)1314## How to run?1516Run 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.1718```bash19uvx hf-mem --model-id <model-id> --json-output20```2122If 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.2324```bash25uvx hf-mem --model-id <model-id> --gguf-file <file-or-path> --json-output26```27…
Excerpt shown under the repository's Apache-2.0 license.
More skills in skills
- ▸hf-cli
- ▸hf-cloud-aws-context-discovery
- ▸hf-cloud-python-env-setup
- ▸hf-cloud-sagemaker-deployment-planner
- ▸hf-cloud-sagemaker-iam-preflight
- ▸hf-cloud-sagemaker-production-defaults
- ▸hf-cloud-serving-image-selection
- ▸huggingface-best
- ▸huggingface-community-evals
- ▸huggingface-datasets
- ▸huggingface-gradio
- ▸huggingface-llm-trainer
