[Core] Adding token ranks along with logprobs (#3516)

Co-authored-by: Swapnil Parekh <swapnilp@ibm.com>
This commit is contained in:
Swapnil Parekh
2024-03-25 13:13:10 -04:00
committed by GitHub
parent 01bfb22b41
commit 819924e749
3 changed files with 98 additions and 12 deletions

View File

@@ -16,8 +16,15 @@ if TYPE_CHECKING:
@dataclass
class Logprob:
"""Infos for supporting OpenAI compatible logprobs."""
"""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
@@ -66,7 +73,7 @@ class SequenceStatus(enum.Enum):
class RequestMetrics:
"""Metrics associated with a request.
Args:
Attributes:
arrival_time: The time when the request arrived.
first_scheduled_time: The time when the request was first scheduled.
first_token_time: The time when the first token was generated.