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

fsdp for bert #140

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Conversation

jacobfulano
Copy link
Contributor

This is a draft PR for FSDP implementation in BERT

@@ -545,6 +546,70 @@ def forward(
all_encoder_layers.append(hidden_states)
return all_encoder_layers

# Param Initialization, needed for device='meta' fast initialization
def param_init_fn(self, module):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jacobfulano a few comments:

  • param_init_fn is not needed unless you plan to make your models meta initializable. For a first draft, I would remove entirely
  • fsdp_wrap_fn and activation_checkpointing_fn need to be defined on a root module underneath the ComposerModel. So they have to be defined for say, BertForMaskedLM. I would recommend moving the definition there, and I think it will work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants