mirror of
https://github.com/GoogleCloudPlatform/vertex-ai-samples.git
synced 2026-09-26 14:42:04 +00:00
1.6 KiB
1.6 KiB
PyTorch Efficient Training Examples
This folder provides PyTorch efficient training examples using ResNet-50 and ImageNet data.
Requirements
pip install --upgrade pip
pip install -r requirements.txt
Description
- resnet.py - Train ResNet-50 on single GPU.
- resnet_dp.py - Train ResNet-50 on single node multiple GPUs with
DataParallelstrategy. - resnet_ddp.py - Train ResNet-50 on single node multiple GPUs with
DistributedDataParallelstrategy. - resnet_ddp_wds.py - Train ResNet-50 on single node multiple GPUs with
DistributedDataParallelstrategy andWebdataset. - resnet_fsdp.py - Train ResNet-50 on single node multiple GPUs with
FullyShardedDataParallelstrategy. - resnet_fsdp_wds.py - Train ResNet-50 on single node multiple GPUs with
FullyShardedDataParallelstrategy andWebdataset. - shard_imagenet.py - Shard ImagNet individual files into
tarfiles.
Benchmark
When run the benchmark on Nvidia T4 GPUs using ImageNet validation dataset, you can get the result like:
| Strategy | Seconds/Epoch - Local Data | Seconds/Epoch - Cloud Data |
|---|---|---|
| On 1 GPU | 489 | 804 (2x slower) |
| On 4 GPUs (DP) | 157 | 738 (5x slower) |
| On 4 GPUs (DDP) | 134 | 432 (3x slower) |
| On 4 GPUs (DDP + WDS) | 131 | 133 (same performance) |
| On 4 GPUs (FSDP) | 139 | 353 (3x slower) |
| On 4 GPUs (FSDP + WDS) | 138 | 135 (same performance) |