[diffusion] UX: provide solutions for OOM (#16940)

This commit is contained in:
Mick
2026-01-13 09:25:27 +08:00
committed by GitHub
parent ae0baefb94
commit 2b42309955
@@ -268,6 +268,18 @@ class GPUWorker:
return OutputBatch(output=status)
OOM_MSG = f"""
OOM detected. Possible solutions:
- If the OOM occurs during loading:
1. Enable CPU offload for memory-intensive components, or use `--dit-layerwise-offload` for DiT
- If the OOM occurs during runtime:
1. Reduce the number of output tokens by lowering resolution or decreasing `--num-frames`
2. Enable SP and/or TP
3. Enable a sparse-attention backend
Or, open an issue on GitHub https://github.com/sgl-project/sglang/issues/new/choose
"""
def run_scheduler_process(
local_rank: int,
rank: int,
@@ -299,6 +311,7 @@ def run_scheduler_process(
assert result_pipes_from_slaves is not None
from sglang.multimodal_gen.runtime.managers.scheduler import Scheduler
try:
scheduler = Scheduler(
server_args,
gpu_id=rank,
@@ -313,4 +326,8 @@ def run_scheduler_process(
}
)
scheduler.event_loop()
except torch.OutOfMemoryError as _e:
print(OOM_MSG)
raise
finally:
logger.info(f"Worker {rank}: Shutdown complete.")