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

Fix glu activation #148

Merged
merged 6 commits into from
Oct 22, 2021
Merged

Fix glu activation #148

merged 6 commits into from
Oct 22, 2021

Conversation

thomasw21
Copy link
Member

@thomasw21 thomasw21 commented Oct 21, 2021

Test concerning glu was bypassed due to missing "--no-bias-gelu-fusion" which bypasses the whole activation path. Check https://github.com/bigscience-workshop/Megatron-DeepSpeed/blob/main/megatron/model/transformer.py#L101

The reason I came up with that, is glu activations divides the last dimension by two. which would not be possible in current MLP mechanism.

In fact https://arxiv.org/abs/2002.05202 changes the hidden size as instead of two matrices, you have three (2 are merged together in the implementation)

cc @jaketae

@thomasw21 thomasw21 requested review from jaketae and stas00 October 21, 2021 14:09
Copy link
Contributor

@stas00 stas00 left a comment

Choose a reason for hiding this comment

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

I will try to read the paper soon, but until then I defer to Jake on the proposed functionality change.

I made one proposal on the code changes, the rest looks good.

Thank you, Thomas!

megatron/arguments.py Outdated Show resolved Hide resolved
Copy link
Member

@jaketae jaketae left a comment

Choose a reason for hiding this comment

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

Thank you for fixing this! I realize that GLU unit tests only perform checks on individual tensors and their computed values, not the whole training pipeline, so this fix was necessary. Looks good to me!

@stas00
Copy link
Contributor

stas00 commented Oct 22, 2021

Hmm, I think we got a new pytorch and apex needs a manual rebuild and making a new image:

ImportError: /usr/local/lib/python3.8/dist-packages/amp_C.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZNK2at6Tensor7optionsEv

but test_training_all_3_glu test now fails with this PR:

stderr: ValueError: if glu-activation is used, please set --no-bias-gelu-fusion

I pushed a fix and re-run the test suite - good to merge now.

@thomasw21 thomasw21 merged commit bdc6ad6 into main Oct 22, 2021
@thomasw21 thomasw21 deleted the thomas/fix_glu_activation branch November 4, 2021 22:13
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.

3 participants