-
Notifications
You must be signed in to change notification settings - Fork 283
Add StableLM-3B 4E1T to Keras Hub #2151
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
base: master
Are you sure you want to change the base?
Conversation
@divyashreepathihalli Here is a comparison of numerics with Hugging Face in Colab. The results match with an absolute tolerance of 1e-3, but they do not match when using 1e-5. Could you please take a look and suggest some improvements or explanations for this discrepancy? |
The numerics is good enough! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, but let's check the numerics and the generate output.
self._inv_norm_factor = 1.0 / math.sqrt(head_dim) | ||
|
||
# Query projection (no bias ) | ||
self._query_dense = keras.layers.EinsumDense( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just name layers without the underscore at the beginning. So, self.query_dense
.
self.rotary_dim = int(head_dim * self.rotary_percentage) | ||
self._inv_norm_factor = 1.0 / math.sqrt(head_dim) | ||
|
||
# Query projection (no bias ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Remove the space after bias?
num_layers: int. The number of transformer layers (32 for | ||
StableLM-3B4E1T). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably don't need (32 for StableLM-2B4E1T)
here (and elsewhere too), since it'll be part of the config anyway. Let's remove.
@Bond099 let's sync this with the latest changes and make sure to run our format script. I'm not exactly sure why non of our CI is running, but I don't think it ran. |
This PR adds the StableLM-3B 4E1T model to Keras Hub. However, numerical matching with the Hugging Face implementation is still in progress.