Update python API of activation, topk, norm and rope and remove vllm dependency (#6614)

Co-authored-by: Wu, Chunyuan <chunyuan.wu@intel.com>
Co-authored-by: jianan-gu <jianan.gu@intel.com>
Co-authored-by: sdp <sdp@gnr799219.jf.intel.com>
This commit is contained in:
YanbingJiang
2025-06-18 13:11:50 +08:00
committed by GitHub
parent e56685ac1b
commit 094c116f7d
23 changed files with 270 additions and 56 deletions

View File

@@ -160,7 +160,7 @@ def is_npu() -> bool:
return hasattr(torch, "npu") and torch.npu.is_available()
def is_cpu() -> bool:
def is_host_cpu_x86() -> bool:
machine = platform.machine().lower()
return (
machine in ("x86_64", "amd64", "i386", "i686")
@@ -169,6 +169,10 @@ def is_cpu() -> bool:
)
def is_cpu() -> bool:
return os.getenv("SGLANG_USE_CPU_ENGINE", "0") == "1" and is_host_cpu_x86()
def is_flashinfer_available():
"""
Check whether flashinfer is available.
@@ -1452,6 +1456,15 @@ def get_device(device_id: Optional[int] = None) -> str:
"Habana frameworks detected, but failed to import 'habana_frameworks.torch.hpu'."
)
if is_cpu():
if cpu_has_amx_support():
logger.info("Intel AMX is detected, using CPU with Intel AMX support.")
else:
logger.warning(
"CPU device enabled, using torch native backend, low performance expected."
)
return "cpu"
raise RuntimeError("No accelerator (CUDA, XPU, HPU) is available.")