Skip to content

Commit

Permalink
Update __main__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kdubba authored Jul 26, 2023
1 parent d3bf7db commit e915bdf
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions llama_cpp/server/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@

from llama_cpp.server.app import create_app, Settings

parser = argparse.ArgumentParser()
for name, field in Settings.model_fields.items():
description = field.description
if field.default is not None and description is not None:
description += f" (default: {field.default})"
parser.add_argument(
f"--{name}",
dest=name,
type=field.annotation if field.annotation is not None else str,
help=description,
)

args = parser.parse_args()
settings = Settings(**{k: v for k, v in vars(args).items() if v is not None})
app = create_app(settings=settings)

if __name__ == "__main__":
parser = argparse.ArgumentParser()
for name, field in Settings.model_fields.items():
Expand Down

0 comments on commit e915bdf

Please sign in to comment.