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 special token settings in PretrainiedTokenizer #2629

Merged
merged 2 commits into from
Jun 24, 2022

Conversation

guoshengCS
Copy link
Contributor

@guoshengCS guoshengCS commented Jun 23, 2022

PR types

Bug fixes

PR changes

Others

Description

Fix special token settings in PretrainiedTokenizer.

Resolve #2630

Additionally, by using _post_init to replace _wrap_init and add _pre_init, we can add Configuration and parse Configuration in _pre_init as arguments of PretrainedModel.__init__ to create models later.

@guoshengCS guoshengCS marked this pull request as ready for review June 23, 2022 12:26
@guoshengCS guoshengCS requested review from ZHUI and joey12300 June 23, 2022 12:28
Copy link
Collaborator

@ZHUI ZHUI left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -559,10 +559,24 @@ def _wrap_init(self, original_init, *args, **kwargs):
self._decode_use_source_tokenizer = False

def _build_special_tokens_map_extended(self, **kwargs):
if getattr(self, "_has_built_special_tokens", None):
return
SpecialTokensMixin.__init__(self, **kwargs)
Copy link
Collaborator

Choose a reason for hiding this comment

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

看得不是很明白,这里是去掉了 SpecialTokensMixin 的使用了吗?

@ZHUI ZHUI merged commit 14b4768 into PaddlePaddle:develop Jun 24, 2022
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.

Pad token value of gpt2-medium-en is not as expected
2 participants