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

ConstantLengthDataset Ignore Some Texts #1621

Open
TianyiPeng opened this issue May 4, 2024 · 1 comment
Open

ConstantLengthDataset Ignore Some Texts #1621

TianyiPeng opened this issue May 4, 2024 · 1 comment

Comments

@TianyiPeng
Copy link

Not a big concern. But the current implementation will ignore the last chunk of the data which is the remainder of the self.seq_length. Maybe worth adding the last chunk back with padding tokens.

            for i in range(0, len(all_token_ids), self.seq_length):
                input_ids = all_token_ids[i : i + self.seq_length]
                if len(input_ids) == self.seq_length:
                    examples.append(input_ids)

https://github.com/huggingface/trl/blob/main/trl/trainer/utils.py#L475-L478

@younesbelkada
Copy link
Collaborator

Thanks @TianyiPeng for the suggestion, the reason we don't add that is because we'll have to introduce custom attention masks. This will lead to slower training for setups that use for instance Flash Attention 2

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

No branches or pull requests

2 participants