[Observability] add model initializing duration log (#52141)
Signed-off-by: Andy Xie <andy.xning@gmail.com>
Ning Xie committed
Oct 1, 2026 at 10:54 UTC
bfbcde26d5c86475d478b6b1abc9a1285d3753d0
1 file changed
+7
vllm/model_executor/model_loader/base_loader.py
+7
@@ -1,5 +1,6 @@
1
# SPDX-License-Identifier: Apache-2.0
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
+import time
4
from abc import ABC, abstractmethod
5
6
import torch
@@ -70,11 +71,17 @@ class BaseModelLoader(ABC):
71
target_device = torch.device(load_device)
72
with set_default_torch_dtype(model_config.dtype):
73
with target_device:
74
+ time_before_load = time.perf_counter()
75
model = self.create_model(
76
vllm_config=vllm_config,
77
model_config=model_config,
78
prefix=prefix,
79
)
80
+ time_after_load = time.perf_counter()
81
+ logger.info_once(
82
+ "Initializing model took %.6f seconds",
83
+ time_after_load - time_before_load,
84
+ )
85
86
logger.debug("Loading weights on %s ...", load_device)
87
self.load_weights(model, model_config)