From ed2a8082520ada5b575b77158437006e059dc8c3 Mon Sep 17 00:00:00 2001 From: Pr0Wh1teGivee Date: Thu, 4 Dec 2025 10:19:36 +0800 Subject: [PATCH] Update normalized_scorer.py Signed-off-by: Pr0Wh1teGivee Signed-off-by: weichen --- vllm/v1/core/sched/policy/normalized_scorer.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/vllm/v1/core/sched/policy/normalized_scorer.py b/vllm/v1/core/sched/policy/normalized_scorer.py index ff124dd5c8929..9460d7454085c 100644 --- a/vllm/v1/core/sched/policy/normalized_scorer.py +++ b/vllm/v1/core/sched/policy/normalized_scorer.py @@ -27,7 +27,8 @@ class ScoreDim: class NormalizedScorer: """ - Normalize unbounded N-dimensional values into a composite score using the Sigmoid function. + Normalize unbounded N-dimensional values into a composite score using the Sigmoid + function. """ def __init__(self, dim_list: list[ScoreDim]) -> None: @@ -48,7 +49,9 @@ class NormalizedScorer: @staticmethod def _inv_sigmoid_normalize(value, median, norm_scale): - """Inverse Sigmoid: Used for dimensions where a larger value yields a lower score.""" + """Inverse Sigmoid: Used for dimensions where a larger value yields a lower + score. + """ # Equivalent to sigmoid(-x), but more numerically stable. return 1 / (1 + math.exp(norm_scale * (value - median))) @@ -74,12 +77,7 @@ class NormalizedScorer: score = self._sigmoid_normalize( dim_value, dim_info.median, dim_info.norm_scale ) - logger.debug( - "%s(%s) : %.10f", - dim_info.name, - dim_info.reverse, - score - ) + logger.debug("%s(%s) : %.10f", dim_info.name, dim_info.reverse, score) # Weighted summation. final_score += score * dim_info.weight @@ -88,7 +86,8 @@ class NormalizedScorer: class TimeAndLengthScorer(NormalizedScorer): """ - Scorer for time and length dimensions; defaults to forward scoring with equal weights (0.5 each). + Scorer for time and length dimensions; defaults to forward scoring with equal + weights (0.5 each). """ def __init__(