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 FlaxBigBirdEmbeddings #17842

Merged
merged 1 commit into from
Jul 1, 2022
Merged

Conversation

ydshieh
Copy link
Collaborator

@ydshieh ydshieh commented Jun 23, 2022

What does this PR do?

Current FlaxBigBirdEmbeddings applies layer norm before dropout, while BigBirdEmbeddings and Google's original BigBird
applies dropout first. This PR fixes this inconsistency.

Flax
(layernorm --> dropout)

hidden_states = self.LayerNorm(hidden_states)
hidden_states = self.dropout(hidden_states, deterministic=deterministic)

PyTorch
(dropout immediately after embedding)

embeddings = self.dropout(embeddings)
embeddings = self.LayerNorm(embeddings)

Google
(dropout immediately after embedding)
https://github.com/google-research/bigbird/blob/5f2a5aa7fbab23e32e0e0b41c5f0192f0c023e05/bigbird/core/utils.py#L565-L566

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 23, 2022

The documentation is not available anymore as the PR was closed or merged.

Copy link
Contributor

@patrickvonplaten patrickvonplaten left a comment

Choose a reason for hiding this comment

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

Thanks for fixing - also cc @vasudevgupta7 can you confirm?

Copy link
Contributor

@patil-suraj patil-suraj left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

@ydshieh
Copy link
Collaborator Author

ydshieh commented Jul 1, 2022

I will merge this PR today.

@ydshieh ydshieh merged commit 8bb2c38 into huggingface:main Jul 1, 2022
@ydshieh ydshieh deleted the fix_bigbird_embedding branch July 1, 2022 14:46
viclzhu pushed a commit to viclzhu/transformers that referenced this pull request Jul 18, 2022
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.

4 participants