@@ -261,6 +261,32 @@ def join_command(args, passthrough_args: list[str] | None = None):
261261 _execute_with_graceful_shutdown (cmd , env = env )
262262
263263
264+ def serve_command (args , passthrough_args : list [str ] | None = None ):
265+ """Start a standalone Parallax server by launching launch.py directly."""
266+ if not args .skip_upload :
267+ update_package_info ()
268+
269+ check_python_version ()
270+
271+ project_root = get_project_root ()
272+ launch_script = project_root / "src" / "parallax" / "launch.py"
273+
274+ if not launch_script .exists ():
275+ logger .info (f"Error: Launch script not found at { launch_script } " )
276+ sys .exit (1 )
277+
278+ env = os .environ .copy ()
279+ env ["SGLANG_ENABLE_JIT_DEEPGEMM" ] = "0"
280+
281+ passthrough_args = passthrough_args or []
282+ cmd = [sys .executable , str (launch_script ), "--model-path" , args .model_path ]
283+
284+ if passthrough_args :
285+ cmd .extend (passthrough_args )
286+
287+ _execute_with_graceful_shutdown (cmd , env = env )
288+
289+
264290def chat_command (args , passthrough_args : list [str ] | None = None ):
265291 """Start the Parallax chat server (equivalent to scripts/chat.sh)."""
266292 check_python_version ()
@@ -358,6 +384,7 @@ def main():
358384 formatter_class = argparse .RawDescriptionHelpFormatter ,
359385 epilog = """
360386Examples:
387+ parallax serve --model-path Qwen/Qwen3-0.6B # Start standalone server
361388 parallax run # Start scheduler with frontend
362389 parallax run -m {model-name} -n {number-of-worker-nodes} # Start scheduler without frontend
363390 parallax run -m Qwen/Qwen3-0.6B -n 2 # example
@@ -369,6 +396,21 @@ def main():
369396
370397 subparsers = parser .add_subparsers (dest = "command" , help = "Available commands" )
371398
399+ # Add 'serve' command parser
400+ serve_parser = subparsers .add_parser (
401+ "serve" , help = "Start a standalone Parallax server by launching the model locally"
402+ )
403+ serve_parser .add_argument (
404+ "-m" ,
405+ "--model-path" ,
406+ required = True ,
407+ type = str ,
408+ help = "Path to the model repository or model name" ,
409+ )
410+ serve_parser .add_argument (
411+ "-u" , "--skip-upload" , action = "store_true" , help = "Skip upload package info"
412+ )
413+
372414 # Add 'run' command parser
373415 run_parser = subparsers .add_parser (
374416 "run" , help = "Start the Parallax scheduler (equivalent to scripts/start.sh)"
@@ -424,6 +466,8 @@ def main():
424466
425467 if args .command == "run" :
426468 run_command (args , passthrough_args )
469+ elif args .command == "serve" :
470+ serve_command (args , passthrough_args )
427471 elif args .command == "join" :
428472 join_command (args , passthrough_args )
429473 elif args .command == "chat" :
0 commit comments