Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7d4d6cc

Browse files
authored
[TRTLLM-7292][feat] Support multi-threaded tokenizers for trtllm-serve (cherry-pick) (#7776)
Signed-off-by: Yilin Fan <206948969+nv-yilinf@users.noreply.github.com>
1 parent1f2761e commit7d4d6cc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

‎tensorrt_llm/serve/openai_server.py‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
fromtensorrt_llm.executorimportCppExecutorError
2424
fromtensorrt_llm.executor.postproc_workerimportPostprocParams
2525
fromtensorrt_llm.inputsimportprompt_inputs
26+
fromtensorrt_llm.inputs.dataimportTokensPrompt
2627
fromtensorrt_llm.inputs.utilsimportConversationMessage,apply_chat_template
2728
fromtensorrt_llm.llmapiimportDisaggregatedParamsasLlmDisaggregatedParams
2829
fromtensorrt_llm.llmapiimportMultimodalEncoder
@@ -677,8 +678,16 @@ async def generator_wrapper(generator: AsyncIterator[Any]):
677678
ifrequest.streamelsecompletion_response_post_processor,
678679
postproc_args=postproc_args,
679680
)
681+
682+
prompt=prompt_inputs(prompt)
683+
ifprompt.get("prompt")isnotNone:
684+
prompt_token_ids,extra_processed_inputs=awaitasyncio.to_thread(self.llm.input_processor,prompt,sampling_params)
685+
tokens_prompt=TokensPrompt(prompt_token_ids=prompt_token_ids,query_token_ids=extra_processed_inputs.get("query_token_ids")ifextra_processed_inputsisnotNoneelseNone)
686+
else:
687+
tokens_prompt=prompt
688+
680689
promise=self.llm.generate_async(
681-
inputs=prompt,
690+
inputs=tokens_prompt,
682691
sampling_params=sampling_params,
683692
_postproc_params=postproc_params,
684693
streaming=request.stream,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp