-
Notifications
You must be signed in to change notification settings - Fork 62
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
Added vllm cuda support #582
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,7 +109,13 @@ def _image(self, args): | |
if args.image != default_image(): | ||
return args.image | ||
|
||
gpu_type, _ = get_gpu() | ||
env_vars = get_env_vars() | ||
|
||
if not env_vars: | ||
gpu_type = None | ||
else: | ||
gpu_type, _ = next(iter(env_vars.items())) | ||
|
||
if args.runtime == "vllm": | ||
if gpu_type == "HIP_VISIBLE_DEVICES": | ||
return "quay.io/modh/vllm:rhoai-2.17-rocm" | ||
|
@@ -171,8 +177,10 @@ def setup_container(self, args): | |
conman_args += ["--device", "/dev/kfd"] | ||
|
||
for k, v in get_env_vars().items(): | ||
# Special case for Cuda | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should remove the else here and pass the env var in all cases, a user might set CUDA_VISIBLE_DEVICES to run a specific GPU and llama.cpp should be able to process that env var. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The else should be gone here right? |
||
if k == "CUDA_VISIBLE_DEVICES": | ||
conman_args += ["--device", "nvidia.com/gpu=all"] | ||
conman_args += ["-e", f"{k}={v}"] | ||
|
||
return conman_args | ||
|
||
def gpu_args(self, force=False, server=False): | ||
|
@@ -259,6 +267,7 @@ def build_exec_args_run(self, args, model_path, prompt): | |
if args.debug: | ||
exec_args += ["-v"] | ||
|
||
get_gpu() | ||
gpu_args = self.gpu_args(force=args.gpu) | ||
if gpu_args is not None: | ||
exec_args.extend(gpu_args) | ||
|
@@ -303,13 +312,17 @@ def build_exec_args_serve(self, args, exec_model_path): | |
] | ||
if args.seed: | ||
exec_args += ["--seed", args.seed] | ||
|
||
return exec_args | ||
|
||
def handle_runtime(self, args, exec_args, exec_model_path): | ||
if args.runtime == "vllm": | ||
get_gpu() | ||
exec_model_path = os.path.dirname(exec_model_path) | ||
exec_args = ["vllm", "serve", "--port", args.port, exec_model_path] | ||
# Left out "vllm", "serve" the image entrypoint already starts it | ||
exec_args = ["--port", args.port, "--model", MNT_FILE, "--max_model_len", "2048"] | ||
else: | ||
get_gpu() | ||
gpu_args = self.gpu_args(force=args.gpu, server=True) | ||
if gpu_args is not None: | ||
exec_args.extend(gpu_args) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we can delete this