Note: If the installation fails due to memory issues during compilation, limit the parallel jobs by prefixing the command with MAX_JOBS=4 .
If you need additional features like , SentencePiece , or the Transformer Engine , use the following command for a complete setup: Download Install Megatron Repo zip
NVIDIA recommends using the package manager for a faster, more reliable installation. Step 1: Install uv (if not already present): curl -LsSf https://astral.sh/uv/install.sh | sh Use code with caution. Copied to clipboard Note: If the installation fails due to memory
Before installing the repository, verify that your environment includes the following essential software and hardware components: Copied to clipboard Before installing the repository, verify
While developers typically use git clone , you can manually download the repository: Navigate to the NVIDIA Megatron-LM GitHub . Click the green button and select Download ZIP . Extract the ZIP file to your desired directory: unzip Megatron-LM-main.zip cd Megatron-LM-main Use code with caution. Copied to clipboard 3. Installation Steps
: An NVIDIA GPU (Turing architecture or later recommended). For advanced FP8 support, NVIDIA Hopper, Ada, or Blackwell GPUs are required. Python : Version 3.10 or higher (3.12 is recommended). PyTorch : Version 2.6.0 or higher. CUDA Toolkit : The latest stable version.
Once inside the container, you can proceed with the source installation as described above.