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

Simplify EOS token handling in tokenize function #12866

Closed
wants to merge 1 commit into from

Conversation

DreadPirate09
Copy link
Contributor

Let the tokenizer handle EOS token

Let the tokenizer handle EOS token
@DreadPirate09
Copy link
Contributor Author

@Oscilloscope98 can you review this ? Thanks!

@glorysdj glorysdj requested a review from Uxito-Ada February 21, 2025 08:54
):
result["input_ids"].append(tokenizer.eos_token_id)
result["attention_mask"].append(1)
add_special_tokens=add_eos_token,
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @DreadPirate09 ,

Thanks for your contribution. The code previously manually appends EOS token because add_special_token=True will add both a BOS and EOS at the beginning and end respectively, as illustrated here. Therefore, I think add_special_token does not exactly match add_eos_token's semantics.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok ... I understand now

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