Buckets:
xuan-luo/kvpath-optimization / KDA-optimization /env /third_party /Megatron-LM /docs /get-started /quickstart.md
| <!--- | |
| Copyright (c) 2022-2026, NVIDIA CORPORATION. All rights reserved. | |
| NVIDIA CORPORATION and its licensors retain all intellectual property | |
| and proprietary rights in and to this software, related documentation | |
| and any modifications thereto. Any use, reproduction, disclosure or | |
| distribution of this software and related documentation without an express | |
| license agreement from NVIDIA CORPORATION is strictly prohibited. | |
| --> | |
| # Your First Training Run | |
| This guide walks you through two training examples and then covers data preparation for your own datasets. You start with a minimal distributed loop to validate your environment, then run a full LLaMA-3 training job. Make sure you have completed [installation](install.md) before proceeding. | |
| ## Minimal Training Example | |
| Start with the simplest possible setup, a distributed training loop using mock data on two GPUs. This verifies that your environment is configured correctly before moving to real models. | |
| ```bash | |
| torchrun --nproc_per_node=2 examples/run_simple_mcore_train_loop.py | |
| ``` | |
| ## LLaMA-3 Training Example | |
| With the environment validated, run a production-scale example. The following script trains a LLaMA-3 8B model with FP8 mixed precision on eight GPUs using mock data, demonstrating tensor parallelism and optimized kernels. | |
| ```bash | |
| ./examples/llama/train_llama3_8b_h100_fp8.sh | |
| ``` | |
| ## Data Preparation | |
| To train on your own data, Megatron expects preprocessed binary files (`.bin` and `.idx`). | |
| ### 1. Prepare a JSONL File | |
| Each line should contain a `text` field: | |
| ```json | |
| {"text": "Your training text here..."} | |
| {"text": "Another training sample..."} | |
| ``` | |
| ### 2. Preprocess the Data | |
| Run the preprocessing script to tokenize and convert your data into binary format: | |
| ```bash | |
| python tools/preprocess_data.py \ | |
| --input data.jsonl \ | |
| --output-prefix processed_data \ | |
| --tokenizer-type HuggingFaceTokenizer \ | |
| --tokenizer-model /path/to/tokenizer.model \ | |
| --workers 8 \ | |
| --append-eod | |
| ``` | |
| ### Key Arguments | |
| - `--input`: Path to input JSON/JSONL file | |
| - `--output-prefix`: Prefix for output binary files (`.bin` and `.idx`) | |
| - `--tokenizer-type`: Tokenizer type (`HuggingFaceTokenizer`, `GPT2BPETokenizer`, and so on) | |
| - `--tokenizer-model`: Path to tokenizer model file | |
| - `--workers`: Number of parallel workers for processing | |
| - `--append-eod`: Add end-of-document token | |
| ## Next Steps | |
| - Explore [Parallelism Strategies](../user-guide/parallelism-guide.md) to scale your training | |
| - Learn about [Data Preparation](../user-guide/data-preparation.md) best practices | |
| - Explore [Advanced Features](../user-guide/features/index.md) for FP8 training, context parallelism, and more | |
Xet Storage Details
- Size:
- 2.68 kB
- Xet hash:
- b2d824c7867b7e92b1ea324bfa9648158cc5cdd4f03a20e6d180c7906603a122
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.