Skip to content

Commit 4fdd1a8

Browse files
yuz207terragon-labs[bot]
andcommitted
refactor(gpu_model_runner): move _scv_enabled method to follow initialization code
The _scv_enabled method was relocated within the GPUModelRunner class to follow the initialization code block, improving code readability and organization without changing functionality. Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
1 parent 87a0206 commit 4fdd1a8

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

vllm/v1/worker/gpu_model_runner.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -512,16 +512,6 @@ def __init__(
512512
self._latest_nwor_window_metrics: dict[str, int | str] | None = None
513513
self._scv_mode = envs.VLLM_SCV_MODE.lower()
514514
self._scv_graph_executor: SCVGraphExecutor | None = None
515-
516-
def _scv_enabled(self) -> bool:
517-
if not hasattr(self, "_scv_mode"):
518-
self._scv_mode = envs.VLLM_SCV_MODE.lower()
519-
if self._scv_mode not in ("off", "graph", "adaptive"):
520-
logger.warning("SCV: unsupported mode '%s', disabling.", self._scv_mode)
521-
self._scv_mode = "off"
522-
return self._scv_mode != "off"
523-
524-
# Cached outputs.
525515
self._draft_token_ids: list[list[int]] | torch.Tensor | None = None
526516
self.transfer_event = torch.cuda.Event()
527517
self.sampled_token_ids_pinned_cpu = torch.empty(
@@ -531,6 +521,14 @@ def _scv_enabled(self) -> bool:
531521
pin_memory=self.pin_memory,
532522
)
533523

524+
def _scv_enabled(self) -> bool:
525+
if not hasattr(self, "_scv_mode"):
526+
self._scv_mode = envs.VLLM_SCV_MODE.lower()
527+
if self._scv_mode not in ("off", "graph", "adaptive"):
528+
logger.warning("SCV: unsupported mode '%s', disabling.", self._scv_mode)
529+
self._scv_mode = "off"
530+
return self._scv_mode != "off"
531+
534532
def reset_mm_cache(self) -> None:
535533
if self.mm_budget:
536534
self.mm_budget.reset_cache()

0 commit comments

Comments
 (0)