[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

@@ -5,13 +5,15 @@ import torch
logger = logging.getLogger(__name__)
SUPPORTED_DEVICES = ["cuda", "xpu", "hpu", "cpu", "npu", "musa", "mps"]
class DeviceConfig:
device: Optional[torch.device]
gpu_id: Optional[int]
def __init__(self, device: str = "cuda", gpu_id: int = -1) -> None:
if device in ["cuda", "xpu", "hpu", "cpu", "npu", "musa"]:
if device in SUPPORTED_DEVICES:
self.device_type = device
else:
raise RuntimeError(f"Not supported device type: {device}")