sskj-h3/throughput/sglang-cache-dit/scripts/cachedit_sglang_launcher.py

32 lines
873 B
Python
Executable File

#!/usr/bin/env python3
"""Start the SGLang CLI only after the H3 request-reset patch is installed."""
from __future__ import annotations
import multiprocessing
import os
from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.minimax_h3.stages.denoising import (
MiniMaxH3DenoisingStage,
)
from sitecustomize import _install_patch
_install_patch()
if not getattr(MiniMaxH3DenoisingStage, "_ymrl_cache_reset_patch", False):
raise RuntimeError("MiniMax-H3 Cache-DiT per-request reset patch did not install")
def launch() -> int:
if os.getenv("SGLANG_CACHE_PATCH_VERIFY_ONLY") == "1":
print("MiniMax-H3 Cache-DiT request-reset patch: installed")
return 0
from sglang.cli.main import main
return int(main() or 0)
if __name__ == "__main__":
multiprocessing.freeze_support()
raise SystemExit(launch())