You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Familiarity with `multi-GPU training <../beginner/ddp_series_multigpu.html>`__ and `torchrun <../beginner/ddp_series_fault_tolerance.html>`__
30
-
- [Optional] Familiarity with `multinode training <ddp_series_multinode.html>`__
31
-
- 2 or more TCP-reachable GPU machines (this tutorial uses AWS p3.2xlarge instances)
32
29
- PyTorch `installed <https://pytorch.org/get-started/locally/>`__ with CUDA on all machines
30
+
- Familiarity with `multi-GPU training <../beginner/ddp_series_multigpu.html>`__ and `torchrun <../beginner/ddp_series_fault_tolerance.html>`__
31
+
- [Optional] Familiarity with `multinode training <ddp_series_multinode.html>`__
32
+
- 2 or more TCP-reachable GPU machines for multi-node training (this tutorial uses AWS p3.2xlarge instances)
33
+
33
34
34
35
Follow along with the video below or on `youtube <https://www.youtube.com/watch/XFsFDGKZHh4>`__.
35
36
@@ -63,25 +64,23 @@ from any node that has access to the cloud bucket.
63
64
64
65
Using Mixed Precision
65
66
~~~~~~~~~~~~~~~~~~~~~~~~
66
-
To speed things up, you might be able to use `Mixed Precision <https://pytorch.org/docs/stable/amp.html>`__ to train your models.
67
-
In Mixed Precision, some parts of the training process are carried out in reduced precision, while other steps
68
-
that are more sensitive to precision drops are maintained in FP32 precision.
67
+
To speed things up, you might be able to use `Mixed Precision <https://pytorch.org/docs/stable/amp.html>`__ to train your models.
68
+
In Mixed Precision, some parts of the training process are carried out in reduced precision, while other steps
69
+
that are more sensitive to precision drops are maintained in FP32 precision.
69
70
70
71
71
72
When is DDP not enough?
72
73
~~~~~~~~~~~~~~~~~~~~~~~~
73
74
A typical training run's memory footprint consists of model weights, activations, gradients, the input batch, and the optimizer state.
74
-
Since DDP replicates the model on each GPU, it only works when GPUs have sufficient capacity to accomodate the full footprint.
75
+
Since DDP replicates the model on each GPU, it only works when GPUs have sufficient capacity to accomodate the full footprint.
75
76
When models grow larger, more aggressive techniques might be useful:
76
77
77
-
- `activation checkpointing <https://pytorch.org/docs/stable/checkpoint.html>`__: Instead of saving intermediate activations during the forward pass, the activations are recomputed during the backward pass. In this approach, we run more compute but save on memory footprint.
78
-
- `Fully-Sharded Data Parallel <https://pytorch.org/docs/stable/fsdp.html>`__: Here the model is not replicated but "sharded" across all the GPUs, and computation is overlapped with communication in the forward and backward passes. Read our `blog <https://medium.com/pytorch/training-a-1-trillion-parameter-model-with-pytorch-fully-sharded-data-parallel-on-aws-3ac13aa96cff>`__ to learn how we trained a 1 Trillion parameter model with FSDP.
79
-
78
+
- `Activation checkpointing <https://pytorch.org/docs/stable/checkpoint.html>`__: Instead of saving intermediate activations during the forward pass, the activations are recomputed during the backward pass. In this approach, we run more compute but save on memory footprint.
79
+
- `Fully-Sharded Data Parallel <https://docs.pytorch.org/docs/stable/distributed.fsdp.fully_shard.html>`__: Here the model is not replicated but "sharded" across all the GPUs, and computation is overlapped with communication in the forward and backward passes. Read our `blog <https://medium.com/pytorch/training-a-1-trillion-parameter-model-with-pytorch-fully-sharded-data-parallel-on-aws-3ac13aa96cff>`__ to learn how we trained a 1 Trillion parameter model with FSDP.
80
80
81
81
Further Reading
82
82
---------------
83
83
- `Multi-Node training with DDP <ddp_series_multinode.html>`__ (previous tutorial in this series)
84
84
- `Mixed Precision training <https://pytorch.org/docs/stable/amp.html>`__
85
-
- `Fully-Sharded Data Parallel <https://pytorch.org/docs/stable/fsdp.html>`__
85
+
- `Fully-Sharded Data Parallel tutorial <https://docs.pytorch.org/tutorials/intermediate/FSDP_tutorial.html>`__
86
86
- `Training a 1T parameter model with FSDP <https://medium.com/pytorch/training-a-1-trillion-parameter-model-with-pytorch-fully-sharded-data-parallel-on-aws-3ac13aa96cff>`__
87
-
- `FSDP Video Tutorial Series <https://www.youtube.com/playlist?list=PL_lsbAsL_o2BT6aerEKgIoufVD_fodnuT>`__
0 commit comments