-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Revert "[PERF] Use faster way of decode in tokenizer: avoid useless list-to-list conversion (#20000)" #23396
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
Conversation
…ist-to-list conversion (vllm-project#20000)" This reverts commit 58eee5f. Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request reverts a previous performance optimization in the decode_tokens function. The change is simple and reverts the code to a previous state. I have one suggestion to refactor the updated function to improve consistency with other utility functions in the same file, which will aid future maintainability.
| if skip_special_tokens is not None: | ||
| return decode_method(token_ids, | ||
| skip_special_tokens=skip_special_tokens) | ||
| return tokenizer.decode(token_ids, | ||
| skip_special_tokens=skip_special_tokens) | ||
|
|
||
| return decode_method(token_ids) | ||
| return tokenizer.decode(token_ids) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For better consistency with the encode_tokens function that follows, consider refactoring this to use a kwargs dictionary. This approach makes the function's structure similar to its counterpart, improving the overall maintainability and readability of the file.
| if skip_special_tokens is not None: | |
| return decode_method(token_ids, | |
| skip_special_tokens=skip_special_tokens) | |
| return tokenizer.decode(token_ids, | |
| skip_special_tokens=skip_special_tokens) | |
| return decode_method(token_ids) | |
| return tokenizer.decode(token_ids) | |
| kwargs = {} | |
| if skip_special_tokens is not None: | |
| kwargs["skip_special_tokens"] = skip_special_tokens | |
| return tokenizer.decode(token_ids, **kwargs) |
22quinn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…ist-to-list conversion (vllm-project#20000)" (vllm-project#23396) Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
…ist-to-list conversion (vllm-project#20000)" (vllm-project#23396) Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk> Signed-off-by: Xiao Yu <xiao.yu@amd.com>
…ist-to-list conversion (vllm-project#20000)" (vllm-project#23396) Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
…ist-to-list conversion (vllm-project#20000)" (vllm-project#23396) Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
…ist-to-list conversion (vllm-project#20000)" (vllm-project#23396) Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
…ist-to-list conversion (vllm-project#20000)" (vllm-project#23396) Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk> Signed-off-by: Ekagra Ranjan <3116519+ekagra-ranjan@users.noreply.github.com>
…ist-to-list conversion (vllm-project#20000)" (vllm-project#23396) Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
This reverts commit 58eee5f.
Purpose
See #20000 (comment), this optimization is not necessary anymore
Test Plan
Test Result
(Optional) Documentation Update
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.