sgl-project/sglang · error · ValueError
MPS currently supports only --num-gpus 1
Error message
MPS currently supports only --num-gpus 1
What it means
On Apple MPS there is no multi-GPU support, so the runtime enforces --num-gpus 1 during platform-specific adjustment.
Source
Thrown at python/sglang/multimodal_gen/runtime/server_args/server_args.py:1422
@staticmethod
def _is_ltx23_model_path(model_path: str | None) -> bool:
if not model_path:
return False
normalized = model_path.lower()
return any(
token in normalized
for token in (
"lightricks/ltx-2.3",
"models--lightricks--ltx-2.3",
"lightricks__ltx-2.3",
)
)
def _adjust_platform_specific(self):
if current_platform.is_mps():
if self.num_gpus != 1:
raise ValueError("MPS currently supports only --num-gpus 1")
if self.component_residency is not None and any(
mode not in (RESIDENT, LAYERWISE_OFFLOAD)
for mode in self.component_residency.values()
):
raise ValueError(
"MPS supports only resident or layerwise-offload component "
"residency"
)
self.use_fsdp_inference = False
def is_arg_explicitly_set(self, arg_name: str) -> bool:
return arg_name in self._explicit_arg_names
def canonical_residency_mode(self, component_name: str) -> str | None:
"""Resolve the canonical selector for one component, if present."""
return resolve_component_residency_mode(
component_name, self.component_residency
)View on GitHub (pinned to 0132848349)
Solutions
- Set --num-gpus 1 explicitly on MPS
- Use a platform-conditional launch config
- Move multi-GPU workloads to a CUDA host
Example fix
# before --num-gpus 2 # on Apple Silicon # after --num-gpus 1
Defensive patterns
Strategy: validation
Validate before calling
if platform.system() == 'Darwin':
assert num_gpus == 1, 'MPS supports only 1 GPU' Prevention
- Platform-gate launch configs
- Pin --num-gpus 1 in Mac dev scripts
When it happens
Trigger: Running on macOS with current_platform.is_mps() true while --num-gpus > 1 (or a config defaulting num_gpus to the machine's GPU-count heuristic).
Common situations: Reusing a Linux multi-GPU config on a Mac; a launcher auto-setting num_gpus = torch.cuda.device_count()-like value that is >1 on MPS.
Related errors
- MPS supports only resident or layerwise-offload component re
- This browser cannot encode H.264 MP4
- H.264 encoder did not return MP4 decoder config
- This browser does not support gzip stream decoding
- delta payload size mismatch: expected ${expectedSize}, got $
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/8de650311176b95b.
Report an issue: GitHub.