[Chore][V0 Deprecation] Move LogProb to a separate file (#24055)
Signed-off-by: Woosuk Kwon <woosuk.kwon@berkeley.edu>
This commit is contained in:
+1
-24
@@ -16,6 +16,7 @@ import msgspec
|
||||
import torch
|
||||
|
||||
from vllm.inputs import SingletonInputs
|
||||
from vllm.logprobs import Logprob, PromptLogprobs, SampleLogprobs
|
||||
from vllm.multimodal import MultiModalKwargs, MultiModalPlaceholderDict
|
||||
from vllm.pooling_params import PoolingParams
|
||||
from vllm.sampling_params import RequestOutputKind, SamplingParams
|
||||
@@ -38,30 +39,6 @@ def array_full(token_id: int, count: int):
|
||||
return array(VLLM_TOKEN_ID_ARRAY_TYPE, [token_id]) * count
|
||||
|
||||
|
||||
# We use dataclass for now because it is used for
|
||||
# openai server output, and msgspec is not serializable.
|
||||
# TODO(sang): Fix it.
|
||||
@dataclass
|
||||
class Logprob:
|
||||
"""Infos for supporting OpenAI compatible logprobs and token ranks.
|
||||
|
||||
Attributes:
|
||||
logprob: The logprob of chosen token
|
||||
rank: The vocab rank of chosen token (>=1)
|
||||
decoded_token: The decoded chosen token index
|
||||
"""
|
||||
logprob: float
|
||||
rank: Optional[int] = None
|
||||
decoded_token: Optional[str] = None
|
||||
|
||||
|
||||
# {token_id -> logprob} per each sequence group. None if the corresponding
|
||||
# sequence group doesn't require prompt logprob.
|
||||
PromptLogprobs = list[Optional[dict[int, Logprob]]]
|
||||
# {token_id -> logprob} for each sequence group.
|
||||
SampleLogprobs = list[dict[int, Logprob]]
|
||||
|
||||
|
||||
class SequenceStatus(enum.IntEnum):
|
||||
"""Status of a sequence."""
|
||||
WAITING = 0
|
||||
|
||||
Reference in New Issue
Block a user