-
Notifications
You must be signed in to change notification settings - Fork 228
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 TokenAndPositionEmbedding Class #91
Conversation
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.
Thanks! Left some initial comments.
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.
Thanks! Few more comments.
Hey @mattdangerw I have made the proposed changes. |
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.
Please ignore this comment.
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.
Thanks! Last few comments from me I think!
sequence. | ||
|
||
Args: | ||
`vocabulary_size`: The size of the vocabulary (should be no larger |
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.
don't backtick the arg names themselves
class TokenAndPositionEmbedding(keras.layers.Layer): | ||
"""A layer which sums a token and position embedding. | ||
|
||
This class assumes that in the input tensor, the last dimension corresponds |
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.
I think this description is incorrect. In general the assumption should be an input of shape (batch_dim, sequence_dim)
right? Assumption--the last dimension is the sequence dim.
And the output will be (batch_dim, sequence_dim, embedding_dim)
.
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.
Yes, after I updated the tests, this seems to be the incorrect. This will be fixed.
Hey @mattdangerw, I hope these are final changes :) I tried formatting by running the scripts, but for some reason the lint fails for |
@adhadse thanks! LGTM! I'll look at the linting issue later today, if I see a fix, I can just add that directly here and merge. Looks like you have a merge conflict, can you rebase over latest master? |
Formatting issue fixed in #117 if you rebase and possibly reformat, should be good to go. |
Went through some hiccups, first time doing Rebase. |
Thanks! Looks like there were a few comments marked resolved but unaddressed. Cleaned this up, but please keep an eye out for that in the future. |
* Added TokenAndPositionEmbedding Class and tests * Added ragged tensor test, and model save test for TokenAndPositionEmbedding and bug fixes * Added dense input tests for TokenAndPositionEmbedding * Fix last few comments Co-authored-by: Matt Watson <1389937+mattdangerw@users.noreply.github.com>
Add Gemma2 building blocks and presets. --------- Co-authored-by: Matt Watson <mattdangerw@gmail.com>
Add Gemma2 building blocks and presets. --------- Co-authored-by: Matt Watson <1389937+mattdangerw@users.noreply.github.com>
* Add Gemma2 to Keras (#91) Add Gemma2 building blocks and presets. --------- Co-authored-by: Matt Watson <1389937+mattdangerw@users.noreply.github.com> * Set presets to one * Remove extra preset test * Pin Keras version to 3.3.3 --------- Co-authored-by: Matt Watson <1389937+mattdangerw@users.noreply.github.com>
Resolves #85.
Hey @mattdangerw, this PR is open for review and feedback.