training-llms-megatron
Trains large language models (2B-462B parameters) using NVIDIA Megatron-Core with advanced parallelism strategies. Use when training models u003e1B parameters, need maximum GPU efficiency (47% MFU on H100), or require tensor/pipeline/sequence/context/expert parallelism.
Installation
Pick a client and clone the repository into its skills directory.
Installation
About this skill
Trains large language models (2B-462B parameters) using NVIDIA Megatron-Core with advanced parallelism strategies. Use when training models u003e1B parameters, need maximum GPU efficiency (47% MFU on H100), or require tensor/pipeline/sequence/context/expert parallelism. Production-ready framework used for Nemotron, LLaMA, DeepSeek.
How to use
Zainstaluj Megatron-Core za pomocą Dockera (rekomendowane) — uruchom obraz
nvcr.io/nvidia/pytorch:25.04-py3z flagą--gpus all, lub zainstaluj pakiet bezpośrednio poleceniempip install megatron-core.Przygotuj konfigurację paralelizmu na podstawie rozmiaru modelu — dla modelu 7B na 8 GPU użyj tensor parallel=1, pipeline parallel=1, data parallel=8; dla 70B na 64 GPU ustaw tensor parallel=4, pipeline parallel=4, data parallel=4.
Skonfiguruj hiperparametry trenowania zgodnie z wybraną strategią paralelizmu i rozmiarem zestawu danych.
Uruchom trenowanie rozproszone poleceniem
torchrun --nproc_per_node=2 examples/run_simple_mcore_train_loop.pydla dwóch GPU, lub użyj gotowego skryptu./examples/llama/train_llama3_8b_fp8.shdo trenowania modelu LLaMA-3 8B.Monitoruj metryki wydajności podczas trenowania, aby upewnić się, że osiągasz oczekiwaną efektywność obliczeniową (Model FLOP Utilization).