Convert formatting to use ruff instead of yapf + isort (#26247)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
@@ -4,10 +4,12 @@ from collections.abc import Iterator
|
||||
from itertools import chain
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
|
||||
from vllm.v1.sample.logits_processor.interface import (AddedRequest,
|
||||
BatchUpdate,
|
||||
MovedRequest,
|
||||
RemovedRequest)
|
||||
from vllm.v1.sample.logits_processor.interface import (
|
||||
AddedRequest,
|
||||
BatchUpdate,
|
||||
MovedRequest,
|
||||
RemovedRequest,
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from vllm.v1.sample.logits_processor.interface import LogitsProcessor
|
||||
@@ -81,8 +83,9 @@ class BatchUpdateBuilder:
|
||||
index: request index
|
||||
"""
|
||||
if self._is_removed_sorted:
|
||||
raise RuntimeError("Cannot register new removed request after"
|
||||
" self.removed has been read.")
|
||||
raise RuntimeError(
|
||||
"Cannot register new removed request after self.removed has been read."
|
||||
)
|
||||
self._removed.append(index)
|
||||
self.batch_changed = True
|
||||
|
||||
@@ -116,7 +119,7 @@ class BatchUpdateBuilder:
|
||||
def get_and_reset(self, batch_size: int) -> Optional[BatchUpdate]:
|
||||
"""Generate a logitsprocs batch update data structure and reset
|
||||
internal batch update builder state.
|
||||
|
||||
|
||||
Args:
|
||||
batch_size: current persistent batch size
|
||||
|
||||
@@ -146,14 +149,17 @@ class LogitsProcessors:
|
||||
"""Encapsulates initialized logitsproc objects."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
logitsprocs: Optional[Iterator["LogitsProcessor"]] = None) -> None:
|
||||
self, logitsprocs: Optional[Iterator["LogitsProcessor"]] = None
|
||||
) -> None:
|
||||
self.argmax_invariant: list[LogitsProcessor] = []
|
||||
self.non_argmax_invariant: list[LogitsProcessor] = []
|
||||
if logitsprocs:
|
||||
for logitproc in logitsprocs:
|
||||
(self.argmax_invariant if logitproc.is_argmax_invariant() else
|
||||
self.non_argmax_invariant).append(logitproc)
|
||||
(
|
||||
self.argmax_invariant
|
||||
if logitproc.is_argmax_invariant()
|
||||
else self.non_argmax_invariant
|
||||
).append(logitproc)
|
||||
|
||||
@property
|
||||
def all(self) -> Iterator["LogitsProcessor"]:
|
||||
|
||||
Reference in New Issue
Block a user