42 lines
1.8 KiB
Python
42 lines
1.8 KiB
Python
################################################################################
|
|
# Copyright(c)2020-2025 Shanghai Biren Technology Co., Ltd. All rights reserved.
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
#
|
|
################################################################################
|
|
|
|
from typing import Optional
|
|
|
|
import torch
|
|
from fastcore.basics import patch_to
|
|
|
|
from vllm.v1.outputs import (DraftTokenIds, KVConnectorOutput, LogprobsLists,
|
|
LogprobsTensors, ModelRunnerOutput)
|
|
|
|
|
|
@patch_to(ModelRunnerOutput)
|
|
def __init__(self,
|
|
req_ids: list[str],
|
|
req_id_to_index: dict[str, int],
|
|
sampled_token_ids: list[list[int]],
|
|
logprobs: Optional[LogprobsLists],
|
|
prompt_logprobs_dict: dict[str, Optional[LogprobsTensors]],
|
|
pooler_output: list[Optional[torch.Tensor]],
|
|
kv_connector_output: Optional[KVConnectorOutput] = None,
|
|
num_nans_in_logits: Optional[dict[str, int]] = None,
|
|
draft_token_ids: Optional["DraftTokenIds"] = None):
|
|
self._orig___init__(req_ids, req_id_to_index, sampled_token_ids, logprobs,
|
|
prompt_logprobs_dict, pooler_output,
|
|
kv_connector_output, num_nans_in_logits)
|
|
|
|
self.draft_token_ids = draft_token_ids
|