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

Support O2 training of PEFT and SFT #7971

Merged
merged 2 commits into from
Dec 5, 2023
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
4 changes: 2 additions & 2 deletions nemo/collections/nlp/parts/mixins/nlp_adapter_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(self, *args, **kwargs):
self.use_ptuning_only = False
super().__init__(*args, **kwargs)
if hasattr(self, "enc_dec_model"):
self.model_prefix = "enc_dec_model." # for T5
self.model_prefix = "enc_dec_model.module." if self.cfg.megatron_amp_O2 else "enc_dec_model." # for T5
else:
self.model_prefix = "model.module." if self.cfg.megatron_amp_O2 else "model."

Expand Down Expand Up @@ -351,7 +351,7 @@ def sharded_state_dict(self, prefix: str = ''):
if not use_mcore_gpt or (self.use_peft and self.setup_complete):
return None
else:
return self.model.sharded_state_dict(prefix=self.model_prefix)
return super().sharded_state_dict(prefix=prefix)

def load_state_dict(self, state_dict, strict: bool = True):
if len(state_dict) == 0:
Expand Down
Loading