Skip to content

[Tokenizer] Upgrade tokenizer#9683

Closed
DrownFish19 wants to merge 13 commits into
PaddlePaddle:developfrom
DrownFish19:dev_20241224_update_tokenize
Closed

[Tokenizer] Upgrade tokenizer#9683
DrownFish19 wants to merge 13 commits into
PaddlePaddle:developfrom
DrownFish19:dev_20241224_update_tokenize

Conversation

@DrownFish19

Copy link
Copy Markdown
Collaborator

PR types

Function optimization

PR changes

APIs

Description

update function tokenize() for Qwen2 and Llama.

@paddle-bot

paddle-bot Bot commented Dec 24, 2024

Copy link
Copy Markdown

Thanks for your contribution!

@DrownFish19 DrownFish19 changed the title update tokenize [Tokenizer] Update tokenize() for Qwen2 and Llama Dec 24, 2024
@DrownFish19 DrownFish19 changed the title [Tokenizer] Update tokenize() for Qwen2 and Llama [Tokenizer] Update tokenizer Jan 3, 2025
@DrownFish19 DrownFish19 changed the title [Tokenizer] Update tokenizer [Tokenizer] Upgrade tokenizer Jan 3, 2025
@github-actions

github-actions Bot commented Mar 8, 2025

Copy link
Copy Markdown

This Pull Request is stale because it has been open for 60 days with no activity. 当前Pull Request 60天内无活动,被标记为stale。

@github-actions github-actions Bot added the stale label Mar 8, 2025
@DrownFish19 DrownFish19 removed the stale label Mar 21, 2025
@ZHUI
ZHUI requested review from ZHUI and Copilot March 27, 2025 07:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates and optimizes the tokenization components for multiple models (RoBERTa, Llama, and Qwen2) and enhances testing and utility functions related to tokenizers. Key changes include:

  • Enhancements to fast tokenizer implementations with improved special tokens handling and legacy behavior management (notably for Llama and Qwen2).
  • Updates to dynamic tokenizer registration, local folder loading, and comprehensive tests for AutoTokenizer.
  • Minor updates to generated protobuf files and utility modules for consistency and deprecation warnings.

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.

Show a summary per file
File Description
paddlenlp/transformers/roberta/tokenizer_fast.py Adjusted special tokens processing and post-processing in the fast RoBERTa tokenizer.
tests/testing_utils.py & tests/transformers/auto/test_tokenizer.py Added new tests, decorators, and adjustments for dynamic and local-tokenizer cases.
paddlenlp/transformers/llama/tokenizer.py Revised legacy handling, special tokens building, and state serialization in the Llama tokenizer.
paddlenlp/transformers/qwen2/tokenizer.py Updated the tokenize() method to call tokenize_without_strip via the superclass.
paddlenlp/transformers/sentencepiece_model_pb2*.py Refreshed generated protobuf files and updated copyright notices.
paddlenlp/utils/import_utils.py & tokenizer_utils_base.py Minor improvements in utility functions and deprecation warning messages.
Comments suppressed due to low confidence (2)

paddlenlp/transformers/llama/tokenizer.py:301

  • The call to 'IdToPiece' uses an uppercase 'I', but the standard SentencePiece interface typically uses 'id_to_piece'. Please verify that this method name is correct to avoid token conversion issues.
token = self.sp_model.IdToPiece(index)

paddlenlp/transformers/tokenizer_utils_base.py:62

  • Ensure that the formatted PROTOBUF_IMPORT_ERROR provides clear and actionable instructions to the user, including any required steps to restart the runtime after installing protobuf.
raise ImportError(PROTOBUF_IMPORT_ERROR.format(error_message))

@github-actions

Copy link
Copy Markdown

This Pull Request is stale because it has been open for 60 days with no activity. 当前Pull Request 60天内无活动,被标记为stale。

@github-actions github-actions Bot added the stale label Jun 20, 2025
@paddle-bot paddle-bot Bot closed this Jun 23, 2026
@paddle-bot

paddle-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

Automatically closed by Paddle-bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants