Co-authored-by: yhyang201 <yhyang201@gmail.com> Co-authored-by: yizhang2077 <1109276519@qq.com> Co-authored-by: Xinyuan Tong <xinyuantong.cs@gmail.com> Co-authored-by: ispobock <ispobaoke@gmail.com> Co-authored-by: JiLi <leege233@gmail.com> Co-authored-by: CHEN Xi <78632976+RubiaCx@users.noreply.github.com> Co-authored-by: laixin <xielx@shanghaitech.edu.cn> Co-authored-by: SolitaryThinker <wlsaidhi@gmail.com> Co-authored-by: jzhang38 <a1286225768@gmail.com> Co-authored-by: BrianChen1129 <yongqichcd@gmail.com> Co-authored-by: Kevin Lin <42618777+kevin314@users.noreply.github.com> Co-authored-by: Edenzzzz <wtan45@wisc.edu> Co-authored-by: rlsu9 <r3su@ucsd.edu> Co-authored-by: Jinzhe Pan <48981407+eigensystem@users.noreply.github.com> Co-authored-by: foreverpiano <pianoqwz@qq.com> Co-authored-by: RandNMR73 <notomatthew31@gmail.com> Co-authored-by: PorridgeSwim <yz3883@columbia.edu> Co-authored-by: Jiali Chen <90408393+gary-chenjl@users.noreply.github.com>
30 lines
717 B
Python
30 lines
717 B
Python
"""Launch the inference server."""
|
|
|
|
import asyncio
|
|
import os
|
|
import sys
|
|
|
|
from sglang.srt.server_args import prepare_server_args
|
|
from sglang.srt.utils import kill_process_tree
|
|
|
|
|
|
def run_server(server_args):
|
|
"""Run the server based on server_args.grpc_mode."""
|
|
if server_args.grpc_mode:
|
|
from sglang.srt.entrypoints.grpc_server import serve_grpc
|
|
|
|
asyncio.run(serve_grpc(server_args))
|
|
else:
|
|
from sglang.srt.entrypoints.http_server import launch_server
|
|
|
|
launch_server(server_args)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
server_args = prepare_server_args(sys.argv[1:])
|
|
|
|
try:
|
|
run_server(server_args)
|
|
finally:
|
|
kill_process_tree(os.getpid(), include_parent=False)
|