mirror of
https://github.com/kvcache-ai/sglang.git
synced 2026-07-01 20:27:57 +00:00
[NPU]add nightly-test-npu (#14143)
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user