Repository: vllm-project/vllm
File: vllm/benchmarks/serve.py (Python)

Code before:
                "Please remove the --request-rate argument."
            )
        if args.ramp_up_start_rps is None or args.ramp_up_end_rps is None:
            raise ValueError(
                "When using --ramp-up-strategy, both --ramp-up-start-rps and "
                "--ramp-up-end-rps must be specified"
            )
        if args.ramp_up_start_rps < 0 or args.ramp_up_end_rps < 0:
            raise ValueError("Ramp-up start and end RPS must be non-negative")
        if args.ramp_up_start_rps > args.ramp_up_end_rps:
            raise ValueError("Ramp-up start RPS must be less than end RPS")
        if args.ramp_up_strategy == "exponential" and args.ramp_up_start_rps == 0:
            raise ValueError("For exponential ramp-up, the start RPS cannot be 0.")

    label = args.label

    if args.base_url is not None:
        api_url = f"{args.base_url}{args.endpoint}"
        base_url = f"{args.base_url}"
    else:
        host_port = join_host_port(args.host, args.port)
        api_url = f"http://{host_port}{args.endpoint}"
        base_url = f"http://{host_port}"

    # Headers
    headers = None
    if args.header:
        headers = {}
        for item in args.header:
            if "=" in item:
                kvstring = item.split("=", 1)
                headers[kvstring[0].strip()] = kvstring[1].strip()
            else:
                raise ValueError("Invalid header format. Please use KEY=VALUE format.")

    # SSL context configuration
    ssl_context: ssl.SSLContext | bool | None = None
    if args.insecure:
        # Disable SSL certificate verification
        ssl_context = False
    elif "https://" in base_url:
        # Use default SSL context for HTTPS
        ssl_context = True

    # Fetch model from server if not specified
    if args.model is None:
        print("Model not specified, fetching first model from server...")
        model_name, model_id = await get_first_model_from_server(
            base_url, headers, ssl_context
        )
        print(f"First model name: {model_name}, first model id: {model_id}")

Review comment (suggestion):
```suggestion

    parser.add_argument(
        "--plot-timeline",
        action="store_true",
        help="Generate an HTML timeline plot showing request execution. "
        "The plot will be saved alongside the results JSON file.",
    )
    parser.add_argument(
        "--timeline-itl-thresholds",
        type=float,
        nargs=2,
        default=[25.0, 50.0],
        metavar=("THRESHOLD1", "THRESHOLD2"),
        help="ITL thresholds in milliseconds for timeline plot coloring. "
        "Specify two values to categorize inter-token latencies into three groups: "
        "below first threshold (green), between thresholds (orange), "
        "and above second threshold (red). Default: 25 50 (milliseconds).",
    )
    parser.add_argument(
        "--plot-dataset-stats",
        action="store_true",
        help="Generate a matplotlib figure with dataset statistics showing "
        "prompt tokens, output tokens, and combined token distributions.",
    )
```

Group them together

Code after:
        "connecting to servers with self-signed certificates.",
    )

    parser.add_argument(
        "--plot-timeline",
        action="store_true",
        help="Generate an HTML timeline plot showing request execution. "
        "The plot will be saved alongside the results JSON file.",
    )
    parser.add_argument(
        "--timeline-itl-thresholds",
        type=float,
        nargs=2,
        default=[25.0, 50.0],
        metavar=("THRESHOLD1", "THRESHOLD2"),
        help="ITL thresholds in milliseconds for timeline plot coloring. "
        "Specify two values to categorize inter-token latencies into three groups: "
        "below first threshold (green), between thresholds (orange), "
        "and above second threshold (red). Default: 25 50 (milliseconds).",
    )
    parser.add_argument(
        "--plot-dataset-stats",
        action="store_true",
        help="Generate a matplotlib figure with dataset statistics showing "
        "prompt tokens, output tokens, and combined token distributions.",
    )


def main(args: argparse.Namespace) -> dict[str, Any]:
    return asyncio.run(main_async(args))


async def main_async(args: argparse.Namespace) -> dict[str, Any]:
    print(args)
    random.seed(args.seed)
    np.random.seed(args.seed)

    # Validate ramp-up arguments
    if args.ramp_up_strategy is not None:
        if args.request_rate != float("inf"):
            raise ValueError(
                "When using ramp-up, do not specify --request-rate. "
                "The request rate will be controlled by ramp-up parameters. "
                "Please remove the --request-rate argument."
            )
        if args.ramp_up_start_rps is None or args.ramp_up_end_rps is None:
            raise ValueError(
                "When using --ramp-up-strategy, both --ramp-up-start-rps and "
                "--ramp-up-end-rps must be specified"
            )
        if args.ramp_up_start_rps < 0 or args.ramp_up_end_rps < 0: