Skip to content

Fix glu activation#148

Merged
thomasw21 merged 6 commits into
mainfrom
thomas/fix_glu_activation
Oct 22, 2021
Merged

Fix glu activation#148
thomasw21 merged 6 commits into
mainfrom
thomas/fix_glu_activation

Conversation

@thomasw21
Copy link
Copy Markdown
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
Copy Markdown
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!

Comment thread megatron/arguments.py Outdated
Copy link
Copy Markdown
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
Copy Markdown
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