Skip to content

Commit 7730ee8

Browse files
committed
[CI] Add some compatibility code to pass CI
Signed-off-by: Csrayz <[email protected]>
1 parent 70fb9db commit 7730ee8

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

vllm_ascend/core/schedule_config.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@
2020

2121
from vllm.config import SchedulerConfig
2222

23+
MAX_INT = 2147483647
2324

2425
@dataclass
2526
class AscendSchedulerConfig(SchedulerConfig):
2627
enable_chunked_prefill: bool = False
27-
max_long_partial_prefills: Optional[Union[int, float]] = None
28-
long_prefill_token_threshold: Optional[Union[int, float]] = None
28+
max_long_partial_prefills: int = MAX_INT
29+
long_prefill_token_threshold: int = MAX_INT
2930
policy: str = "fcfs"
3031
num_scheduler_steps: int = 1
3132
scheduler_cls: Union[str, Type[object]] = (
@@ -71,20 +72,24 @@ def __post_init__(self) -> None:
7172
"decrease max_model_len.")
7273
# concurrent partial prefills. Default is inf
7374
if self.max_long_partial_prefills is None:
74-
self.max_long_partial_prefills = float('inf')
75-
self.long_prefill_token_threshold = float('inf')
76-
else:
77-
if self.long_prefill_token_threshold is None:
75+
self.max_long_partial_prefills = MAX_INT
76+
self.long_prefill_token_threshold = MAX_INT
77+
78+
if self.long_prefill_token_threshold is None or \
79+
self.long_prefill_token_threshold <= 0:
80+
if self.max_model_len is None:
81+
self.long_prefill_token_threshold = MAX_INT
82+
else:
7883
self.long_prefill_token_threshold = \
7984
max(1, int(self.max_model_len * 0.04))
8085

81-
if self.max_long_partial_prefills <= 0:
86+
if self.max_long_partial_prefills < 0:
8287
raise ValueError(
83-
f"max_long_partial_prefills must be positive, but got "
88+
f"max_long_partial_prefills must be non-negative, but got "
8489
f"{self.max_long_partial_prefills}")
85-
if self.long_prefill_token_threshold <= 0:
90+
if self.long_prefill_token_threshold < 0:
8691
raise ValueError(
87-
f"long_prefill_token_threshold must be positive, but got "
92+
f"long_prefill_token_threshold must be non-negative, but got "
8893
f"{self.long_prefill_token_threshold}")
8994

9095
if self.policy != "fcfs":

vllm_ascend/core/scheduler.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,12 @@ def schedule(self) -> SchedulerOutput:
8787

8888
# Skip long prompt requests in prefill stage.
8989
# long_prefill_budget is float('inf') if not use.
90-
long_prefill_budget = self.vllm_config.scheduler_config.max_long_partial_prefills
91-
long_prefill_token_threshold = self.vllm_config.scheduler_config.long_prefill_token_threshold
90+
if self.vllm_config.scheduler_config.long_prefill_token_threshold == 0:
91+
long_prefill_budget = float('inf')
92+
long_prefill_token_threshold = float('inf')
93+
else:
94+
long_prefill_budget = self.vllm_config.scheduler_config.max_long_partial_prefills
95+
long_prefill_token_threshold = self.vllm_config.scheduler_config.long_prefill_token_threshold
9296

9397
# Schedule prefill requests first.
9498
while self.waiting and token_budget > 0:

0 commit comments

Comments
 (0)