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

fix: Add pad_token to special_tokens_dict when pad_token == eos_token #436

Merged

Conversation

Abhishek-TAMU
Copy link
Collaborator

@Abhishek-TAMU Abhishek-TAMU commented Jan 9, 2025

Description of the change

Add pad_token to special_tokens_dict when pad_token == eos_token to increase F1 micro score for Granite3.0-8b model.

Related issue number

Issue:#343
Issue 343 modifies pad_token of tokenizer but in this PR adds it to special_tokens_dict for model resizing.

Reason of this case of pad_token == eos_token:
When tokenizer has PAD token equal to EOS token, then the DataCollatorForCompletionOnlyLM masks the EOS token from labels of dataset batch and hence its not used in loss calculation and hence it leads to repetitive predicted_target during inference time.

How to verify the PR

Was the PR tested

  • I have added >=1 unit test(s) for every new method I have added.
  • I have ensured all unit tests pass

Sorry, something went wrong.

Signed-off-by: Abhishek <[email protected]>
Copy link

github-actions bot commented Jan 9, 2025

Thanks for making a pull request! 😃
One of the maintainers will review and advise on the next steps.

@github-actions github-actions bot added the fix label Jan 9, 2025
Copy link
Collaborator

@Ssukriti Ssukriti left a comment

Choose a reason for hiding this comment

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

thank you!

for context for others: Without this fix the token values are not actually getting modified, to set a unique pad token and then EOS is masked

@Abhishek-TAMU Abhishek-TAMU merged commit 24f7e42 into foundation-model-stack:main Jan 9, 2025
11 checks passed
@Abhishek-TAMU Abhishek-TAMU deleted the fix_eos_equals_pad branch January 14, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants