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

Adding init_model_parallel to FabricMegatronStrategy #10733

Merged
merged 1 commit into from
Oct 9, 2024
Merged
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
5 changes: 5 additions & 0 deletions nemo/lightning/fabric/strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def __init__(
no_ddp_communication_hook: bool = True,
output_data_idx: bool = False,
pipeline_dtype: Optional[torch.dtype] = None,
init_model_parallel: bool = True,
**kwargs: Any,
) -> None:
super().__init__(
Expand All @@ -97,6 +98,7 @@ def __init__(
self.virtual_pipeline_model_parallel_size = virtual_pipeline_model_parallel_size
self.sequence_parallel = sequence_parallel
self.pipeline_dtype = pipeline_dtype
self._init_model_parallel = init_model_parallel

self.no_ddp_communication_hook = no_ddp_communication_hook
self.megatron_callbacks = CallbackConnector()
Expand Down Expand Up @@ -180,6 +182,9 @@ def setup_module(self, module: Module) -> MegatronParallel:
convert_module_fn=convert_module_fn,
)

if self._init_model_parallel:
megatron_parallel.init_model_parallel()

if not self.ddp_config:
from megatron.core import mpu

Expand Down
Loading