Simplify multi-tokenizer (#11295)

Signed-off-by: zhengkezhou1 <madzhou1@gmail.com>
Co-authored-by: Liangsheng Yin <lsyincs@gmail.com>
This commit is contained in:
Zhengke Zhou
2025-10-21 16:33:29 +08:00
committed by GitHub
co-authored by Liangsheng Yin
parent dbb16bedd5
commit 260fe755b6
10 changed files with 174 additions and 204 deletions
@@ -682,6 +682,7 @@ class SchedulerOutputProcessorMixin:
skip_req: Optional[Req] = None,
):
rids = []
http_worker_ipcs = []
finished_reasons: List[BaseFinishReason] = []
decoded_texts = []
@@ -770,6 +771,7 @@ class SchedulerOutputProcessorMixin:
req.send_output_token_logprobs_offset
)
rids.append(req.rid)
http_worker_ipcs.append(req.http_worker_ipc)
finished_reasons.append(
req.finished_reason.to_json() if req.finished_reason else None
)
@@ -886,7 +888,7 @@ class SchedulerOutputProcessorMixin:
if self.model_config.is_multimodal_gen:
return
self.send_to_detokenizer.send_pyobj(
self.send_to_detokenizer.send_output(
BatchTokenIDOutput(
finished_reasons,
decoded_texts,
@@ -916,6 +918,7 @@ class SchedulerOutputProcessorMixin:
output_token_entropy_val=None,
output_hidden_states=output_hidden_states,
rids=rids,
http_worker_ipcs=http_worker_ipcs,
placeholder_tokens_idx=None,
placeholder_tokens_val=None,
)
@@ -923,6 +926,7 @@ class SchedulerOutputProcessorMixin:
def stream_output_embedding(self: Scheduler, reqs: List[Req]):
rids = []
http_worker_ipcs = []
finished_reasons: List[BaseFinishReason] = []
embeddings = []
@@ -931,17 +935,19 @@ class SchedulerOutputProcessorMixin:
for req in reqs:
if req.finished():
rids.append(req.rid)
http_worker_ipcs.append(req.http_worker_ipc)
finished_reasons.append(req.finished_reason.to_json())
embeddings.append(req.embedding)
prompt_tokens.append(len(req.origin_input_ids))
cached_tokens.append(req.cached_tokens)
self.send_to_detokenizer.send_pyobj(
self.send_to_detokenizer.send_output(
BatchEmbeddingOutput(
finished_reasons,
embeddings,
prompt_tokens,
cached_tokens,
rids=rids,
http_worker_ipcs=http_worker_ipcs,
placeholder_tokens_idx=None,
placeholder_tokens_val=None,
)