[Fix][Fish Speech] Remove redundant get_vocab() in control token encoding#2842
Merged
linyueqian merged 1 commit intoApr 16, 2026
Merged
Conversation
…ding tokenizer.get_vocab() rebuilds the full 155K-entry vocab dict on every call (~68ms on H20). _encode_control_token() called it 6 times per prompt, adding ~408ms of pure Python overhead to every Fish Speech TTS request. Replace with convert_tokens_to_ids() which does the same lookup in <1ms. Signed-off-by: Sy03 <1370724210@qq.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Collaborator
Blocking IssuesNone. VERDICT: COMMENT Clean performance optimization. The A/B benchmarking evidence in the PR description is solid. LGTM. (Note: This change is already covered by existing tests since it's an internal optimization with no API changes.) |
lvliang-intel
pushed a commit
to lvliang-intel/vllm-omni
that referenced
this pull request
Apr 20, 2026
…ding (vllm-project#2842) Signed-off-by: Sy03 <1370724210@qq.com>
lengrongfu
pushed a commit
to lengrongfu/vllm-omni
that referenced
this pull request
May 1, 2026
…ding (vllm-project#2842) Signed-off-by: Sy03 <1370724210@qq.com>
clodaghwalsh17
pushed a commit
to clodaghwalsh17/nm-vllm-omni-ent
that referenced
this pull request
May 12, 2026
…ding (vllm-project#2842) Signed-off-by: Sy03 <1370724210@qq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
_encode_control_token()inprompt_utils.pycalledtokenizer.get_vocab()on every invocation, which rebuilds the full 155K-entry vocabulary dictionary each time (~68ms on H20 GPU). Since this function is called 6 times per prompt (for<|im_start|>,<|im_end|>,<|voice|>), it adds ~408ms of pure Python overhead to every Fish Speech S2 Pro TTS request.Replace with
tokenizer.convert_tokens_to_ids()which performs the same single-token lookup in <1ms.Test Plan
enforce_eager=false, CUDA graph enabled), same model, same textTest Result
Setup:
enforce_eager=false(torch.compile + CUDA graph), text = "The quick brown fox jumps over the lazy dog." (~3s audio)Long text (~14s audio):
Root cause profiling:
build_promptdropped from ~400ms to ~1ms per request.cc @linyueqian @zwhzzz0821