[diffusion] multi-platform: use current_platform.device_type to replace hard-coded cuda device (#15232)

Signed-off-by: Xiaodong Ye <yeahdongcn@gmail.com>
This commit is contained in:
R0CKSTAR
2025-12-16 22:17:33 +08:00
committed by GitHub
parent ecb401ed42
commit 9f4ed93dd8
16 changed files with 62 additions and 23 deletions
@@ -7,6 +7,8 @@ import numpy as np
import torch
import torch.distributed as dist
from sglang.multimodal_gen.runtime.platforms import current_platform
def broadcast_pyobj(
data: List[Any],
@@ -20,7 +22,7 @@ def broadcast_pyobj(
of dist_group argument).
"""
device = torch.device(
"cuda" if torch.cuda.is_available() and not force_cpu_device else "cpu"
current_platform.device_type if not force_cpu_device else "cpu"
)
if rank == src: