Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the interface to use SHARP to FSDP strategy #8202

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading