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

Set pad_token_id to tokenizer.pad_token_id if not set on command line #118

Merged
merged 2 commits into from
May 16, 2023

Conversation

patrickhwood
Copy link
Contributor

The hf_chat.py program emits this warning message before each chat response:

The attention mask and the pad token id were not set. As a consequence, you may observe unexpected behavior. Please pass your input's attention_mask to obtain reliable results.
Setting pad_token_id to eos_token_id:0 for open-end generation.

Fixed by setting pad_token_id to tokenizer.eos_token_id if not set on the command line.

efii added 2 commits May 12, 2023 16:30
… of the

	The attention mask and the pad token id were not set. As a consequence, you may observe unexpected behavior. Please pass your input's `attention_mask` to obtain reliable results.
	Setting `pad_token_id` to `eos_token_id`:0 for open-end generation.

message that appears every time in the chat loop.

Tested in the mosaicml/pytorch docker container.
@patrickhwood patrickhwood changed the title Br1 Set pad_token_id to tokenizer.pad_token_id if not set on command line May 12, 2023
Copy link
Contributor

@alextrott16 alextrott16 left a comment

Choose a reason for hiding this comment

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

Thanks @patrickhwood!

@samhavens I'll defer approval to you because you know the script better, but the change here is what we do in hf_generate.py and it doesn't seem to cause any trouble.

@vchiley vchiley requested a review from samhavens May 15, 2023 16:28
Copy link
Contributor

@samhavens samhavens 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!

@samhavens samhavens merged commit b2450db into mosaicml:main May 16, 2023
6 checks passed
bmosaicml pushed a commit that referenced this pull request Jun 6, 2023
bmosaicml pushed a commit that referenced this pull request Jun 6, 2023
… of the (#118)

The attention mask and the pad token id were not set. As a consequence, you may observe unexpected behavior. Please pass your input's `attention_mask` to obtain reliable results.
	Setting `pad_token_id` to `eos_token_id`:0 for open-end generation.

message that appears every time in the chat loop.

Tested in the mosaicml/pytorch docker container.

Co-authored-by: Pat Wood <Pat.Wood@efi.com>
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.

None yet

4 participants