cli.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import argparse
  2. from aphrodite.endpoints.openai.api_server import run_server
  3. from aphrodite.endpoints.openai.args import make_arg_parser
  4. from aphrodite.endpoints.configure import configure
  5. def main():
  6. parser = argparse.ArgumentParser(description="Aphrodite CLI")
  7. subparsers = parser.add_subparsers()
  8. serve_parser = subparsers.add_parser(
  9. "run",
  10. help="Start the Aphrodite OpenAI Compatible API server",
  11. usage="aphrodite run <model_tag> [options]")
  12. make_arg_parser(serve_parser)
  13. # Override the `--model` optional argument, make it positional.
  14. serve_parser.add_argument("model",
  15. type=str,
  16. help="The model tag or path to run.")
  17. serve_parser.set_defaults(func=run_server)
  18. configure_parser = subparsers.add_parser(
  19. "configure",
  20. help="Configure Aphrodite settings through a TUI",
  21. usage="aphrodite configure")
  22. configure_parser.set_defaults(func=configure)
  23. args = parser.parse_args()
  24. if hasattr(args, "func"):
  25. args.func(args)
  26. else:
  27. parser.print_help()
  28. if __name__ == "__main__":
  29. main()