cli.py 928 B

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