Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PyTorch at JSC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Simulation and Data Lab Applied Machine Learning
PyTorch at JSC
Commits
f3e90b24
Commit
f3e90b24
authored
3 months ago
by
Jan Ebert
Browse files
Options
Downloads
Patches
Plain Diff
Add HSDP description
parent
99836847
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+28
-0
28 additions, 0 deletions
README.md
with
28 additions
and
0 deletions
README.md
+
28
−
0
View file @
f3e90b24
...
@@ -610,3 +610,31 @@ that collects the full model on the CPU and then saves it in a single
...
@@ -610,3 +610,31 @@ that collects the full model on the CPU and then saves it in a single
checkpoint file which can then be loaded in a single process. Keep in
checkpoint file which can then be loaded in a single process. Keep in
mind that this way of checkpointing is slower and limited by CPU
mind that this way of checkpointing is slower and limited by CPU
memory.
memory.
### HSDP
"Hybrid sharded data parallel" is a way to reduce communication in
FSDP training when your model does not need to be split across all
processes. This is achieved by creating independent replicas/copies of
the fully sharded model and feeding them distinct data, just like how
DDP does it. Similarly, the gradients obtained by these replicas on
the different input batches are averaged across the replicas. HSDP is
thus a combination of FSDP and DDP. Usually, it is recommended to use
as many replicas as nodes, so that the model is only sharded inside
nodes, but your mileage may vary. Especially if the model becomes too
large, you will have to split it up further than is possible on just
one node.
Communication is reduced because we do not have to execute the
expensive collect-discard steps for each FSDP unit's sharded
parameters across all processes; we only execute these expensive steps
in the limited number of shards per replica and execute a less
expensive gradient averaging step across the processes instead.
Additionally, communication inside a node is usually much faster than
across nodes, meaning we keep the expensive communication where
bandwidth is higher and the less expensive communication where
bandwidth is lower.
To enable HSDP, pass a number of desired FSDP replicas using the
`--num-fsdp-replicas`
argument. If this argument is not given,
standard FSDP is used.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment