概念
Distributed training and HyperPod
Split the work across many GPUs by data or by model, and keep long jobs alive with HyperPod.
このレッスンはまだ翻訳されていないため、英語で表示しています。
Data parallel
- What is split
- The batch
- Use when
- The model fits one GPU
Pipeline parallel
- What is split
- Layers across GPUs
- Use when
- The model is too big
Tensor parallel
- What is split
- Math inside a layer
- Use when
- Very large layers
Sharded data parallel
- What is split
- Optimizer, gradients, parameters
- Use when
- Big model, many GPUs
| Strategy | What is split | Use when |
|---|---|---|
| Data parallel | The batch | The model fits one GPU |
| Pipeline parallel | Layers across GPUs | The model is too big |
| Tensor parallel | Math inside a layer | Very large layers |
| Sharded data parallel | Optimizer, gradients, parameters | Big model, many GPUs |
1 / 2
Data parallel
- What is split
- The batch
- Use when
- The model fits one GPU
Pipeline parallel
- What is split
- Layers across GPUs
- Use when
- The model is too big
Tensor parallel
- What is split
- Math inside a layer
- Use when
- Very large layers
| Strategy | What is split | Use when |
|---|---|---|
| Data parallel | The batch | The model fits one GPU |
| Pipeline parallel | Layers across GPUs | The model is too big |
| Tensor parallel | Math inside a layer | Very large layers |
2 / 2
Sharded data parallel
- What is split
- Optimizer, gradients, parameters
- Use when
- Big model, many GPUs
| Strategy | What is split | Use when |
|---|---|---|
| Sharded data parallel | Optimizer, gradients, parameters | Big model, many GPUs |
- 1A hardware fault hits the run.
- 2HyperPod health checks find the bad node and swap in a healthy one.
- 3Training resumes from the last checkpoint.
概要
Distributed training uses many GPUs on one or more instances. Data parallelism copies the whole model to every GPU and splits each batch among them. The GPUs share gradients after each step. Use it when the model fits on one GPU but the data is large. Model parallelism splits the model itself when it does not fit in one GPU: pipeline parallelism puts groups of layers on different GPUs, and tensor parallelism splits the math inside a layer across GPUs. Sharded data parallelism is a mix: it spreads the optimizer state, gradients and parameters across the data-parallel GPUs, so each GPU holds only a slice.
概要
SageMaker AI supplies libraries. The distributed data parallelism library speeds up the gradient exchange on AWS networking. The model parallelism library handles pipeline, tensor and sharded data parallelism for PyTorch. You switch them on with the distribution setting of the training job.
Large jobs also need fast links. Elastic Fabric Adapter (EFA) is a network interface on supported instances that gives low-latency, high-throughput communication between nodes, so GPUs do not wait on each other.
概要
SageMaker HyperPod is a persistent cluster built for foundation model training. It checks the health of instances, replaces a failed node, and resumes the job from the latest checkpoint, so a hardware fault does not waste days of work. You orchestrate it with Slurm or Amazon EKS. Save checkpoints to Amazon S3 or a shared file system.
覚えること
- Data parallel: copy the model to every GPU and split the batch.
- Model parallel: split the model, by layers (pipeline) or inside layers (tensor).
- Sharded data parallelism: shard optimizer state, gradients and parameters.
- EFA: low-latency networking between nodes.
覚えること
- HyperPod: health checks, node replacement and automatic resume from checkpoints.
- Try data parallel first. Use model parallel only when the model does not fit on one GPU.
試験では
- “The model is too large for one GPU’s memory” points to model parallelism or sharded data parallelism.
- “A large data set, and the model fits on one GPU” points to data parallelism.
- “Weeks-long foundation model training that must survive hardware failures” points to SageMaker HyperPod.
このタスクの内容 · 2.2
- Built-in algorithms for tabular data
- Built-in algorithms: clustering, dimensionality reduction, anomaly
- Built-in algorithms: text, sequence and forecasting
- Built-in algorithms: image and video
- Training jobs, script mode and ML libraries
SageMaker AMT
- Reducing training time
- Distributed training and HyperPod
- Overfitting, underfitting and catastrophic forgetting
- Combining models
- Epochs, steps, batch size and learning rate
- Task-specific prompt engineering
- Fine-tuning and continued pre-training in Bedrock
- PEFT, LoRA and fine-tuning on SageMaker
- Model distillation
- Optimizing retrieval and embedding models