-
Notifications
You must be signed in to change notification settings - Fork 35
feat(aws): add --vllm-extra-args flag and auto GPU detection for RHEL AI #848
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
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -46,6 +46,7 @@ type rhelAIRequest struct { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| hfToken *string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| apiKey *string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| autoStart bool | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| vllmExtraArgs *string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exposePorts []int | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -85,6 +86,7 @@ func Create(mCtxArgs *mc.ContextArgs, args *apiRHELAI.RHELAIArgs) (err error) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| hfToken: &args.HFToken, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| apiKey: &args.APIKey, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| autoStart: args.AutoStart, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| vllmExtraArgs: &args.VLLMExtraArgs, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exposePorts: args.ExposePorts} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if args.Spot != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| r.spot = args.Spot.Spot | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -359,7 +361,7 @@ func (r *rhelAIRequest) lbTargetGroups() []int { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func (r *rhelAIRequest) rhaiisSetupScript() string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| confDir := "/etc/containers/systemd/rhaiis.container.d" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| confDir := "/etc/containers/systemd/rhaii.container.d" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| script := fmt.Sprintf( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "sudo cp %s/install.conf.example %s/install.conf", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| confDir, confDir) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -373,12 +375,27 @@ func (r *rhelAIRequest) rhaiisSetupScript() string { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ` && sudo sed -i 's|--model .*|--model %s \\|' %s/install.conf`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| *r.model, confDir) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| script += fmt.Sprintf( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ` && GPU_COUNT=$(nvidia-smi -L 2>/dev/null | wc -l) && [ "$GPU_COUNT" -gt 0 ] && sudo sed -i "s|--tensor-parallel-size 1|--tensor-parallel-size $GPU_COUNT|" %s/install.conf`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| confDir) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if len(*r.vllmExtraArgs) > 0 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| extraArgs := *r.vllmExtraArgs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if strings.Contains(extraArgs, "--max-model-len") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| script += fmt.Sprintf( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ` && sudo sed -i 's|--max-model-len [0-9]*|%s|' %s/install.conf`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| extraArgs, confDir) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| script += fmt.Sprintf( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ` && sudo sed -i 's|--max-model-len 4096|--max-model-len 4096 \\\n %s|' %s/install.conf`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| extraArgs, confDir) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+381
to
+390
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. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Shell-quote and sed-escape
Suggested direction if len(*r.vllmExtraArgs) > 0 {
- extraArgs := *r.vllmExtraArgs
+ extraArgs := sedReplacementEscape(*r.vllmExtraArgs)
if strings.Contains(extraArgs, "--max-model-len") {
script += fmt.Sprintf(
- ` && sudo sed -i 's|--max-model-len [0-9]*|%s|' %s/install.conf`,
- extraArgs, confDir)
+ ` && sudo sed -i %s %s/install.conf`,
+ shellSingleQuote(fmt.Sprintf(`s|--max-model-len [0-9]*|%s|`, extraArgs)), confDir)
} else {
script += fmt.Sprintf(
- ` && sudo sed -i 's|--max-model-len 4096|--max-model-len 4096 \\\n %s|' %s/install.conf`,
- extraArgs, confDir)
+ ` && sudo sed -i %s %s/install.conf`,
+ shellSingleQuote(fmt.Sprintf(`s|--max-model-len 4096|--max-model-len 4096 \\\n %s|`, extraArgs)), confDir)
}
}Add small helpers near this script builder: func shellSingleQuote(s string) string {
return "'" + strings.ReplaceAll(s, "'", `'\''`) + "'"
}
func sedReplacementEscape(s string) string {
return strings.NewReplacer(`\`, `\\`, `&`, `\&`, `|`, `\|`).Replace(s)
}As per path instructions, “Focus on major issues impacting performance, readability, maintainability and security.” 📝 Committable suggestion
Suggested change
🤖 Prompt for AI AgentsSource: Path instructions |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if len(*r.apiKey) > 0 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| script += fmt.Sprintf( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| " && sudo sed -i '/\\[Install\\]/i Environment=VLLM_API_KEY=%s' %s/install.conf", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| *r.apiKey, confDir) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| script += " && sudo systemctl daemon-reload && sudo systemctl start rhaiis" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| script += " && sudo systemctl daemon-reload && sudo systemctl start rhaii" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return script | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -85,6 +85,12 @@ spec: | |||||||||||||||||||||||||||||||||||||
| - name: disk-size | ||||||||||||||||||||||||||||||||||||||
| description: Disk size in GB for the cloud instance | ||||||||||||||||||||||||||||||||||||||
| default: "200" | ||||||||||||||||||||||||||||||||||||||
| - name: gpus | ||||||||||||||||||||||||||||||||||||||
| description: Number of GPUs for the cloud instance (valid marketplace values are 1, 2, 4, 8) | ||||||||||||||||||||||||||||||||||||||
| default: "8" | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+88
to
+90
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. 🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win Preserve the Azure RHEL AI GPU default unless callers opt in. With Proposed fix - name: gpus
description: Number of GPUs for the cloud instance (valid marketplace values are 1, 2, 4, 8)
- default: "8"
+ default: ""As per path instructions, Also applies to: 238-240 🤖 Prompt for AI AgentsSource: Path instructions |
||||||||||||||||||||||||||||||||||||||
| - name: gpu-manufacturer | ||||||||||||||||||||||||||||||||||||||
| description: GPU manufacturer name for instance filtering (e.g. NVIDIA, AMD) | ||||||||||||||||||||||||||||||||||||||
| default: "" | ||||||||||||||||||||||||||||||||||||||
| - name: compute-sizes | ||||||||||||||||||||||||||||||||||||||
| description: Comma seperated list of sizes for the machines to be requested. If set this takes precedence over compute by args | ||||||||||||||||||||||||||||||||||||||
| default: "Standard_ND96is_MI300X_v5,Standard_ND96isr_MI300X_v5" | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -229,6 +235,12 @@ spec: | |||||||||||||||||||||||||||||||||||||
| if [[ "$(params.compute-sizes)" != "" ]]; then | ||||||||||||||||||||||||||||||||||||||
| cmd+="--compute-sizes '$(params.compute-sizes)' " | ||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||
| if [[ "$(params.gpus)" != "" ]]; then | ||||||||||||||||||||||||||||||||||||||
| cmd+="--gpus '$(params.gpus)' " | ||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||
| if [[ "$(params.gpu-manufacturer)" != "" ]]; then | ||||||||||||||||||||||||||||||||||||||
| cmd+="--gpu-manufacturer '$(params.gpu-manufacturer)' " | ||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+238
to
+243
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. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Validate new params before adding them to the eval’d command. These Tekton params are interpolated into Proposed hardening if [[ "$(params.gpus)" != "" ]]; then
- cmd+="--gpus '$(params.gpus)' "
+ case "$(params.gpus)" in
+ *[!0-9]*) echo "Parameter gpus must be numeric"; exit 1 ;;
+ esac
+ cmd+="--gpus $(params.gpus) "
fi
if [[ "$(params.gpu-manufacturer)" != "" ]]; then
+ case "$(params.gpu-manufacturer)" in
+ *[!A-Za-z0-9._-]*) echo "Parameter gpu-manufacturer contains unsupported characters"; exit 1 ;;
+ esac
cmd+="--gpu-manufacturer '$(params.gpu-manufacturer)' "
fiAs per path instructions, 📝 Committable suggestion
Suggested change
🤖 Prompt for AI AgentsSource: Path instructions |
||||||||||||||||||||||||||||||||||||||
| if [[ "$(params.marketplace)" == "true" ]]; then | ||||||||||||||||||||||||||||||||||||||
| cmd+="--marketplace " | ||||||||||||||||||||||||||||||||||||||
| cmd+="--accelerator '$(params.accelerator)' " | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.