[diffusion][llm] macOS support (#19549)

Signed-off-by: Xiaodong Ye <yeahdongcn@gmail.com>
Co-authored-by: Mick <mickjagger19@icloud.com>
This commit is contained in:
R0CKSTAR
2026-03-11 04:11:07 +08:00
committed by GitHub
parent a3d88a247b
commit db97f193b7
22 changed files with 984 additions and 11 deletions

View File

@@ -1,5 +1,29 @@
# SGLang public APIs
# Install stubs early for platforms where certain dependencies are unavailable
# (e.g. macOS/MPS has no triton, and torch.mps lacks Stream / set_device /
# get_device_properties). This must run before any downstream imports.
import sys as _sys
if _sys.platform == "darwin":
try:
import torch as _torch
if _torch.backends.mps.is_available():
from sglang._triton_stub import install as _install_triton_stub
_install_triton_stub()
del _install_triton_stub
from sglang._mps_stub import install as _install_mps_stub
_install_mps_stub()
del _install_mps_stub
del _torch
except ImportError:
pass
del _sys
# Frontend Language APIs
from sglang.global_config import global_config
from sglang.lang.api import (