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

Use latest apex internal API #8129

Merged
merged 1 commit into from
Jan 16, 2024
Merged

Conversation

jbaczek
Copy link
Collaborator

@jbaczek jbaczek commented Jan 5, 2024

What does this PR do ?

Apex _fast_layer_norm added mandatory argument memory_efficient. This PR fixes call to this function to accommodate to the change.

Jenkins CI

To run Jenkins, a NeMo User with write access must comment jenkins on the PR.

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

PR Type:

  • New Feature
  • [x ] Bugfix
  • Documentation

Who can review?

@mikolajblaz can you review this one? I can see that you introduced this line 17 months ago. Can we move to the APEX implementation entirely as suggested in the TODO?

Additional Information

  • Related to # (issue)

@github-actions github-actions bot added the NLP label Jan 5, 2024
Copy link
Collaborator

@mikolajblaz mikolajblaz left a comment

Choose a reason for hiding this comment

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

Looks good. Apex version still has no LayerNorm1p version so can't switch completely

@jbaczek jbaczek changed the title [Draft] Use latest apex internal API Use latest apex internal API Jan 9, 2024
@janekl janekl force-pushed the jbaczek/bugfix/update_LayerNorm1P_API branch from 143aab7 to 4d18d26 Compare January 10, 2024 14:22
@@ -40,7 +40,7 @@ def reset_parameters(self):
torch.nn.init.zeros_(self.bias)

def forward(self, x):
return _fast_layer_norm(x, self.weight + 1, self.bias, self.epsilon)
return _fast_layer_norm(x, self.weight + 1, self.bias, self.epsilon, memory_efficient=False)
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is this hardcoded to False? Instead it can be run by just passing self.memory_efficient as a parameter right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

AFAIU memory_efficient=False is the previous implementation of _fast_layer_norm. As non memory efficient implementation has been tested I left it like this.
We can make it switchable but I think it would be beneficial to test it first. What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds good, we can keep it as it is

@layalir layalir merged commit c2aa737 into main Jan 16, 2024
15 checks passed
@layalir layalir deleted the jbaczek/bugfix/update_LayerNorm1P_API branch January 16, 2024 16:08
minitu pushed a commit to minitu/NeMo that referenced this pull request Jan 19, 2024
ssh-meister pushed a commit to ssh-meister/NeMo that referenced this pull request Feb 15, 2024
Signed-off-by: Jan Baczek <[email protected]>
Signed-off-by: Sasha Meister <[email protected]>
pablo-garay pushed a commit that referenced this pull request Mar 19, 2024
Signed-off-by: Jan Baczek <[email protected]>
Signed-off-by: Pablo Garay <[email protected]>
rohitrango pushed a commit to rohitrango/NeMo that referenced this pull request Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants