hf-mem — скилл для Claude Code: что делает и как установить
Считает, сколько памяти займёт модель с Hugging Face Hub при инференсе, и не скачивает веса. Пригодится, когда надо понять, влезет ли модель в GPU.
npx skills add huggingface/skills --skill hf-mem -a claude-codeЧто делает hf-mem
Скилл отвечает на вопрос «хватит ли памяти», пока веса лежат на Hub. hf_mem читает метаданные репозитория через HTTP Range-запросы и оценивает размер весов Safetensors или GGUF для инференса. Локально ничего не грузится.
Флаг --experimental добавляет расчёт KV-кэша. Считается он для LLM (...ForCausalLM), VLM (...ForConditionalGeneration) и GGUF. Длину контекста инструмент берёт из модели, а --max-model-len её переопределяет. Точность кэша по умолчанию равна точности модели, через --kv-cache-dtype задаётся своя.
Запуск идёт через uvx, поэтому нужен установленный uv. Для приватных и gated-моделей понадобится HF_TOKEN или флаг --hf-token. По GGUF-репозиторию оценка выдаётся на каждый файл отдельно, а в работу вы берёте одну точность — без --gguf-file цифра будет не про ваш запуск, это повод сразу указать нужный файл.
Какие задачи решает
- прикинуть память под модель до скачивания весов
- проверить, влезет ли модель в конкретную GPU
- посчитать KV-кэш для LLM или VLM
- выбрать квантование GGUF под доступную память
- сравнить требования нескольких моделей по их ID с Hub
Примеры запросов агенту
- Сколько VRAM нужно, чтобы запустить
mistralai/Mistral-7B-v0.1? - Проверь, влезет ли
unsloth/Qwen3.5-397B-A17B-GGUFв Q4_K_M на мою карту. - Посчитай память под
MiniMaxAI/MiniMax-M2вместе с KV-кэшем, контекст возьми из модели.
Как установить hf-mem
1Через Skills CLI (Vercel)
npx skills add huggingface/skills --skill hf-mem -a claude-code2Вручную: положить файлы
~/.claude/skills/hf-mem/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/hf-mem/
1Через Skills CLI (Vercel)
npx skills add huggingface/skills --skill hf-mem -a codex2Вручную: положить файлы
.agents/skills/hf-mem/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add huggingface/skills --skill hf-mem -a cursor2Вручную: положить файлы
.cursor/skills/hf-mem/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install huggingface/skills hf-mem2Вручную: положить файлы
.github/skills/hf-mem/SKILL.md1Через Skills CLI (Vercel)
npx skills add huggingface/skills --skill hf-mem -a gemini-cli2Командой платформы
gemini skills install https://github.com/huggingface/skills --path skills/hf-memВручную: положить файлы
.devin/skills/hf-mem/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add huggingface/skills --skill hf-mem -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о hf-mem
Как установить hf-mem в Claude Code?
Выполните npx skills add huggingface/skills --skill hf-mem -a claude-code. Скилл окажется по пути ~/.claude/skills/hf-mem/SKILL.md.
Что делает hf-mem?
Оценивает память под инференс для моделей с Hugging Face Hub: веса Safetensors или GGUF, а с флагом --experimental ещё и KV-кэш. Сами веса при этом не скачиваются.
Что нужно, чтобы скилл заработал?
Установленный uv, потому что запуск идёт через uvx. Для gated- и приватных моделей дополнительно HF_TOKEN или флаг --hf-token.
Исходный текст
SKILL.md · Apache-2.0
--- name: hf-mem description: Hugging Face CLI to estimate the required memory to load Safetensors or GGUF model weights for inference from the Hugging Face Hub --- `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. ```bash 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. ```bash 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: ```bash 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: ```bash 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: ```bash uvx hf-mem --model-id MiniMaxAI/MiniMax-M2 --json-output ``` For Diffusers with Safetensors weights: ```bash uvx hf-mem --model-id Qwen/Qwen-Image --json-output ``` For Sentence Transformers with Safetensors weights: ```bash uvx hf-mem --model-id google/embeddinggemma-300m --json-output ``` With `--experimental` to include the KV cache estimation for LLMs and VLMs: ```bash uvx hf-mem --model-id mistralai/Mistral-7B-v0.1 --experimental --json-output ``` And, for LLMs or VLMs with GGUF weights: ```bash uvx hf-mem --model-id unsloth/Qwen3.5-397B-A17B-GGUF --gguf-file Q4_K_M --experimental --json-output ```
© huggingface · Apache-2.0 · huggingface/skills