From 03aa368776d05d4cba34b0f5bb8b5fa0ba25c0ca Mon Sep 17 00:00:00 2001 From: WeiguangHan Date: Wed, 1 Nov 2023 09:53:02 +0800 Subject: [PATCH] LLM: add the comparison between latest arc perf test and last one (#9296) * add the comparison between latest test and last one to html * resolve some comments * modify some code logics --- .github/workflows/llm_performance_tests.yml | 4 ++-- python/llm/test/benchmark/csv_to_html.py | 24 +++++++++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.github/workflows/llm_performance_tests.yml b/.github/workflows/llm_performance_tests.yml index 755450c9..a4c0aad0 100644 --- a/.github/workflows/llm_performance_tests.yml +++ b/.github/workflows/llm_performance_tests.yml @@ -131,6 +131,6 @@ jobs: export https_proxy=${HTTPS_PROXY} python run.py curl -T ./*.csv ${LLM_FTP_URL}/llm/ggml-actions/perf/ + cp ./*.csv /mnt/disk1/nightly_perf/ cd ../../../test/benchmark - python csv_to_html.py -f ../../dev/benchmark/all-in-one - cp ./*.html /mnt/disk1/nightly_perf/ + python csv_to_html.py -f /mnt/disk1/nightly_perf/ diff --git a/python/llm/test/benchmark/csv_to_html.py b/python/llm/test/benchmark/csv_to_html.py index bc61fd5b..e25c9f70 100644 --- a/python/llm/test/benchmark/csv_to_html.py +++ b/python/llm/test/benchmark/csv_to_html.py @@ -24,7 +24,7 @@ import pandas as pd def main(): parser = argparse.ArgumentParser(description="convert .csv file to .html file") parser.add_argument("-f", "--folder_path", type=str, dest="folder_path", - help="The directory which stores the .csv file", default="../../dev/benchmark/all-in-one") + help="The directory which stores the .csv file", default="/mnt/disk1/nightly_perf/") args = parser.parse_args() csv_files = [] @@ -32,8 +32,28 @@ def main(): file_path = os.path.join(args.folder_path, file_name) if os.path.isfile(file_path) and file_name.endswith(".csv"): csv_files.append(file_path) + csv_files.sort(reverse=True) - a = pd.read_csv(csv_files[0], index_col=0).to_html(csv_files[0].split("/")[-1].split(".")[0]+".html") + data1 = pd.read_csv(csv_files[0], index_col=0) + + if len(csv_files)>1: + data2 = pd.read_csv(csv_files[1], index_col=0) + + origin_column_1='1st token avg latency (ms)' + origin_column_2='2+ avg latency (ms/token)' + + added_column_1='last1' + added_column_2='diff1(%)' + added_column_3='last2' + added_column_4='diff2(%)' + + data1.insert(loc=3,column=added_column_1,value=data2[origin_column_1]) + data1.insert(loc=4,column=added_column_2,value=round((data2[origin_column_1]-data1[origin_column_1])*100/data2[origin_column_1],2)) + data1.insert(loc=5,column=added_column_3,value=data2[origin_column_2]) + data1.insert(loc=6,column=added_column_4,value=round((data2[origin_column_2]-data1[origin_column_2])*100/data2[origin_column_2],2)) + + daily_html=csv_files[0].split(".")[0]+".html" + data1.to_html(daily_html) if __name__ == "__main__": sys.exit(main()) \ No newline at end of file