Commit 92058666 authored by jujl1's avatar jujl1
Browse files

feat: pp 增加输出每个micro batch调度的请求数功能,VLLM_PP_DEBUG打开,默认关闭

parent 4c92e64a
...@@ -189,6 +189,7 @@ if TYPE_CHECKING: ...@@ -189,6 +189,7 @@ if TYPE_CHECKING:
VLLM_USE_FUSE_SILU_AND_MUL: bool = False VLLM_USE_FUSE_SILU_AND_MUL: bool = False
VLLM_USE_OPT_RESHAPE_AND_CACHE: bool = False VLLM_USE_OPT_RESHAPE_AND_CACHE: bool = False
VLLM_USE_TOPK_RENORM: bool = False VLLM_USE_TOPK_RENORM: bool = False
VLLM_PP_DEBUG: bool = False
def get_default_cache_root(): def get_default_cache_root():
return os.getenv( return os.getenv(
...@@ -1237,6 +1238,10 @@ environment_variables: dict[str, Callable[[], Any]] = { ...@@ -1237,6 +1238,10 @@ environment_variables: dict[str, Callable[[], Any]] = {
lambda: lambda:
(os.environ.get("VLLM_USE_TOPK_RENORM", "True").lower() in (os.environ.get("VLLM_USE_TOPK_RENORM", "True").lower() in
("true", "1")), ("true", "1")),
"VLLM_PP_DEBUG":
lambda:
(os.environ.get("VLLM_PP_DEBUG", "False").lower() in
("true", "1")),
} }
......
...@@ -275,6 +275,12 @@ class EngineCore: ...@@ -275,6 +275,12 @@ class EngineCore:
pass pass
scheduler_output = self.scheduler.schedule() scheduler_output = self.scheduler.schedule()
if scheduler_output.total_num_scheduled_tokens > 0: if scheduler_output.total_num_scheduled_tokens > 0:
if envs.VLLM_PP_DEBUG:
import sys,os
num_run_reqs = len(scheduler_output.scheduled_new_reqs) + scheduler_output.scheduled_cached_reqs.num_reqs
sys.stderr.write(f"[pid- {os.getpid()}]running requests in micro batch is:{num_run_reqs}, "
f"total_num_scheduled_tokens is {scheduler_output.total_num_scheduled_tokens}\n")
sys.stderr.flush()
future = self.model_executor.execute_model(scheduler_output) future = self.model_executor.execute_model(scheduler_output)
self.batch_queue.put_nowait( self.batch_queue.put_nowait(
(future, scheduler_output)) # type: ignore (future, scheduler_output)) # type: ignore
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment