技能低风险未认领
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.
huggingfacehuggingface/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.
权限
声明检测
运行代码—无
安装—
uvx安装时运行脚本—无
网络—无
需要的凭据—无
工作区外的路径—无
智能体工具—无
检查
低风险 · 没有发现需要提醒的地方。
未经人工审核 · 已做规则检查;模型审核尚未开启。
文件1 个文件 · 1.9 KB
- SKILL.md1.9 KB
版本
- #2—最新2026年11月17日
- #1—2026年10月1日
hf-mem在 Codeg 中打开