Skip to content

position_ids returned by packing #1

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

Conversation

qgallouedec
Copy link

What does this PR do?

Fixes # (issue)

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a GitHub issue? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@qgallouedec qgallouedec marked this pull request as ready for review June 5, 2025 05:49
@qgallouedec
Copy link
Author

qgallouedec commented Jun 5, 2025

It seems like position_ids must be combined with padding_free, otherwise it will silently fall back to flash_attn_varlen_func. I'll need to update the collator to flatten the batch. Ill do this tomorrow

EDIT: not exactly true, it will try to build the position_ids from the completion mask, and this is not what we want here.

@thepowerfuldeez
Copy link
Owner

ah, technically it should be possible to return position_ids and data collator will then only flatten batch of prepared position ids! good idea

@thepowerfuldeez
Copy link
Owner

thepowerfuldeez commented Jun 5, 2025

Awesome and quick work! Just tested it with this branch + transformers main, seems to be correct

@thepowerfuldeez thepowerfuldeez self-requested a review June 5, 2025 15:35
@thepowerfuldeez thepowerfuldeez merged commit 69f21ff into thepowerfuldeez:packing_with_flash_attn_kwargs Jun 5, 2025
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.

2 participants