Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions vllm_ascend/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,36 @@
_CUSTOM_OP_REGISTERED = False


def config_deprecated_logging():
"""Configure deprecated logging format, when used deprecated codes
in vllm-ascend.
"""
import logging
import warnings

# Customize warning format to be one line
def one_line_formatwarning(message, category, filename, lineno, line=None):
return f"{filename}:{lineno}: {category.__name__}: {message}"

warnings.formatwarning = one_line_formatwarning

logging.captureWarnings(True)
warnings.simplefilter("once", DeprecationWarning)

vllm_logger = logging.getLogger("vllm")
warnings_logger = logging.getLogger("py.warnings")

# Propagate vllm logger handlers to warnings logger, to keep the same
# format with vllm
if vllm_logger.handlers:
warnings_logger.handlers = []

for handler in vllm_logger.handlers:
warnings_logger.addHandler(handler)
Comment thread
leo-pony marked this conversation as resolved.

warnings_logger.propagate = False


class NPUPlatform(Platform):

_enum = PlatformEnum.OOT
Expand Down Expand Up @@ -112,6 +142,8 @@ def pre_register_and_update(cls,
from vllm_ascend.quantization.quant_config import \
AscendQuantConfig # noqa: F401

config_deprecated_logging()

@classmethod
def get_device_capability(cls, device_id: int = 0):
return None
Expand Down
Loading