[refactor] Update reasoning parameter to require_reasoning (#14922)
Signed-off-by: Xinyuan Tong <xinyuantong.cs@gmail.com>
This commit is contained in:
@@ -155,7 +155,7 @@ class BaseGrammarBackend:
|
||||
return self._not_supported("structural_tag", key_string)
|
||||
|
||||
def _init_value_dispatch(
|
||||
self, key: Tuple[str, str], reasoning: bool
|
||||
self, key: Tuple[str, str], require_reasoning: bool
|
||||
) -> Optional[BaseGrammarObject]:
|
||||
s = time.perf_counter()
|
||||
key_type, key_string = key
|
||||
@@ -179,14 +179,14 @@ class BaseGrammarBackend:
|
||||
return grammar
|
||||
|
||||
def get_cached_or_future_value(
|
||||
self, key: Tuple[str, str], reasoning: bool
|
||||
self, key: Tuple[str, str], require_reasoning: bool
|
||||
) -> Optional[BaseGrammarObject]:
|
||||
value = self.cache.get(key)
|
||||
if value:
|
||||
copied_value = value.copy()
|
||||
copied_value.maybe_init_reasoning(reasoning)
|
||||
copied_value.maybe_init_reasoning(require_reasoning)
|
||||
return copied_value, True
|
||||
value = self.executor.submit(self._init_value_dispatch, key, reasoning)
|
||||
value = self.executor.submit(self._init_value_dispatch, key, require_reasoning)
|
||||
return value, False
|
||||
|
||||
def set_cache(self, key: Tuple[str, str], value: BaseGrammarObject):
|
||||
|
||||
@@ -214,7 +214,7 @@ class OpenAIServingChat(OpenAIServingBase):
|
||||
return_hidden_states=request.return_hidden_states,
|
||||
rid=request.rid,
|
||||
extra_key=self._compute_extra_key(request),
|
||||
reasoning=self._get_reasoning_from_request(request),
|
||||
require_reasoning=self._get_reasoning_from_request(request),
|
||||
priority=request.priority,
|
||||
custom_labels=custom_labels,
|
||||
custom_logit_processor=request.custom_logit_processor,
|
||||
|
||||
@@ -215,8 +215,8 @@ class GenerateReqInput(BaseReq, APIServingTimingMixin):
|
||||
bootstrap_pair_key: Optional[Union[List[str], str]] = None
|
||||
decode_tp_size: Optional[Union[List[Optional[int]], int]] = None
|
||||
|
||||
# For reasoning
|
||||
reasoning: bool = False
|
||||
# Require reasoning for the request (hybrid reasoning model only)
|
||||
require_reasoning: bool = False
|
||||
|
||||
# For data parallel rank routing
|
||||
data_parallel_rank: Optional[int] = None
|
||||
@@ -700,8 +700,8 @@ class TokenizedGenerateReqInput(BaseReq):
|
||||
bootstrap_pair_key: Optional[str] = None
|
||||
decode_tp_size: Optional[int] = None
|
||||
|
||||
# For reasoning
|
||||
reasoning: bool = False
|
||||
# Require reasoning for the request (hybrid reasoning model only)
|
||||
require_reasoning: bool = False
|
||||
|
||||
# For data parallel rank routing
|
||||
data_parallel_rank: Optional[int] = None
|
||||
|
||||
@@ -472,7 +472,7 @@ class Req:
|
||||
token_type_ids: List[int] = None,
|
||||
session_id: Optional[str] = None,
|
||||
custom_logit_processor: Optional[str] = None,
|
||||
reasoning: bool = False,
|
||||
require_reasoning: bool = False,
|
||||
return_hidden_states: bool = False,
|
||||
eos_token_ids: Optional[Set[int]] = None,
|
||||
bootstrap_host: Optional[str] = None,
|
||||
@@ -518,8 +518,8 @@ class Req:
|
||||
# For multi-http worker
|
||||
self.http_worker_ipc = http_worker_ipc
|
||||
|
||||
# For reasoning
|
||||
self.reasoning = reasoning
|
||||
# Require reasoning for the request (hybrid reasoning model only)
|
||||
self.require_reasoning = require_reasoning
|
||||
|
||||
# Sampling info
|
||||
if isinstance(sampling_params.custom_params, dict):
|
||||
|
||||
@@ -1314,7 +1314,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,
|
||||
require_reasoning=recv_req.require_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,
|
||||
@@ -1443,7 +1443,7 @@ class Scheduler(
|
||||
key = ("structural_tag", req.sampling_params.structural_tag)
|
||||
|
||||
value, cache_hit = self.grammar_backend.get_cached_or_future_value(
|
||||
key, req.reasoning
|
||||
key, req.require_reasoning
|
||||
)
|
||||
req.grammar = value
|
||||
|
||||
|
||||
@@ -796,7 +796,7 @@ class TokenizerManager(TokenizerCommunicatorMixin, TokenizerManagerMultiItemMixi
|
||||
input_embeds=input_embeds,
|
||||
session_params=session_params,
|
||||
custom_logit_processor=obj.custom_logit_processor,
|
||||
reasoning=obj.reasoning,
|
||||
require_reasoning=obj.require_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