Skip to content
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

Missing JSON fields #835

Merged
merged 2 commits into from
Sep 25, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ async def benchmark(
await asyncio.gather(*tasks)


def save_json_results(args: argparse.Namespace, benchmark_result):
def save_json_results(args: argparse.Namespace, benchmark_result, server_metrics):
# Setup
start_dt_proto = Timestamp()
start_dt_proto.FromDatetime(args.start_datetime)
Expand All @@ -285,8 +285,9 @@ def save_json_results(args: argparse.Namespace, benchmark_result):
"num_prompts": args.num_prompts,
"request_rate": args.request_rate,
'server_metrics': {
**benchmark_result.get("metric_names", {})
}
**server_metrics.get("metric_names", {})
},
**benchmark_result
},
# dimensions values are strings
"dimensions": {
Expand All @@ -303,7 +304,7 @@ def save_json_results(args: argparse.Namespace, benchmark_result):
},
"summary_stats": {
"stats": {
**benchmark_result.get("metric_aliases", {})
**server_metrics.get("metric_aliases", {})
}
}
}
Expand Down Expand Up @@ -534,15 +535,11 @@ def main(args: argparse.Namespace):
)
benchmark_result['avg_output_len'] = avg_output_len

server_metrics = {}
if args.scrape_server_metrics:
server_metrics = print_metrics(metrics_to_scrape(args.backend), benchmark_time, args.backend)
benchmark_result = {
**benchmark_result,
**(server_metrics if server_metrics else {}),
}

if args.save_json_results:
save_json_results(args, benchmark_result)
save_json_results(args, benchmark_result, server_metrics)


if __name__ == "__main__":
Expand Down Expand Up @@ -672,4 +669,4 @@ def main(args: argparse.Namespace):
help="Whether to scrape server metrics.",
)
cmd_args = parser.parse_args()
main(cmd_args)
main(cmd_args)
Loading