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

[gpt2pre 1.2] Start End Packer call method #7791

Merged
merged 23 commits into from
Jul 11, 2023

Conversation

pforderique
Copy link
Contributor

Implements the full StartEndPacker class including it's call() method.
This is PR 2/2 of the full StartEndPacker implementation.

Depends on #7790.

NOTE:
The keras implementation includes a return_padding_mask parameter in the constructor. Setting this True makes the call method return the padded ragged tensor AND a mask of padded tokens as a tuple. This tuple return was not possible in the TypeScript implementation without changing the call type signature to [Tensor|Tensor[], Tensor|Tensor[]]. Therefore, I opted to create a separate method, callAndReturnPaddingMask() that returns just that. The call method simply takes the first result of this method call.

Room for optimization:
Currently, a mask will be calculated every time call is called, even when not needed. Decomposing the function further can help and can be done in the cleanup PR.

Copy link
Member

@mattsoulanille mattsoulanille left a comment

Choose a reason for hiding this comment

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

I have a few suggestions. Nice test coverage!

@pforderique
Copy link
Contributor Author

@mattsoulanille your comments have been addressed. Thanks for the review!

Copy link
Member

@mattsoulanille mattsoulanille left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@Linchenn Linchenn left a comment

Choose a reason for hiding this comment

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

LGTM!

@pforderique pforderique merged commit 261037e into tensorflow:master Jul 11, 2023
2 checks passed
@pforderique pforderique deleted the start-end-packer-call branch July 11, 2023 17:37
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.

None yet

3 participants