hf-mem

Estimate VRAM and parameter footprint for Safetensors-based Hugging Face models.

938|84|Updated Dec 22, 2025
One-click install
npx skills add https://github.com/alvarobartt/hf-mem --skill hf-mem
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: hf-mem
Source: https://github.com/alvarobartt/hf-mem/tree/main
Command: npx skills add https://github.com/alvarobartt/hf-mem --skill hf-mem

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

hf-mem provides estimates of the VRAM and parameter footprint required to load Safetensors-based Hugging Face models, helping you plan deployment and capacity.

Core Features & Use Cases

  • Estimate inference memory for Transformers, Diffusers and Sentence Transformers models using Safetensors metadata and HTTP Range requests.
  • Support gated/private models via HF_TOKEN and optional KV cache estimation with the --experimental flag for causal and multi-modal architectures.
  • Return results as a readable table or JSON, including per-component memory and optional KV cache details to aid capacity planning.

Quick Start

Use the hf-mem CLI to query a model, e.g.: uvx hf-mem --model-id <org/model-name> uvx hf-mem --model-id <org/model-name> --experimental

Frequently Asked Questions about hf-mem

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I estimate VRAM requirements for Hugging Face models?▼

Estimating VRAM requirements for Hugging Face models involves fetching Safetensors metadata from model.safetensors or model_index.json to aggregate per-component and total memory usage across Transformers, Diffusers, and Sentence Transformers architectures.

Can I calculate KV cache memory for causal language models on Hugging Face?▼

You can calculate KV cache memory for causal and multi-modal models by enabling the experimental flag, which uses max_model_len, batch_size, and kv_cache_dtype to estimate the additional cache size required during inference.

Does Hugging Face VRAM estimation work with gated or private repositories?▼

VRAM estimation supports gated and private repositories by authenticating Safetensors metadata fetch requests with the HF_TOKEN environment variable to access restricted Hugging Face Hub models.

What is the best way to check if a Diffusers model fits my GPU memory?▼

Checking if a Diffusers model fits available GPU memory requires aggregating Safetensors metadata from model_index.json to calculate total parameter footprint and per-component memory usage for deployment capacity planning.

How do I get JSON output for Hugging Face model memory estimation?▼

Getting JSON output for Hugging Face model memory estimation involves running the CLI command, which returns per-component memory details and optional KV cache metrics in structured JSON format alongside a readable table view.