Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic vllm support #97

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/ramalama.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ show this help message and exit
do not run ramalama in the default container (default: False)
use environment variable "RAMALAMA_IN_CONTAINER=false" to change default.

#### **--runtime**
specify the runtime to use, valid options are 'llama.cpp' and 'vllm' (default: llama.cpp)

#### **--store**=STORE
store AI Models in the specified directory (default rootless: `$HOME/.local/share/ramalama`, default rootful: `/var/lib/ramalama`)

Expand Down
8 changes: 7 additions & 1 deletion ramalama/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ def init_cli():
)
parser.add_argument("--store", default=get_store(), help="store AI Models in the specified directory")
parser.add_argument("--dryrun", action="store_true", help="show container runtime command without executing it")
parser.add_argument(
"--runtime",
default="llama.cpp",
choices=["llama.cpp", "vllm"],
help="specify the runtime to use, valid options are 'llama.cpp' and 'vllm'",
)
parser.add_argument(
"--nocontainer",
default=not use_container(),
Expand Down Expand Up @@ -316,7 +322,7 @@ def run_parser(subparsers):
parser.add_argument("--prompt", dest="prompt", action="store_true", help="modify chatbot prompt")
parser.add_argument("-n", "--name", dest="name", help="name of container in which the Model will be run")
parser.add_argument("MODEL") # positional argument
parser.add_argument("ARGS", nargs="*", help="Additional options to pass to the AI Model")
parser.add_argument("ARGS", nargs="*", help="additional options to pass to the AI Model")
parser.set_defaults(func=run_cli)


Expand Down
5 changes: 4 additions & 1 deletion ramalama/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,8 @@ def run(self, args):

def serve(self, args):
symlink_path = self.pull(args)
exec_args = ["llama-server", "--port", args.port, "-m", symlink_path] + self.common_params
exec_args = ["llama-server", "--port", args.port, "-m", symlink_path]
if args.runtime == "vllm":
exec_args = ["vllm", "serve", "--port", args.port, symlink_path]

exec_cmd(exec_args)