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

added geglu activation and tests #3512

Merged
merged 2 commits into from
Nov 28, 2023
Merged

Conversation

HMUNACHI
Copy link
Contributor

@HMUNACHI HMUNACHI commented Nov 28, 2023

What does this PR do?

Fixes # (3483)

This PR adds the GeGLU (Gated Linear Unit with GELU) activation function to the activation module of the Flax library. It is an increasingly popular activation layer which combines a linear transformation with a GELU activation in a gating mechanism, balancing linearity and non-linearity.

GeGLU is parameterised and as such uses Flax's Dense layer and was not part of Jax itself. The implementation allows for an optional output_dim attribute, which can be used to specify the number of output features. This can increase or decrease the -1th dimensions of the results and the code tries to account for that. The tests validate the functionality in three scenarios: standard usage, output dimension expansion, and output dimension contraction, ensuring the layer's reliability in various use cases.

Checklist

  • This PR adds GeGLU activation and tests.
  • This change is discussed in a Github issue/
    discussion
  • The documentation and docstrings adhere to the
    documentation guidelines.
  • This change includes necessary high-coverage tests.
    (No quality testing = no merge!)

@chiamp
Copy link
Collaborator

chiamp commented Nov 28, 2023

continued from #3495
fixes #3483

Copy link
Collaborator

@chiamp chiamp left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@HMUNACHI
Copy link
Contributor Author

LGTM, thanks!

Thanks

@copybara-service copybara-service bot merged commit 632e6c0 into google:main Nov 28, 2023
19 checks passed
@HMUNACHI HMUNACHI deleted the geglu branch November 28, 2023 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants