[NPU]add nightly-test-npu (#14143)

This commit is contained in:
Cherry_ming
2025-12-05 00:43:35 +08:00
committed by GitHub
parent b01fc161eb
commit 1808df48fe
36 changed files with 1285 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ __all__ = [
"register_cpu_ci",
"register_cuda_ci",
"register_amd_ci",
"register_npu_ci",
"ut_parse_one_file",
]
@@ -22,6 +23,7 @@ class HWBackend(Enum):
CPU = auto()
CUDA = auto()
AMD = auto()
NPU = auto()
@dataclass
@@ -58,10 +60,21 @@ def register_amd_ci(
return None
def register_npu_ci(
est_time: float,
suite: str,
nightly: bool = False,
disabled: Optional[str] = None,
):
"""Marker for NPU CI registration (parsed via AST; runtime no-op)."""
return None
REGISTER_MAPPING = {
"register_cpu_ci": HWBackend.CPU,
"register_cuda_ci": HWBackend.CUDA,
"register_amd_ci": HWBackend.AMD,
"register_npu_ci": HWBackend.NPU,
}

View File

@@ -31,10 +31,15 @@ from transformers import (
)
from sglang.srt.entrypoints.engine import Engine
from sglang.srt.utils import load_image
from sglang.srt.utils import is_npu, load_image
from sglang.srt.utils.hf_transformers_utils import get_tokenizer
from sglang.test.test_utils import DEFAULT_PORT_FOR_SRT_TEST_RUNNER, calculate_rouge_l
if is_npu():
from sglang.srt.hardware_backend.npu.utils import init_npu_backend
init_npu_backend()
DEFAULT_PROMPTS = [
"Apple is red. Banana is Yellow. " * 800 + "Apple is",
"The capital of the United Kingdom is",
@@ -72,6 +77,8 @@ def get_dtype_str(torch_dtype):
return "float16"
if torch_dtype is torch.float32:
return "float32"
if torch_dtype is torch.bfloat16:
return "bfloat16"
else:
raise NotImplementedError()