megatron-memory-estimator — Claude Code skill: memory estimates
megatron-memory-estimator is a Claude Code skill that estimates GPU memory for dense and MoE Megatron models from HuggingFace configs. Compare parallelism and check model fit.
no license ★ 158 updated 2026-07-09
npx skills add yzlnew/infra-skills --skill megatron-memory-estimator -a claude-codeWhat megatron-memory-estimator does
The skill estimates memory from a HuggingFace model path or a local config.json. Its main script, scripts/estimate_from_hf.py, converts the model configuration to Megatron format and calculates memory for the chosen training settings. Results can include a detailed model breakdown or be emitted as JSON.
Set TP, PP, EP and CP along with the GPU count, micro-batch size and sequence length to compare configurations. The estimator also accepts activation recomputation through --recompute-granularity and reports peak memory per GPU. Expert parallelism can be included for MoE models.
When the layer count cannot be divided evenly across PP stages, specify the layer count for the first or last stage. Otherwise, the chosen pipeline layout may not match the model’s layer distribution.
What it helps with
- Estimate GPU memory from a HuggingFace configuration
- Check whether a model fits the available GPU memory
- Compare TP, PP, EP and CP layouts
- Test training settings with activation recomputation
Example prompts for the agent
- Estimate memory for
deepseek-ai/DeepSeek-V3on 128 GPUs with TP 4, PP 4 and EP 8. - Calculate memory for a local
config.jsonusing TP 2 and PP 2. - Compare parallelism setups for
Qwen/Qwen3-235B-A22Band return JSON.
How to install megatron-memory-estimator
1Skills CLI (Vercel)
npx skills add yzlnew/infra-skills --skill megatron-memory-estimator -a claude-code2Manually: put the files in place
~/.claude/skills/megatron-memory-estimator/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/megatron-memory-estimator/
1Skills CLI (Vercel)
npx skills add yzlnew/infra-skills --skill megatron-memory-estimator -a codex2Manually: put the files in place
.agents/skills/megatron-memory-estimator/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add yzlnew/infra-skills --skill megatron-memory-estimator -a cursor2Manually: put the files in place
.cursor/skills/megatron-memory-estimator/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install yzlnew/infra-skills megatron-memory-estimator2Manually: put the files in place
.github/skills/megatron-memory-estimator/SKILL.md1Skills CLI (Vercel)
npx skills add yzlnew/infra-skills --skill megatron-memory-estimator -a gemini-cli2Platform CLI
gemini skills install https://github.com/yzlnew/infra-skills --path megatron-memory-estimatorManually: put the files in place
.devin/skills/megatron-memory-estimator/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about megatron-memory-estimator
How do I install megatron-memory-estimator in Claude Code?
Run npx skills add yzlnew/infra-skills --skill megatron-memory-estimator -a claude-code. The skill file is at ~/.claude/skills/megatron-memory-estimator/SKILL.md.
What does megatron-memory-estimator do?
It estimates GPU memory for dense and MoE Megatron models using a HuggingFace configuration or local config.json. You can compare parallelism settings and inspect peak memory per GPU.
How do I handle layers that cannot be divided evenly across PP stages?
Set the layer count for the first or last stage with --num-layers-in-first-pipeline-stage or --num-layers-in-last-pipeline-stage.