Skip to content

Commit

Permalink
server: bench: fix graph, fix output artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
phymbert committed Mar 25, 2024
1 parent 347b627 commit a3353bb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,6 @@ jobs:
name: benchmark-results
compression-level: 9
path: |
examples/server/bench/**/.png
examples/server/bench/**/.json
examples/server/bench/**/.log
examples/server/bench/*.png
examples/server/bench/*.json
examples/server/bench/*.log
9 changes: 8 additions & 1 deletion examples/server/bench/bench.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import argparse
import base64
import json
import os
import re
Expand All @@ -13,6 +12,8 @@
from contextlib import closing
from datetime import datetime

import matplotlib
import matplotlib.dates
import matplotlib.pyplot as plt
import requests

Expand Down Expand Up @@ -109,6 +110,10 @@ def main(args_in: list[str] | None = None) -> None:
for metric in metrics:
resp = requests.get(f"http://localhost:9090/api/v1/query_range",
params={'query': 'llamacpp:' + metric, 'start': start_time, 'end': end_time, 'step': 2})

with open(f"{metric}.json", 'w') as metric_json:
metric_json.write(resp.text)

if resp.status_code != 200:
print(f"bench: unable to extract prometheus metric {metric}: {resp.text}")
else:
Expand All @@ -131,6 +136,8 @@ def main(args_in: list[str] | None = None) -> None:
f"parallel={args.parallel} ctx-size={args.ctx_size} ngl={args.n_gpu_layers} batch-size={args.batch_size} ubatch-size={args.ubatch_size}\n"
f"pp={args.max_prompt_tokens} pp+tg={args.max_tokens}\n"
f"branch={args.branch} commit={args.commit}", fontsize=14, wrap=True)
plt.gca().xaxis.set_major_locator(matplotlib.dates.MinuteLocator())
plt.gca().xaxis.set_major_formatter(matplotlib.dates.DateFormatter("%Y%m%d %H:%M:%S"))
plt.gcf().autofmt_xdate()

# Remove borders
Expand Down

0 comments on commit a3353bb

Please sign in to comment.