Skip to content

Commit

Permalink
move import of AsecndQuantConfig to pre_register
Browse files Browse the repository at this point in the history
Signed-off-by: angazenn <zengyanjia@huawei.com>
  • Loading branch information
angazenn committed Feb 11, 2025
1 parent 5002040 commit 90531d9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 0 additions & 4 deletions vllm_ascend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,4 @@

def register():
"""Register the NPU platform."""
# TODO: https://github.com/vllm-project/vllm/pull/12432 Once this pr is merged,
# the following module can be imported using pre_register_and_update function.
from vllm_ascend.quantization.quant_config import AscendQuantConfig # noqa: F401

return "vllm_ascend.platform.NPUPlatform"
15 changes: 15 additions & 0 deletions vllm_ascend/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,21 @@ def synchronize(cls):
def mem_get_info(cls) -> Tuple[int, int]:
return torch.npu.mem_get_info()

@classmethod
def pre_register_and_update(cls,
parser: Optional[FlexibleArgumentParser] = None
) -> None:
"""
Do some pre-registeration or update action for the current platform.
This function is called before global VllmConfig is initialized or cli
arguments are parsed. It's used for out-of-tree platforms to register or
update the configuration.
For example, the out-of-tree quantization config can be imported and
registered here dynamically.
"""

from vllm_ascend.quantization.quant_config import AscendQuantConfig # noqa: F401

@classmethod
def check_and_update_config(cls, vllm_config: VllmConfig) -> None:
# Register ops when setup.
Expand Down

0 comments on commit 90531d9

Please sign in to comment.