Skip to content

Commit 7a56ac5

Browse files
authored
Support shortcut name for DeepSpeed stage 1 offload (#19075)
1 parent 9624aae commit 7a56ac5

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

src/lightning/fabric/strategies/deepspeed.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,13 @@ def clip_gradients_value(
551551
def register_strategies(cls, strategy_registry: _StrategyRegistry) -> None:
552552
strategy_registry.register("deepspeed", cls, description="Default DeepSpeed Strategy")
553553
strategy_registry.register("deepspeed_stage_1", cls, description="DeepSpeed with ZeRO Stage 1 enabled", stage=1)
554+
strategy_registry.register(
555+
"deepspeed_stage_1_offload",
556+
cls,
557+
description="DeepSpeed with ZeRO Stage 1 and optimizer CPU Offload",
558+
stage=1,
559+
offload_optimizer=True,
560+
)
554561
strategy_registry.register("deepspeed_stage_2", cls, description="DeepSpeed with ZeRO Stage 2 enabled", stage=2)
555562
strategy_registry.register(
556563
"deepspeed_stage_2_offload",

src/lightning/pytorch/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
1717
- Added a utility function and CLI to consolidate FSDP sharded checkpoints into a single file ([#19213](https://github.com/Lightning-AI/lightning/pull/19213))
1818
- The TQDM progress bar now respects the env variable `TQDM_MINITERS` for setting the refresh rate ([#19381](https://github.com/Lightning-AI/lightning/pull/19381))
1919
- Added support for saving and loading stateful training DataLoaders ([#19361](https://github.com/Lightning-AI/lightning/pull/19361))
20+
- Added shortcut name `strategy='deepspeed_stage_1_offload'` to the strategy registry ([#19075](https://github.com/Lightning-AI/lightning/pull/19075))
2021
- Added support for non-strict state-dict loading in Trainer via the new `LightningModule.strict_loading = True | False` attribute ([#19404](https://github.com/Lightning-AI/lightning/pull/19404))
2122

2223
### Changed

tests/tests_fabric/strategies/test_registry.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def test_available_strategies_in_registry():
4444
"ddp",
4545
"deepspeed",
4646
"deepspeed_stage_1",
47+
"deepspeed_stage_1_offload",
4748
"deepspeed_stage_2",
4849
"deepspeed_stage_2_offload",
4950
"deepspeed_stage_3",

0 commit comments

Comments
 (0)