Skip to content

Commit

Permalink
Add the interface to use SHARP to FSDP strategy (#8202)
Browse files Browse the repository at this point in the history
Signed-off-by: Sangkug Lym <slym@nvidia.com>
Signed-off-by: stevehuang52 <heh@nvidia.com>
  • Loading branch information
erhoo82 authored and stevehuang52 committed Jan 31, 2024
1 parent 069773c commit cc78cb8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions nemo/collections/nlp/parts/megatron_trainer_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def _training_strategy(self) -> Union[NLPDDPStrategy, NLPFSDPStrategy]:
sharded_checkpoint=sharded_checkpoint,
precision=self.cfg.trainer.precision,
nccl_communicator_config_path=self.cfg.model.get('nccl_communicator_config_path', None),
sharp=self.cfg.model.get('sharp', False),
)

return NLPDDPStrategy(
Expand Down
2 changes: 2 additions & 0 deletions nemo/collections/nlp/parts/nlp_overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ def __init__(
sharded_checkpoint: bool = False,
precision: Union[int, str] = 'bf16-mixed',
nccl_communicator_config_path: Optional[str] = None,
sharp: bool = False,
**kwargs: Union[Any, Dict[str, Any]],
) -> None:
if not HAVE_APEX:
Expand Down Expand Up @@ -561,6 +562,7 @@ def __init__(
)

self.nccl_communicator_config_path = nccl_communicator_config_path
self.sharp = sharp
super().__init__(**kwargs)

def _set_mixed_precision_recipe(
Expand Down

0 comments on commit cc78cb8

Please sign in to comment.