mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-12-24 13:28:13 +08:00
This reverts commit 9da89a374b.
This commit is contained in:
@@ -119,9 +119,6 @@ environment_variables: dict[str, Callable[[], Any]] = {
|
||||
"FD_EP_BATCHED_TOKEN_TIMEOUT": lambda: float(os.getenv("FD_EP_BATCHED_TOKEN_TIMEOUT", "0.1")),
|
||||
# Max pre-fetch requests number in PD
|
||||
"FD_EP_MAX_PREFETCH_TASK_NUM": lambda: int(os.getenv("FD_EP_MAX_PREFETCH_TASK_NUM", "8")),
|
||||
# Max allocated KV cache blocks. Use this to limit how many KV cache blocks the engine is allowed to allocate.
|
||||
# Set to -1 (default) for no limit, or a positive integer to cap the maximum number of blocks that can be allocated.
|
||||
"FD_MAX_KVCACHE_BLOCKS": lambda: int(os.getenv("FD_MAX_KVCACHE_BLOCKS", "-1")),
|
||||
# Enable or disable model caching.
|
||||
# When enabled, the quantized model is stored as a cache for future inference to improve loading efficiency.
|
||||
"FD_ENABLE_MODEL_LOAD_CACHE": lambda: bool(int(os.getenv("FD_ENABLE_MODEL_LOAD_CACHE", "0"))),
|
||||
|
||||
@@ -21,7 +21,6 @@ import time
|
||||
import numpy as np
|
||||
import paddle
|
||||
|
||||
from fastdeploy import envs
|
||||
from fastdeploy.config import FDConfig
|
||||
from fastdeploy.inter_communicator import IPCSignal
|
||||
from fastdeploy.utils import get_logger, set_random_seed
|
||||
@@ -127,10 +126,11 @@ class IluvatarPaddleDisWorkerProc(PaddleDisWorkerProc):
|
||||
# 2. Calculate the appropriate number of blocks
|
||||
model_block_memory_used = self.worker.cal_theortical_kvcache()
|
||||
num_blocks_local = int(available_kv_cache_memory // model_block_memory_used)
|
||||
|
||||
if envs.FD_MAX_KVCACHE_BLOCKS > 0 and num_blocks_local > envs.FD_MAX_KVCACHE_BLOCKS:
|
||||
logger.info(f"------- Reset num_blocks_local {num_blocks_local} to {envs.FD_MAX_KVCACHE_BLOCKS}")
|
||||
num_blocks_local = envs.FD_MAX_KVCACHE_BLOCKS
|
||||
# NOTE(liuzichang): Too many block will lead to illegal memory access
|
||||
# We will develop dynamic limits in future.
|
||||
if num_blocks_local > 40000:
|
||||
logger.info(f"------- Reset num_blocks_local {num_blocks_local} to 40000")
|
||||
num_blocks_local = min(40000, num_blocks_local)
|
||||
logger.info(f"------- model_block_memory_used:{model_block_memory_used} --------")
|
||||
logger.info(f"------- num_blocks_local:{num_blocks_local} --------")
|
||||
|
||||
|
||||
@@ -530,9 +530,11 @@ class PaddleDisWorkerProc:
|
||||
# 2. Calculate the appropriate number of blocks
|
||||
model_block_memory_used = self.worker.cal_theortical_kvcache()
|
||||
num_blocks_local = int(available_kv_cache_memory // model_block_memory_used)
|
||||
if envs.FD_MAX_KVCACHE_BLOCKS > 0 and num_blocks_local > envs.FD_MAX_KVCACHE_BLOCKS:
|
||||
logger.info(f"------- Reset num_blocks_local {num_blocks_local} to {envs.FD_MAX_KVCACHE_BLOCKS}")
|
||||
num_blocks_local = envs.FD_MAX_KVCACHE_BLOCKS
|
||||
# NOTE(liuzichang): Too many block will lead to illegal memory access
|
||||
# We will develop dynamic limits in future.
|
||||
if num_blocks_local > 40000:
|
||||
logger.info(f"------- Reset num_blocks_local {num_blocks_local} to 40000")
|
||||
num_blocks_local = min(40000, num_blocks_local)
|
||||
logger.info(f"------- model_block_memory_used:{model_block_memory_used / 1024**3} GB --------")
|
||||
logger.info(f"------- num_blocks_local:{num_blocks_local} --------")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user