Skip to content

Commit 5d49100

Browse files
committed
pass precommit
Signed-off-by: Sungjae Lee <33976427+llsj14@users.noreply.github.com> Signed-off-by: Sungjae Lee <sung-jae.lee@navercorp.com>
1 parent 42a4581 commit 5d49100

File tree

1 file changed

+26
-24
lines changed

1 file changed

+26
-24
lines changed

vllm/v1/sample/logits_processor.py

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -513,10 +513,10 @@ def __init__(self, reasoning_config: ReasoningConfig, pin_memory: bool,
513513
"medium": 2048,
514514
"high": 8192,
515515
}
516-
self.think_start_token_ids = getattr(
517-
reasoning_config, "think_start_token_ids", [])
518-
self.think_end_token_ids = getattr(
519-
reasoning_config, "think_end_token_ids", [])
516+
self.think_start_token_ids = getattr(reasoning_config,
517+
"think_start_token_ids", [])
518+
self.think_end_token_ids = getattr(reasoning_config,
519+
"think_end_token_ids", [])
520520
self.reasoning_effort_to_token_budget['low'] = getattr(
521521
reasoning_config, "low_effort_token_budget",
522522
self.reasoning_effort_to_token_budget['low'])
@@ -532,8 +532,8 @@ def __init__(self, reasoning_config: ReasoningConfig, pin_memory: bool,
532532
self._state: dict[int, dict[str, Any]] = {}
533533

534534
@staticmethod
535-
def _find_last_sequence_index(
536-
target_list: list[int], token_ids: list[int]) -> int:
535+
def _find_last_sequence_index(target_list: list[int],
536+
token_ids: list[int]) -> int:
537537
"""
538538
Returns the index of the last occurrence of token_ids in target_list.
539539
@@ -550,8 +550,8 @@ def _find_last_sequence_index(
550550
return -1
551551

552552
def _resolve_thinking_token_budget(
553-
self, reasoning_effort: Optional[str],
554-
thinking_token_budget: Optional[int]) -> int:
553+
self, reasoning_effort: Optional[str],
554+
thinking_token_budget: Optional[int]) -> int:
555555
"""
556556
Determines the final thinking token budget.
557557
Priority:
@@ -562,30 +562,30 @@ def _resolve_thinking_token_budget(
562562
return thinking_token_budget
563563

564564
if reasoning_effort is not None:
565-
budget = self.reasoning_effort_to_token_budget.get(reasoning_effort)
565+
budget = self.reasoning_effort_to_token_budget.get(
566+
reasoning_effort)
566567
if budget is None:
567568
raise ValueError(
568569
f"Unknown reasoning_effort: {reasoning_effort}")
569570
return budget
570571

571572
return None
572573

573-
def _init_state_entry(
574-
self, prompt_tok_ids: list[int],
575-
thinking_token_budget: int) -> dict[str, Any]:
574+
def _init_state_entry(self, prompt_tok_ids: list[int],
575+
thinking_token_budget: int) -> dict[str, Any]:
576576
"""Initializes the tracking state for a given sequence index."""
577-
last_start = self._find_last_sequence_index(
578-
prompt_tok_ids, self.think_start_token_ids)
579-
last_end = self._find_last_sequence_index(
580-
prompt_tok_ids, self.think_end_token_ids)
577+
last_start = self._find_last_sequence_index(prompt_tok_ids,
578+
self.think_start_token_ids)
579+
last_end = self._find_last_sequence_index(prompt_tok_ids,
580+
self.think_end_token_ids)
581581
in_think = last_start > last_end
582582
think_count = len(prompt_tok_ids) - (last_start + 1) if in_think else 0
583583

584584
return {
585-
"in_think": in_think, # Currently in thinking mode
586-
"in_end": False, # Currently forcing end tokens
587-
"think_count": think_count, # Number of tokens in thinking section
588-
"end_count": 0, # Number of end tokens forced so far
585+
"in_think": in_think, # Currently in thinking mode
586+
"in_end": False, # Currently forcing end tokens
587+
"think_count": think_count, # Number of tokens in thinking section
588+
"end_count": 0, # Number of end tokens forced so far
589589
"prompt_tok_ids": prompt_tok_ids,
590590
"output_tok_ids": [],
591591
"thinking_token_budget": thinking_token_budget,
@@ -635,8 +635,8 @@ def update_state(self, batch_update: Optional[BatchUpdate]):
635635
reasoning_effort = (params.reasoning_effort if isinstance(
636636
params, SamplingParams) else None)
637637
thinking_token_budget = (params.thinking_token_budget
638-
if isinstance(
639-
params, SamplingParams) else None)
638+
if isinstance(params, SamplingParams)
639+
else None)
640640
resolved_thinking_token_budget = \
641641
self._resolve_thinking_token_budget(
642642
reasoning_effort, thinking_token_budget)
@@ -664,8 +664,10 @@ def apply(self, logits: torch.Tensor) -> torch.Tensor:
664664
return logits
665665

666666
mask = torch.zeros(batch_size, dtype=torch.bool, device=logits.device)
667-
force_token_ids = torch.full((batch_size,), -1,
668-
dtype=torch.long, device=logits.device)
667+
force_token_ids = torch.full((batch_size,),
668+
-1,
669+
dtype=torch.long,
670+
device=logits.device)
669671

670672
for i in range(batch_size):
671673
state = self._state.get(i)

0 commit comments

Comments
 (0)