visualize_benchmark_results.py 1.28 KB
Newer Older
1
# SPDX-License-Identifier: Apache-2.0
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3

4
5
6
7
8
9
10
import json

import matplotlib.pyplot as plt
import pandas as pd

if __name__ == "__main__":
    data = []
11
    for name in ["disagg_prefill", "chunked_prefill"]:
12
13
14
        for qps in [2, 4, 6, 8]:
            with open(f"results/{name}-qps-{qps}.json") as f:
                x = json.load(f)
15
16
                x["name"] = name
                x["qps"] = qps
17
18
19
                data.append(x)

    df = pd.DataFrame.from_dict(data)
20
21
    dis_df = df[df["name"] == "disagg_prefill"]
    chu_df = df[df["name"] == "chunked_prefill"]
22

23
24
    plt.style.use("bmh")
    plt.rcParams["font.size"] = 20
25
26

    for key in [
27
28
29
30
31
32
        "mean_ttft_ms",
        "median_ttft_ms",
        "p99_ttft_ms",
        "mean_itl_ms",
        "median_itl_ms",
        "p99_itl_ms",
33
34
    ]:
        fig, ax = plt.subplots(figsize=(11, 7))
35
36
37
38
39
40
        plt.plot(
            dis_df["qps"], dis_df[key], label="disagg_prefill", marker="o", linewidth=4
        )
        plt.plot(
            chu_df["qps"], chu_df[key], label="chunked_prefill", marker="o", linewidth=4
        )
41
42
        ax.legend()

43
        ax.set_xlabel("QPS")
44
45
        ax.set_ylabel(key)
        ax.set_ylim(bottom=0)
46
        fig.savefig(f"results/{key}.png")
47
        plt.close(fig)