Add `ddp_find_unused_parameters_true` alias in Fabric's DDPStrategy (#20125)
This commit is contained in:
parent
2129fdf362
commit
be0ae06596
|
@ -200,6 +200,13 @@ class DDPStrategy(ParallelStrategy):
|
|||
description=f"DDP strategy with `start_method={start_method!r}`",
|
||||
start_method=start_method,
|
||||
)
|
||||
strategy_registry.register(
|
||||
"ddp_find_unused_parameters_true",
|
||||
cls,
|
||||
description="Alias for `find_unused_parameters_true` and `start_method='popen'`",
|
||||
find_unused_parameters=True,
|
||||
start_method="popen",
|
||||
)
|
||||
|
||||
def _setup_distributed(self) -> None:
|
||||
self._set_world_ranks()
|
||||
|
|
|
@ -42,6 +42,7 @@ def test_strategy_registry_with_new_strategy():
|
|||
def test_available_strategies_in_registry():
|
||||
expected = {
|
||||
"ddp",
|
||||
"ddp_find_unused_parameters_true",
|
||||
"deepspeed",
|
||||
"deepspeed_stage_1",
|
||||
"deepspeed_stage_1_offload",
|
||||
|
|
|
@ -71,8 +71,9 @@ def test_run_env_vars_strategy(_, strategy, monkeypatch, fake_script):
|
|||
def test_run_get_supported_strategies():
|
||||
"""Test to ensure that when new strategies get added, we must consider updating the list of supported ones in the
|
||||
CLI."""
|
||||
assert len(_get_supported_strategies()) == 7
|
||||
assert len(_get_supported_strategies()) == 8
|
||||
assert "fsdp" in _get_supported_strategies()
|
||||
assert "ddp_find_unused_parameters_true" in _get_supported_strategies()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("strategy", ["ddp_spawn", "ddp_fork", "ddp_notebook", "deepspeed_stage_3_offload"])
|
||||
|
|
Loading…
Reference in New Issue