mirror of
https://github.com/deepseek-ai/DeepInfer.git
synced 2026-10-29 07:17:08 +08:00
14 lines
524 B
Python
14 lines
524 B
Python
"""文本段处理:引擎请求的文本段只携带长度(TextLengthInput),token 本体在 engine 侧。"""
|
||
|
||
from __future__ import annotations
|
||
|
||
import torch
|
||
|
||
from deepinfer.ve.processor.common import BaseProcessor, TextLengthInput
|
||
|
||
|
||
class TextTokenProcessor(BaseProcessor):
|
||
def process(self, text_input: TextLengthInput) -> dict:
|
||
# 只按长度产出 mm_token_type 缺省值(UNDEFINED=0),不产生 token 内容
|
||
return dict(mm_token_type=torch.zeros(text_input.length, dtype=torch.int32))
|