Skip to content

Collection of best practices, reference architectures, model training examples and utilities to train large models on AWS.

License

Notifications You must be signed in to change notification settings

aws-samples/awsome-distributed-training

ML Training Reference Architectures & Tests

This repository contains reference architectures and test cases for distributed model training with Amazon SageMaker Hyperpod, AWS ParallelCluster, AWS Batch, and Amazon EKS. The test cases cover different types and sizes of models as well as different frameworks and parallel optimizations (Pytorch DDP/FSDP, MegatronLM, NemoMegatron...).

The major components of this directory are:

reference-architectures/
|-- 1.architectures/               # CloudFormation templates for reference arch
|-- 2.ami_and_containers/          # Scripts to create AMIs and container images
|-- 3.test_cases/                  # Reference test cases and/or benchmark scripts
|-- 4.validation_observability/    # Tools to measure performance or troubleshoot
`-- ...

NOTE: the architectures are designed to work with the S3 bucket and VPC created using reference templates 1.architectures/0.s3/ and 1.architectures/1.vpc_network/. You're strongly recommended to deploy these two templates before deploying any of the reference architectures.

0. Workshops

You can follow the workshop below to train models on AWS. Each contains examples for several test cases as well as nuggets of information on operating a cluster for LLM training.

Name Comments
Amazon SageMaker HyperPod Workshop for SageMaker HyperPod, shows how to deploy and monitor it
AWS ParallelCluster Similar workshop as HyperPod but on ParallelCluster

1. Architectures

Architectures are located in 1.architectures and consists of utilities and service related architectures.

Name Category Usage
0.s3 Storage Create an S3 bucket
1.vpc_network Network Create a VPC with subnets required resources
2.aws-parallelcluster Compute Cluster templates for GPU & custom silicon training
3.aws-batch Compute AWS Batch template for distributed training
4.amazon-eks Compute Manifest files to train with Amazon EKS
5.sagemaker-hyperpod Compute SageMaker HyperPod template for distributed training

More will come, feel free to add new ones (ex. Ray?). You will also find documentation for EFA and the recommended environment variables.

2. Custom Amazon Machine Images

Custom machine images can be built using Packer for AWS ParallelCluster, Amazon EKS and plain EC2. These images are based are on Ansible roles and playbooks.

3. Test cases: support matrix

All test cases are under 3.test_cases/. You can go in each test case directory to learn how to run it.

Test cases Slurm Kubernetes AWS Batch
1.megatron-lm
2.nemo-launcher
3.MPT
4.DDP
5.param-benchmark
6.stable-diffusion
7.tensorflow-distributed
10.FSDP
11.modelparallel
12.SM-dataparallel-FSDP
13.SM-dataparallel-deepspeed
14.bionemo
15.gpt-neox
16.pytorch-cpu-ddp
17.SM-modelparallelv2
18.deepspeed
jax

4. Validation scripts

Utilities scripts and micro-benchmarks examples are set under 4.validation_scripts/. The EFA Prometheus exporter can be found in this directory

Name Comments
1.pytorch-env-validation Validates your PyTorch environment
3.efa-node-exporter Node exporter with Amazon EFA monitoring modules
4.prometheus-grafana Deployment assets to monitor SageMaker Hyperpod Clusters
5.nsight Shows how to run Nvidia Nsight Systems to profile your workload
efa-versions.py Get the versions of Nvidia libraries, drivers and EFA drivers

5. CI

Integration tests are written in pytest. Just run:

pytest .

Alternatively you can run tests with out capturing stdout and keeping all docker images an other artifacts.

pytest -s --keep-artifacts=t

6. Contributors

Thanks to all the contributors for building, reviewing and testing.

Contributors