Skip to content
Open
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
15 changes: 4 additions & 11 deletions auto_tune_vllm/benchmarks/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,27 +199,20 @@ def start_benchmark(
# Build GuideLLM command
cmd = self._build_guidellm_command(model_url, config, self._results_file)

# Validate binary and basic inputs
import shutil

if shutil.which("guidellm") is None:
raise RuntimeError(
"GuideLLM CLI not found on PATH. "
"Please install or provide the full path."
)
# Validate benchmark target inputs
if not (model_url.startswith("http://") or model_url.startswith("https://")):
raise ValueError(f"Invalid model_url: {model_url!r} (expected http/https)")

env = os.environ.copy()
env["GUIDELLM__LOGGING__CONSOLE_LOG_LEVEL"] = config.logging_level

# Run GuideLLM
self._logger.info(f"Running: {' '.join(cmd)}")
self._logger.info(f"Results will be saved to: {self._results_file}")

# Use Popen so we can terminate if vLLM dies
# start_new_session=True puts it in its own process group for clean
# termination
env = os.environ.copy()
env["GUIDELLM__LOGGING__CONSOLE_LOG_LEVEL"] = config.logging_level

self._process = subprocess.Popen(
cmd,
stdout=subprocess.PIPE,
Expand Down
39 changes: 39 additions & 0 deletions auto_tune_vllm/cli/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""Command-line interface for auto-tune-vllm."""

import logging
import os
import shutil
import subprocess
import sys
from pathlib import Path
from typing import Optional
Expand Down Expand Up @@ -109,6 +111,41 @@ def _display_log_viewing_instructions(config: StudyConfig):
)


def _run_guidellm_benchmark_help_preflight_for_optimize(config: StudyConfig) -> None:
"""Once per `optimize` run: verify `guidellm benchmark --help` succeeds (GuideLLM only)."""
if config.benchmark.benchmark_type != "guidellm":
return

console.print("[blue]Checking GuideLLM CLI (guidellm benchmark --help)...[/blue]")
if shutil.which("guidellm") is None:
raise RuntimeError(
"GuideLLM CLI not found on PATH. "
"Install GuideLLM or ensure `guidellm` is available."
)
env = os.environ.copy()
env["GUIDELLM__LOGGING__CONSOLE_LOG_LEVEL"] = config.benchmark.logging_level
try:
result = subprocess.run(
["guidellm", "benchmark", "--help"],
capture_output=True,
text=True,
timeout=120,
env=env,
)
except subprocess.TimeoutExpired as exc:
raise RuntimeError(
"GuideLLM CLI check timed out while running 'guidellm benchmark --help'."
) from exc

if result.returncode != 0:
err = (result.stderr or result.stdout or "").strip()
raise RuntimeError(
f"GuideLLM CLI check failed (exit code {result.returncode}) "
f"for 'guidellm benchmark --help'. Output: {err}"
)
console.print("[green]✓ GuideLLM CLI OK[/green]")


@app.command("optimize")
def optimize_command(
config: str = typer.Option(..., "--config", "-c", help="Study configuration file"),
Expand Down Expand Up @@ -405,6 +442,8 @@ def run_optimization_sync(
"so startup sampling would consume the full trial budget. "
f"n_startup_trials is now {config.optimization.n_startup_trials}.[/yellow]"
)
_run_guidellm_benchmark_help_preflight_for_optimize(config)

# Create study controller (uses config with possibly updated sampler/n_trials)
controller = StudyController.create_from_config(
backend, config, create_db=create_db
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ requires-python = ">=3.10"
dependencies = [
"optuna>=3.0.0",
"optuna-integration[botorch]>=4.0.0",
"vllm>=0.11.0",
"vllm>=0.11.0,<=0.19",
Comment thread
VincentG1234 marked this conversation as resolved.
"guidellm>=0.1.0",
"pyyaml>=6.0",
"pydantic>=2.0.0",
Expand Down
Loading