Skip to content

implement of leftpadding #2237

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

Closed
pass-lin opened this issue Apr 29, 2025 · 2 comments
Closed

implement of leftpadding #2237

pass-lin opened this issue Apr 29, 2025 · 2 comments

Comments

@pass-lin
Copy link
Contributor

Left padding is now the mainstream LLM padding method. However, keras_hub does not have a corresponding implementation.

Does the keras-team have a corresponding implementation plan? Or can I offer my help and implement it myself?

If it were me to implement this, I would add a "use_left_padding" parameter on top of StartEndPacker.

@mattdangerw
Copy link
Member

mattdangerw commented Apr 30, 2025

I think padding_side="left" and padding_side="right" would probably be a better name (keep right padding as the default)?

I would add this to StartEndPacker and MultiSegmentPacker in one go. The trickier part would be to support this in generation, that would need some bigger updates. But I don't see an issue with supporting this in our layers for a start.

@mattdangerw
Copy link
Member

@pass-lin feel free to open a PR if above makes sense to you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants