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

Add template postprocess module for faster_tokenizer #2516

Merged
merged 8 commits into from
Jun 14, 2022

Conversation

joey12300
Copy link
Contributor

@joey12300 joey12300 commented Jun 14, 2022

PR types

New features

PR changes

Models

Description

Add template postprocessor for faster_tokenizer

Usage

# define a postprocessor 
tokenizer.postprocessor = postprocessors.TemplatePostProcessor(
    single=f"{cls_token}:0 $A:0 {sep_token}:0",
    pair=f"{cls_token}:0 $A:0 {sep_token}:0 $B:1 {sep_token}:1",
    special_tokens=[
        (cls_token, cls_token_id),
        (sep_token, sep_token_id),
    ],
)

@joey12300 joey12300 changed the title Add template postprocess Add template postprocess module for faster_tokenizer Jun 14, 2022
@ZeyuChen ZeyuChen self-assigned this Jun 14, 2022
@ZeyuChen ZeyuChen self-requested a review June 14, 2022 15:04
@ZeyuChen ZeyuChen added the faster Make training or inference faster label Jun 14, 2022
@ZeyuChen ZeyuChen merged commit 6ccc0be into PaddlePaddle:develop Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
faster Make training or inference faster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants