[Bug] Fix torch dynamo warning Dynamo detected a call to a functools.lru_cache (#29038)
Signed-off-by: yewentao256 <zhyanwentao@126.com>
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
import os
|
||||
from collections.abc import Callable
|
||||
from functools import cache
|
||||
from typing import Any
|
||||
|
||||
import torch
|
||||
@@ -785,16 +784,19 @@ def enable_batch_invariant_mode():
|
||||
torch.backends.cuda.preferred_blas_library(backend="cublaslt")
|
||||
|
||||
|
||||
@cache
|
||||
def vllm_is_batch_invariant():
|
||||
env_key = "VLLM_BATCH_INVARIANT"
|
||||
is_overridden = False
|
||||
val = os.getenv(env_key, "0")
|
||||
def _read_vllm_batch_invariant() -> bool:
|
||||
val = os.getenv("VLLM_BATCH_INVARIANT", "0")
|
||||
try:
|
||||
is_overridden = int(val) != 0
|
||||
return int(val) != 0
|
||||
except ValueError:
|
||||
is_overridden = False
|
||||
return is_overridden
|
||||
return False
|
||||
|
||||
|
||||
VLLM_BATCH_INVARIANT: bool = _read_vllm_batch_invariant()
|
||||
|
||||
|
||||
def vllm_is_batch_invariant() -> bool:
|
||||
return VLLM_BATCH_INVARIANT
|
||||
|
||||
|
||||
def override_envs_for_invariance():
|
||||
|
||||
Reference in New Issue
Block a user