forked from open-mmlab/mmpretrain
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Enhancement] Support deepspeed with flexible runner (open-mmlab#1673)
* [Feature] Support deepspeed with flexible runner * [Fix] Reformat with yapf * [Refacor] Rename configs * [Fix] Reformat with yapf * [Refactor] Remove unused keys * [Refactor] Change the _base_ path * [Refactor] Reformat
- Loading branch information
Showing
4 changed files
with
80 additions
and
2 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
configs/mae/benchmarks/vit-huge-p14_8xb128-ds-zero3-coslr-50e_in1k.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
_base_ = ['./vit-huge-p14_8xb128-coslr-50e_in1k.py'] | ||
|
||
# optimizer wrapper | ||
optim_wrapper = dict(type='DeepSpeedOptimWrapper') | ||
|
||
# training strategy | ||
# Deepspeed with ZeRO3 + fp16 | ||
strategy = dict( | ||
type='DeepSpeedStrategy', | ||
fp16=dict( | ||
enabled=True, | ||
fp16_master_weights_and_grads=False, | ||
loss_scale=0, | ||
loss_scale_window=500, | ||
hysteresis=2, | ||
min_loss_scale=1, | ||
initial_scale_power=15, | ||
), | ||
inputs_to_half=['inputs'], | ||
zero_optimization=dict( | ||
stage=3, | ||
allgather_partitions=True, | ||
reduce_scatter=True, | ||
allgather_bucket_size=50000000, | ||
reduce_bucket_size=50000000, | ||
overlap_comm=True, | ||
contiguous_gradients=True, | ||
cpu_offload=False, | ||
)) | ||
|
||
# runner which supports strategies | ||
runner_type = 'FlexibleRunner' |
32 changes: 32 additions & 0 deletions
32
configs/mae/benchmarks/vit-large-p16_8xb128-ds-zero3-coslr-50e_in1k.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
_base_ = ['./vit-large-p16_8xb128-coslr-50e_in1k.py'] | ||
|
||
# optimizer wrapper | ||
optim_wrapper = dict(type='DeepSpeedOptimWrapper') | ||
|
||
# training strategy | ||
# Deepspeed with ZeRO3 + fp16 | ||
strategy = dict( | ||
type='DeepSpeedStrategy', | ||
fp16=dict( | ||
enabled=True, | ||
fp16_master_weights_and_grads=False, | ||
loss_scale=0, | ||
loss_scale_window=500, | ||
hysteresis=2, | ||
min_loss_scale=1, | ||
initial_scale_power=15, | ||
), | ||
inputs_to_half=['inputs'], | ||
zero_optimization=dict( | ||
stage=3, | ||
allgather_partitions=True, | ||
reduce_scatter=True, | ||
allgather_bucket_size=50000000, | ||
reduce_bucket_size=50000000, | ||
overlap_comm=True, | ||
contiguous_gradients=True, | ||
cpu_offload=False, | ||
)) | ||
|
||
# runner which supports strategies | ||
runner_type = 'FlexibleRunner' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters