[Reasoning + Structured Output] make reasoning compatible with structured output (#12551)
Signed-off-by: Xinyuan Tong <xinyuantong.cs@gmail.com> Co-authored-by: Xinyuan Tong <xinyuantong.cs@gmail.com>
This commit is contained in:
@@ -197,6 +197,9 @@ class GenerateReqInput(BaseReq):
|
||||
bootstrap_room: Optional[Union[List[int], int]] = None
|
||||
bootstrap_pair_key: Optional[Union[List[str], str]] = None
|
||||
|
||||
# For reasoning
|
||||
reasoning: bool = False
|
||||
|
||||
# Validation step duration
|
||||
validation_time: Optional[float] = None
|
||||
|
||||
@@ -675,6 +678,9 @@ class TokenizedGenerateReqInput(BaseReq):
|
||||
bootstrap_room: Optional[int] = None
|
||||
bootstrap_pair_key: Optional[str] = None
|
||||
|
||||
# For reasoning
|
||||
reasoning: bool = False
|
||||
|
||||
# For data parallel rank routing
|
||||
data_parallel_rank: Optional[int] = None
|
||||
|
||||
|
||||
@@ -472,6 +472,7 @@ class Req:
|
||||
token_type_ids: List[int] = None,
|
||||
session_id: Optional[str] = None,
|
||||
custom_logit_processor: Optional[str] = None,
|
||||
reasoning: bool = False,
|
||||
return_hidden_states: bool = False,
|
||||
eos_token_ids: Optional[Set[int]] = None,
|
||||
bootstrap_host: Optional[str] = None,
|
||||
@@ -517,6 +518,9 @@ class Req:
|
||||
# For multi-http worker
|
||||
self.http_worker_ipc = http_worker_ipc
|
||||
|
||||
# For reasoning
|
||||
self.reasoning = reasoning
|
||||
|
||||
# Sampling info
|
||||
if isinstance(sampling_params.custom_params, dict):
|
||||
sampling_params = copy.copy(sampling_params)
|
||||
|
||||
@@ -1304,6 +1304,7 @@ class Scheduler(
|
||||
lora_id=recv_req.lora_id,
|
||||
input_embeds=recv_req.input_embeds,
|
||||
custom_logit_processor=recv_req.custom_logit_processor,
|
||||
reasoning=recv_req.reasoning,
|
||||
return_hidden_states=recv_req.return_hidden_states,
|
||||
eos_token_ids=self.model_config.hf_eos_token_id,
|
||||
bootstrap_host=recv_req.bootstrap_host,
|
||||
@@ -1431,7 +1432,9 @@ class Scheduler(
|
||||
elif req.sampling_params.structural_tag:
|
||||
key = ("structural_tag", req.sampling_params.structural_tag)
|
||||
|
||||
value, cache_hit = self.grammar_backend.get_cached_or_future_value(key)
|
||||
value, cache_hit = self.grammar_backend.get_cached_or_future_value(
|
||||
key, req.reasoning
|
||||
)
|
||||
req.grammar = value
|
||||
|
||||
if not cache_hit:
|
||||
|
||||
@@ -887,6 +887,7 @@ class TokenizerManager(TokenizerCommunicatorMixin):
|
||||
input_embeds=input_embeds,
|
||||
session_params=session_params,
|
||||
custom_logit_processor=obj.custom_logit_processor,
|
||||
reasoning=obj.reasoning,
|
||||
return_hidden_states=obj.return_hidden_states,
|
||||
data_parallel_rank=obj.data_parallel_rank,
|
||||
priority=obj.priority,
|
||||
|
||||
Reference in New Issue
Block a user