mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-11 10:55:30 +08:00
[Misc] Convert use_structured_output property into constant (#23060)
Signed-off-by: Woosuk Kwon <woosuk.kwon@berkeley.edu>
This commit is contained in:
parent
c55bc1db26
commit
6d243efeda
@ -54,8 +54,7 @@ class Request:
|
|||||||
time.time()
|
time.time()
|
||||||
|
|
||||||
self.status = RequestStatus.WAITING
|
self.status = RequestStatus.WAITING
|
||||||
if sampling_params and sampling_params.guided_decoding is not None:
|
self.use_structured_output = False
|
||||||
self.status = RequestStatus.WAITING_FOR_FSM
|
|
||||||
self.events: list[EngineCoreEvent] = []
|
self.events: list[EngineCoreEvent] = []
|
||||||
self.stop_reason: Union[int, str, None] = None
|
self.stop_reason: Union[int, str, None] = None
|
||||||
|
|
||||||
@ -63,12 +62,15 @@ class Request:
|
|||||||
self.kv_transfer_params: Optional[dict[str, Any]] = None
|
self.kv_transfer_params: Optional[dict[str, Any]] = None
|
||||||
|
|
||||||
if pooling_params is not None:
|
if pooling_params is not None:
|
||||||
|
# Pooling models.
|
||||||
self.max_tokens = 1
|
self.max_tokens = 1
|
||||||
elif sampling_params is not None:
|
elif sampling_params is not None:
|
||||||
|
# Generative models.
|
||||||
assert sampling_params.max_tokens is not None
|
assert sampling_params.max_tokens is not None
|
||||||
self.max_tokens = sampling_params.max_tokens
|
self.max_tokens = sampling_params.max_tokens
|
||||||
if sampling_params.guided_decoding is not None:
|
if sampling_params.guided_decoding is not None:
|
||||||
self.status = RequestStatus.WAITING_FOR_FSM
|
self.status = RequestStatus.WAITING_FOR_FSM
|
||||||
|
self.use_structured_output = True
|
||||||
|
|
||||||
if sampling_params.extra_args is not None:
|
if sampling_params.extra_args is not None:
|
||||||
self.kv_transfer_params = \
|
self.kv_transfer_params = \
|
||||||
@ -192,11 +194,6 @@ class Request:
|
|||||||
num_tokens = self.mm_positions[input_id].length
|
num_tokens = self.mm_positions[input_id].length
|
||||||
return num_tokens
|
return num_tokens
|
||||||
|
|
||||||
@property
|
|
||||||
def use_structured_output(self) -> bool:
|
|
||||||
return self.sampling_params is not None and \
|
|
||||||
self.sampling_params.guided_decoding is not None
|
|
||||||
|
|
||||||
def record_event(
|
def record_event(
|
||||||
self,
|
self,
|
||||||
event_type: EngineCoreEventType,
|
event_type: EngineCoreEventType,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user