LLM: using html to visualize the perf result for Arc (#9228)
* LLM: using html to visualize the perf result for Arc * deploy the html file * add python license * reslove some comments
This commit is contained in:
		
							parent
							
								
									90162264a3
								
							
						
					
					
						commit
						ec9195da42
					
				
					 3 changed files with 47 additions and 5 deletions
				
			
		
							
								
								
									
										5
									
								
								.github/workflows/llm_performance_tests.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								.github/workflows/llm_performance_tests.yml
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -127,5 +127,8 @@ jobs:
 | 
			
		|||
          cd python/llm/dev/benchmark/all-in-one
 | 
			
		||||
          export http_proxy=${HTTP_PROXY}
 | 
			
		||||
          export https_proxy=${HTTPS_PROXY}
 | 
			
		||||
          taskset -c 0-$((THREAD_NUM - 1)) python run.py
 | 
			
		||||
          python run.py
 | 
			
		||||
          curl -T ./*.csv ${LLM_FTP_URL}/llm/ggml-actions/perf/
 | 
			
		||||
          cd ../../../test/benchmark
 | 
			
		||||
          python csv_to_html.py -f ../../dev/benchmark/all-in-one
 | 
			
		||||
          cp ./*.html /mnt/disk1/nightly_perf/
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,9 +59,9 @@ def run_model(repo_id, test_api, in_out_pairs, local_model_hub=None, warm_up=1,
 | 
			
		|||
    for in_out_pair in in_out_pairs:
 | 
			
		||||
        if result:
 | 
			
		||||
            results.append([repo_id,
 | 
			
		||||
                            np.mean(result[in_out_pair], axis=0)[0],
 | 
			
		||||
                            np.mean(result[in_out_pair], axis=0)[1],
 | 
			
		||||
                            np.mean(result[in_out_pair], axis=0)[2],
 | 
			
		||||
                            round(np.mean(result[in_out_pair], axis=0)[0]*1000.0, 2),
 | 
			
		||||
                            round(np.mean(result[in_out_pair], axis=0)[1]*1000.0, 2),
 | 
			
		||||
                            round(np.mean(result[in_out_pair], axis=0)[2]*1000.0, 2),
 | 
			
		||||
                            in_out_pair,
 | 
			
		||||
                            f'{int(np.mean(result[in_out_pair], axis=0)[3])}' +
 | 
			
		||||
                            f'-{int(np.mean(result[in_out_pair], axis=0)[4])}',
 | 
			
		||||
| 
						 | 
				
			
			@ -545,7 +545,7 @@ if __name__ == '__main__':
 | 
			
		|||
    for api in conf.test_api:
 | 
			
		||||
        for model in conf.repo_id:
 | 
			
		||||
            run_model(model, api, conf['in_out_pairs'], conf['local_model_hub'], conf['warm_up'], conf['num_trials'], conf['num_beams'])
 | 
			
		||||
        df = pd.DataFrame(results, columns=['model', '1st token avg latency (s)', '2+ avg latency (s/token)', 'encoder time (s)',
 | 
			
		||||
        df = pd.DataFrame(results, columns=['model', '1st token avg latency (ms)', '2+ avg latency (ms/token)', 'encoder time (ms)',
 | 
			
		||||
                                            'input/output tokens', 'actual input/output tokens', 'num_beams'])
 | 
			
		||||
        df.to_csv(f'{current_dir}/{api}-results-{today}.csv')
 | 
			
		||||
        results = []
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										39
									
								
								python/llm/test/benchmark/csv_to_html.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								python/llm/test/benchmark/csv_to_html.py
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,39 @@
 | 
			
		|||
#
 | 
			
		||||
# Copyright 2016 The BigDL Authors.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
# You may obtain a copy of the License at
 | 
			
		||||
#
 | 
			
		||||
#     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
#
 | 
			
		||||
# Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
# distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
# See the License for the specific language governing permissions and
 | 
			
		||||
# limitations under the License.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# Python program to convert CSV to HTML Table
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
import sys
 | 
			
		||||
import argparse
 | 
			
		||||
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")
 | 
			
		||||
    args = parser.parse_args()
 | 
			
		||||
 | 
			
		||||
    csv_files = []
 | 
			
		||||
    for file_name in os.listdir(args.folder_path):
 | 
			
		||||
        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)
 | 
			
		||||
 | 
			
		||||
    a = pd.read_csv(csv_files[0], index_col=0).to_html(csv_files[0].split("/")[-1].split(".")[0]+".html")
 | 
			
		||||
 | 
			
		||||
if __name__ == "__main__":
 | 
			
		||||
    sys.exit(main())
 | 
			
		||||
		Loading…
	
		Reference in a new issue