NVIDIA/Megatron-LM

Public

Ongoing research training transformer models at scale

  • Stars18.6k+126 tuần này
  • Forks4.8k
  • Watchers163
  • Issues546
  • Ngày tạo21/03/2019
  • Cập nhật gần nhất01/12/2026
  • Ngôn ngữPython
  • Giấy phép—
README.md15.8 KBRaw

Megatron-LM and Megatron Core

GPU-optimized library for training transformer models at scale

Documentation version license

About

This repository contains two components: Megatron-LM and Megatron Core.

Megatron-LM is a reference example that includes Megatron Core plus pre-configured training scripts, ideal for research teams, learning distributed training, and quick experimentation.

Megatron Core is a composable library with GPU-optimized building blocks for custom training frameworks. It provides transformer building blocks, advanced parallelism strategies (TP, PP, DP, EP, and CP), mixed precision support (FP16, BF16, FP8, and FP4), and model architectures, ideal for framework developers and ML engineers building custom training pipelines.

Megatron Bridge provides bidirectional Hugging Face ↔ Megatron checkpoint conversion with production-ready recipes.

Getting Started

Compatibility: Python 3.12+ and PyTorch 2.6.0+ recommended. For source development, the tested NGC PyTorch base images are pinned in docker/.ngc_version.dev and docker/.ngc_version.lts.

Install from PyPI:

uv pip install megatron-core

Or clone and install from source:

git clone https://github.com/NVIDIA/Megatron-LM.git
cd Megatron-LM
uv pip install -e .

Note: Building from source can use a lot of memory. If the build runs out of memory, limit parallel compilation jobs by setting MAX_JOBS (for example, MAX_JOBS=4 uv pip install -e .).

For NVIDIA GPU Cloud (NGC) container setup and all installation options, review the Installation Guide.

Latest News

Nội dung README thuộc về NVIDIA và cộng đồng đóng góp, giấy phép Không có giấy phép. Nguồn: github.com/NVIDIA/Megatron-LM