|
22 | 22 |
|
23 | 23 | import vllm.envs as envs |
24 | 24 | from vllm.config import ParallelConfig, VllmConfig |
| 25 | +from vllm.config.pooler import POOLER_CONFIG_LOG_FIELDS |
25 | 26 | from vllm.distributed import ( |
26 | 27 | cleanup_dist_env_and_memory, |
27 | 28 | stateless_destroy_torch_distributed_process_group, |
@@ -121,6 +122,7 @@ def __init__( |
121 | 122 |
|
122 | 123 | # Setup Model. |
123 | 124 | self.model_executor = executor_class(vllm_config) |
| 125 | + self._pooler_config_logged = False |
124 | 126 | if executor_fail_callback is not None: |
125 | 127 | self.model_executor.register_failure_callback(executor_fail_callback) |
126 | 128 |
|
@@ -348,7 +350,63 @@ def _initialize_kv_caches(self, vllm_config: VllmConfig) -> KVCacheConfig: |
348 | 350 | return scheduler_kv_cache_config |
349 | 351 |
|
350 | 352 | def get_supported_tasks(self) -> tuple[SupportedTask, ...]: |
351 | | - return self.model_executor.supported_tasks |
| 353 | + supported_tasks = self.model_executor.supported_tasks |
| 354 | + self._log_pooler_config(supported_tasks) |
| 355 | + return supported_tasks |
| 356 | + |
| 357 | + def _log_pooler_config(self, supported_tasks: tuple[SupportedTask, ...]) -> None: |
| 358 | + if self._pooler_config_logged: |
| 359 | + return |
| 360 | + |
| 361 | + model_config = self.vllm_config.model_config |
| 362 | + pooler_config = model_config.pooler_config |
| 363 | + if ( |
| 364 | + self.vllm_config.parallel_config.data_parallel_rank_local |
| 365 | + or model_config.runner_type != "pooling" |
| 366 | + or pooler_config is None |
| 367 | + ): |
| 368 | + return |
| 369 | + |
| 370 | + supported_pooling_tasks = tuple( |
| 371 | + sorted(set(supported_tasks) & set(POOLING_TASKS)) |
| 372 | + ) |
| 373 | + if not supported_pooling_tasks: |
| 374 | + return |
| 375 | + |
| 376 | + self._pooler_config_logged = True |
| 377 | + task_set = set(supported_pooling_tasks) |
| 378 | + use_activation = pooler_config.use_activation |
| 379 | + if use_activation is None: |
| 380 | + use_activation = True |
| 381 | + sources = getattr(model_config, "_pooler_config_sources", {}) |
| 382 | + pooling_type_field = ( |
| 383 | + "seq_pooling_type" |
| 384 | + if task_set & {"embed", "classify"} |
| 385 | + else "tok_pooling_type" |
| 386 | + ) |
| 387 | + |
| 388 | + def log_field(name: str, field: str) -> str: |
| 389 | + value = ( |
| 390 | + use_activation |
| 391 | + if field == "use_activation" |
| 392 | + else getattr(pooler_config, field) |
| 393 | + ) |
| 394 | + source = sources.get(field, "unknown") |
| 395 | + return f"{name}={value}(source={source})" |
| 396 | + |
| 397 | + log_items = [("pooling_type", pooling_type_field)] |
| 398 | + log_items.extend( |
| 399 | + (field, field) |
| 400 | + for field in POOLER_CONFIG_LOG_FIELDS |
| 401 | + if field != pooling_type_field |
| 402 | + ) |
| 403 | + config_fields = ", ".join(log_field(name, field) for name, field in log_items) |
| 404 | + |
| 405 | + logger.info_once( |
| 406 | + "Resolved pooling config: %s, supported_tasks=%s", |
| 407 | + config_fields, |
| 408 | + supported_pooling_tasks, |
| 409 | + ) |
352 | 410 |
|
353 | 411 | def get_kv_cache_group_metadata(self) -> list[dict[str, int | str | None]]: |
354 | 412 | """Return msgspec-serializable metadata for scheduler KV cache groups.""" |
|
0 commit comments