LLM: change the color of peak diff (#9836)
This commit is contained in:
parent
38c05be1c0
commit
ad6b182916
1 changed files with 10 additions and 6 deletions
|
|
@ -21,12 +21,12 @@ import sys
|
||||||
import argparse
|
import argparse
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
def highlight_vals(val, max=3.0):
|
def highlight_vals(val, max=3.0, color1='red', color2='green'):
|
||||||
if isinstance(val, float):
|
if isinstance(val, float):
|
||||||
if val > max:
|
if val > max:
|
||||||
return 'background-color: %s' % 'green'
|
return 'background-color: %s' % color2
|
||||||
elif val <= -max:
|
elif val <= -max:
|
||||||
return 'background-color: %s' % 'red'
|
return 'background-color: %s' % color1
|
||||||
else:
|
else:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
@ -153,14 +153,18 @@ def main():
|
||||||
|
|
||||||
diffs_within_normal_range = is_diffs_within_normal_range(diff1, diff2, threshold=highlight_threshold)
|
diffs_within_normal_range = is_diffs_within_normal_range(diff1, diff2, threshold=highlight_threshold)
|
||||||
|
|
||||||
subset=['diff1(%)','diff2(%)','best diff1(%)','best diff2(%)']
|
subset1=['diff1(%)','diff2(%)']
|
||||||
|
subset2=['best diff1(%)','best diff2(%)']
|
||||||
columns={'1st token avg latency (ms)': '{:.2f}', '2+ avg latency (ms/token)': '{:.2f}', 'last1': '{:.2f}', 'diff1(%)': '{:.2f}',
|
columns={'1st token avg latency (ms)': '{:.2f}', '2+ avg latency (ms/token)': '{:.2f}', 'last1': '{:.2f}', 'diff1(%)': '{:.2f}',
|
||||||
'last2': '{:.2f}', 'diff2(%)': '{:.2f}', 'encoder time (ms)': '{:.2f}', 'peak mem (GB)': '{:.2f}',
|
'last2': '{:.2f}', 'diff2(%)': '{:.2f}', 'encoder time (ms)': '{:.2f}', 'peak mem (GB)': '{:.2f}',
|
||||||
'best 1': '{:.2f}', 'best diff1(%)': '{:.2f}', 'best 2': '{:.2f}', 'best diff2(%)': '{:.2f}'}
|
'best 1': '{:.2f}', 'best diff1(%)': '{:.2f}', 'best 2': '{:.2f}', 'best diff2(%)': '{:.2f}'}
|
||||||
|
|
||||||
|
styled_df = latest_csv.style.format(columns).applymap(lambda val: highlight_vals(val, max=3.0, color1='red', color2='green'), subset=subset1)
|
||||||
|
styled_df = styled_df.applymap(lambda val: highlight_vals(val, max=3.0, color1='yellow'), subset=subset2)
|
||||||
|
html_output = styled_df.set_table_attributes("border=1").render()
|
||||||
|
|
||||||
with open(daily_html, 'w') as f:
|
with open(daily_html, 'w') as f:
|
||||||
f.write(latest_csv.style.format(columns).applymap(lambda val: highlight_vals(val, max=highlight_threshold), subset)
|
f.write(html_output)
|
||||||
.set_table_attributes("border=1").render())
|
|
||||||
else:
|
else:
|
||||||
latest_csv.to_html(daily_html)
|
latest_csv.to_html(daily_html)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue