megatron-memory-estimator

Estimate GPU memory usage for Megatron dense and MoE models from HuggingFace configs.

141|11|Updated Jan 7, 2026
One-click install
npx skills add https://github.com/yzlnew/infra-skills --skill megatron-memory-estimator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: megatron-memory-estimator
Source: https://github.com/yzlnew/infra-skills/tree/main/megatron-memory-estimator
Command: npx skills add https://github.com/yzlnew/infra-skills --skill megatron-memory-estimator

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires mbridge, transformers, and includes scripts (resource) and references (resource) components.

What problem does it solve?

Predicts GPU memory usage for Megatron-based models (dense and MoE) to prevent memory errors and optimize resource planning.

Core Features & Use Cases

  • Estimate memory from HuggingFace configs or local model specs.
  • Compare parallelism strategies (TP, PP, EP, CP) and choose the best fit.
  • Determine if a model fits on available GPUs and get actionable memory headroom guidance.
  • Provide a detailed memory breakdown and per-PP/per-GPU estimates to aid deployment decisions.

Quick Start

Run the estimator against a HuggingFace model path with TP/PP/EP settings to quickly assess GPU memory for Megatron models.

Frequently Asked Questions about megatron-memory-estimator

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

FAQPage Schema
How do I estimate GPU memory usage for Megatron-LM MoE models?

Estimate GPU memory for Megatron-LM MoE models by inputting HuggingFace configs or local model specifications to calculate per-GPU peak memory and detailed memory breakdowns.

Can I compare TP, PP, EP, and CP parallelism strategies for Megatron-core models?

Compare TP, PP, EP, and CP parallelism configurations to determine the best fit for dense or MoE models and verify if they fit within available GPU memory limits.

Does the Megatron memory estimator support HuggingFace model configs directly?

The estimator supports HuggingFace configs directly, allowing extraction of MoE parameters and dense model specifications to predict memory usage without manual conversion.

What is the best way to plan GPU resources for large dense models in Megatron?

Plan GPU resources by running the estimator against model configs to obtain a memory breakdown and actionable memory headroom guidance for deployment decisions.

Why do I get out of memory errors with my Megatron MoE configuration?

Out of memory errors occur when parallelism settings exceed GPU limits; use the estimator to verify per-PP and per-GPU estimates and adjust TP, PP, EP, or CP configurations accordingly.