-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Handle potentially long sequences with DataCollatorForCompletionOnlyLM #644
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.
Looks good to me, thanks for fixing! Just a small nit then we can merge.
The documentation is not available anymore as the PR was closed or merged. |
Also could you run the code quality tests with |
Hey @lvwerra, thanks for the review. The requested changes have been made and |
Looks like the tests are not passing, yet. |
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.
Hi @tannonk
Thanks a lot for the PR!
In my opinion, currently raising a RuntimeError
really helps for understanding whether things worked correctly or not for users, I am afraid the warning is not a strong enough indicator to users. Maybe it is better to keep it and add a flag allow_ignore_not_matched
for advanced users and keep the previous behaviour untouched, what do you think? cc @lvwerra - if that's not a good idea I am happy to merge the PR as it is as well
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.
huggingface#644) * avoid RuntimeError on long sequences * add unittests and format * remove dependency on external repo * bug fix in DataCollatorForCompletionOnlyLM
This PR resolves #643 and provides a patch in
DataCollatorForCompletionOnlyLM
for handling long sequences which may or may not contain a validresponse_template
or a validinstruction_template
.For problematic instances where no
response_template
orinstruction_template
is found, we set the labels to theignore_idx
. As a result, problematic instances are ignored in the loss computation, but still allow for training to continue.