[Core] Configure custom encoder cache managers from VllmConfig (#51251)
Signed-off-by: hotTea <958436561@qq.com> Signed-off-by: HMCCMH <chenminghaoscu@163.com> Co-authored-by: HMCCMH <chenminghaoscu@163.com>
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
|
||||
from abc import ABC
|
||||
from dataclasses import field
|
||||
from typing import Any
|
||||
|
||||
from vllm.config.utils import config
|
||||
from vllm.utils.import_utils import resolve_obj_by_qualname
|
||||
@@ -10,8 +12,16 @@ from vllm.utils.import_utils import resolve_obj_by_qualname
|
||||
@config
|
||||
class EncoderCacheManagerConfig:
|
||||
encoder_cache_manager_cls: str | None = None
|
||||
"""The qualified class name of the custom encoder cache manager.
|
||||
"""
|
||||
"""Fully qualified class name of the custom encoder cache manager."""
|
||||
|
||||
manager_config: dict[str, Any] = field(default_factory=dict)
|
||||
"""Opaque configuration interpreted by the custom cache manager."""
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
if self.encoder_cache_manager_cls is None and self.manager_config:
|
||||
raise ValueError(
|
||||
"manager_config requires encoder_cache_manager_cls to be set."
|
||||
)
|
||||
|
||||
def get_encoder_cache_manager_obj(self):
|
||||
cls_path = self.encoder_cache_manager_cls
|
||||
|
||||
Reference in New Issue
Block a user