Skip to content

[Tokenizer] Support adding special tokens to Qwen tokenizer#9344

Merged
ZHUI merged 4 commits into
PaddlePaddle:developfrom
DrownFish19:dev_20241031_fix_qwen_tokenizer
Nov 1, 2024
Merged

[Tokenizer] Support adding special tokens to Qwen tokenizer#9344
ZHUI merged 4 commits into
PaddlePaddle:developfrom
DrownFish19:dev_20241031_fix_qwen_tokenizer

Conversation

@DrownFish19
Copy link
Copy Markdown
Collaborator

PR types

New features

PR changes

APIs

Description

Support adding special tokens to Qwen tokenizer.

Note: Qwen tokenizer does not support adding normal tokens.

example:

from paddlenlp.transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("qwen/qwen-7b")

tokenizer.add_special_tokens({"cls_token": "<CLS>"})

tokenizer.add_special_tokens({"additional_special_tokens":["<img>"]})

@paddle-bot
Copy link
Copy Markdown

paddle-bot Bot commented Oct 31, 2024

Thanks for your contribution!

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 31, 2024

Codecov Report

Attention: Patch coverage is 70.58824% with 5 lines in your changes missing coverage. Please review.

Project coverage is 52.89%. Comparing base (483fff4) to head (f99fe98).
Report is 3 commits behind head on develop.

Current head f99fe98 differs from pull request most recent head 0ea84ca

Please upload reports for the commit 0ea84ca to get more accurate results.

Files with missing lines Patch % Lines
paddlenlp/transformers/qwen/tokenizer.py 70.58% 5 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9344      +/-   ##
===========================================
- Coverage    52.91%   52.89%   -0.03%     
===========================================
  Files          673      673              
  Lines       107742   107711      -31     
===========================================
- Hits         57009    56970      -39     
- Misses       50733    50741       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Contributor

@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

@ZHUI ZHUI merged commit 71dafa6 into PaddlePaddle:develop Nov 1, 2024
@DrownFish19 DrownFish19 deleted the dev_20241031_fix_qwen_tokenizer branch November 1, 2024 06:37
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