[Observability] add model initializing duration log (#52141)

Signed-off-by: Andy Xie <andy.xning@gmail.com>
This commit is contained in:
Ning Xie
2026-10-01 02:54:33 +00:00
committed by GitHub
parent 9e6550bd05
commit bfbcde26d5
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import time
from abc import ABC, abstractmethod
import torch
@@ -70,11 +71,17 @@ class BaseModelLoader(ABC):
target_device = torch.device(load_device)
with set_default_torch_dtype(model_config.dtype):
with target_device:
time_before_load = time.perf_counter()
model = self.create_model(
vllm_config=vllm_config,
model_config=model_config,
prefix=prefix,
)
time_after_load = time.perf_counter()
logger.info_once(
"Initializing model took %.6f seconds",
time_after_load - time_before_load,
)
logger.debug("Loading weights on %s ...", load_device)
self.load_weights(model, model_config)