Skip to content

Commit 07ca70a

Browse files
authored
[Core][Easy] Use envs.__getattr__ for all Unify to environment variable access (#26810)
Signed-off-by: Jialin Ouyang <Jialin.Ouyang@gmail.com>
1 parent 2dcd12d commit 07ca70a

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

vllm/multimodal/cache.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
import torch
1111
from typing_extensions import override
1212

13+
import vllm.envs as envs
1314
from vllm.distributed.device_communicators.shm_object_storage import (
1415
MsgpackSerde,
1516
SingleWriterShmObjectStorage,
1617
SingleWriterShmRingBuffer,
1718
)
18-
from vllm.envs import VLLM_OBJECT_STORAGE_SHM_BUFFER_NAME
1919
from vllm.logger import init_logger
2020
from vllm.utils import GiB_bytes, MiB_bytes
2121
from vllm.utils.cache import CacheInfo, LRUCache
@@ -436,7 +436,7 @@ def __init__(self, vllm_config: "VllmConfig") -> None:
436436

437437
ring_buffer = SingleWriterShmRingBuffer(
438438
data_buffer_size=int(mm_config.mm_processor_cache_gb * GiB_bytes),
439-
name=VLLM_OBJECT_STORAGE_SHM_BUFFER_NAME,
439+
name=envs.VLLM_OBJECT_STORAGE_SHM_BUFFER_NAME,
440440
create=True, # sender is the writer
441441
)
442442
self._shm_cache = SingleWriterShmObjectStorage(
@@ -678,7 +678,7 @@ def __init__(
678678

679679
ring_buffer = SingleWriterShmRingBuffer(
680680
data_buffer_size=int(mm_config.mm_processor_cache_gb * GiB_bytes),
681-
name=VLLM_OBJECT_STORAGE_SHM_BUFFER_NAME,
681+
name=envs.VLLM_OBJECT_STORAGE_SHM_BUFFER_NAME,
682682
create=False, # Server is a reader
683683
)
684684
self._shm_cache = SingleWriterShmObjectStorage(

vllm/transformers_utils/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from pathlib import Path
99
from typing import Any
1010

11-
from vllm.envs import VLLM_MODEL_REDIRECT_PATH
11+
import vllm.envs as envs
1212
from vllm.logger import init_logger
1313

1414
logger = init_logger(__name__)
@@ -86,7 +86,7 @@ def maybe_model_redirect(model: str) -> str:
8686
:return: maybe redirect to a local folder
8787
"""
8888

89-
model_redirect_path = VLLM_MODEL_REDIRECT_PATH
89+
model_redirect_path = envs.VLLM_MODEL_REDIRECT_PATH
9090

9191
if not model_redirect_path:
9292
return model

vllm/utils/gc_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from contextlib import suppress
88
from typing import Any
99

10-
from vllm.envs import VLLM_GC_DEBUG
10+
import vllm.envs as envs
1111
from vllm.logger import init_logger
1212

1313
logger = init_logger(__name__)
@@ -36,7 +36,7 @@ def __init__(self, gc_debug_conf: str | None = None) -> None:
3636
self.top_objects = json_conf.get("top_objects", -1)
3737
except Exception:
3838
self.enabled = False
39-
logger.error("Failed to parse VLLM_GC_DEBUG(%s)", VLLM_GC_DEBUG)
39+
logger.error("Failed to parse VLLM_GC_DEBUG(%s)", envs.VLLM_GC_DEBUG)
4040
logger.info("GC Debug Config. %s", str(self))
4141

4242
def __repr__(self) -> str:
@@ -93,7 +93,7 @@ def maybe_attach_gc_debug_callback() -> None:
9393
"""
9494
Attached a callback for GC debug when VLLM_GC_DEBUG is enabled.
9595
"""
96-
config = GCDebugConfig(VLLM_GC_DEBUG)
96+
config = GCDebugConfig(envs.VLLM_GC_DEBUG)
9797
if config.enabled:
9898
debugger: GCDebugger = GCDebugger(config)
9999

vllm/v1/engine/async_llm.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from vllm.engine.arg_utils import AsyncEngineArgs
1717
from vllm.engine.protocol import EngineClient
1818
from vllm.entrypoints.utils import _validate_truncation_size
19-
from vllm.envs import VLLM_V1_OUTPUT_PROC_CHUNK_SIZE
2019
from vllm.inputs import PromptType
2120
from vllm.logger import init_logger
2221
from vllm.lora.request import LoRARequest
@@ -483,12 +482,12 @@ async def output_handler():
483482
# Split outputs into chunks of at most
484483
# VLLM_V1_OUTPUT_PROC_CHUNK_SIZE, so that we don't block the
485484
# event loop for too long.
486-
if num_outputs <= VLLM_V1_OUTPUT_PROC_CHUNK_SIZE:
485+
if num_outputs <= envs.VLLM_V1_OUTPUT_PROC_CHUNK_SIZE:
487486
slices = (outputs.outputs,)
488487
else:
489488
slices = np.array_split(
490489
outputs.outputs,
491-
cdiv(num_outputs, VLLM_V1_OUTPUT_PROC_CHUNK_SIZE),
490+
cdiv(num_outputs, envs.VLLM_V1_OUTPUT_PROC_CHUNK_SIZE),
492491
)
493492

494493
for i, outputs_slice in enumerate(slices):

0 commit comments

Comments
 (0)