Skip to content

Commit 03b8668

Browse files
committed
Use PREFILL_SLICES and DECODE_SLICES from envs.py in disagg_utils
Signed-off-by: Xing Liu <xingliu14@gmail.com>
1 parent ae576c0 commit 03b8668

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tpu_inference/core/disagg_utils.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import os
44
from typing import Tuple
55

6+
from tpu_inference import envs
7+
68
PREFILL_SLICES = 'PREFILL_SLICES'
79
DECODE_SLICES = 'DECODE_SLICES'
810

@@ -11,7 +13,7 @@ def is_disagg_enabled() -> bool:
1113
# We triggrer our code path as long as prefill slices are set. This
1214
# allows us to test interleave mode effectively with the code path
1315
# for comparison purposes.
14-
return PREFILL_SLICES in os.environ
16+
return bool(envs.PREFILL_SLICES)
1517

1618

1719
def _parse_slices(slices_str: str) -> Tuple[int, ...]:
@@ -40,12 +42,12 @@ def _parse_slices(slices_str: str) -> Tuple[int, ...]:
4042

4143

4244
def get_prefill_slices() -> Tuple[int, ...]:
43-
if PREFILL_SLICES not in os.environ:
45+
if not envs.PREFILL_SLICES:
4446
return ()
45-
return _parse_slices(os.environ[PREFILL_SLICES])
47+
return _parse_slices(envs.PREFILL_SLICES)
4648

4749

4850
def get_decode_slices() -> Tuple[int, ...]:
49-
if DECODE_SLICES not in os.environ:
51+
if not envs.DECODE_SLICES:
5052
return ()
51-
return _parse_slices(os.environ[DECODE_SLICES])
53+
return _parse_slices(envs.DECODE_SLICES)

0 commit comments

Comments
 (0)