Skip to content

Commit

Permalink
Merge branch 'main' into zhiwei/int4pack
Browse files Browse the repository at this point in the history
  • Loading branch information
PenghuiCheng authored Dec 25, 2024
2 parents b0ff637 + 0f48ac0 commit d9cf90e
Show file tree
Hide file tree
Showing 31 changed files with 1,809 additions and 44 deletions.
3 changes: 1 addition & 2 deletions .github/scripts/apply_torch_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
# Fallback to CPU for XPU FP64
"https://github.com/pytorch/pytorch/pull/126516",
# Modify the tolerance level in TIMM benchmark
# "https://github.com/pytorch/pytorch/pull/129735",
"https://github.com/mengfei25/pytorch/pull/21",
"https://github.com/pytorch/pytorch/pull/143739",
]
)
parser.add_argument('--extra-pr-list', '-e', nargs='+',default=[])
Expand Down
2 changes: 2 additions & 0 deletions .github/scripts/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ if [ "$1" != "nightly_wheel" ];then
source /opt/intel/oneapi/compiler/latest/env/vars.sh
source /opt/intel/oneapi/umf/latest/env/vars.sh
source /opt/intel/oneapi/pti/latest/env/vars.sh
source /opt/intel/oneapi/ccl/latest/env/vars.sh
source /opt/intel/oneapi/mpi/latest/env/vars.sh
else
echo "Don't need to source DL-Essential for nightly wheel"
fi
80 changes: 80 additions & 0 deletions .github/scripts/inductor_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import pandas as pd
from scipy.stats import gmean
from styleframe import StyleFrame, Styler, utils
import numpy as np
from openpyxl import Workbook

parser = argparse.ArgumentParser(description="Generate report")
parser.add_argument('-s', '--suite', default=["huggingface"], nargs='*', type=str, help='model suite name')
Expand Down Expand Up @@ -665,6 +667,73 @@ def update_summary(excel, scenario, suite):
sf.set_row_height(j, 30)
sf.to_excel(sheet_name=suite + '_' + scenario + '_Summary', excel_writer=excel)

def summary_conclusion(scenario, excel):
excel.book.save(excel)
df = pd.read_excel(excel, sheet_name = None, header = None)
#df = pd.DataFrame(excel)
if scenario == 'performance':
sheet_names = list(df.keys())
sheet_names = [s for s in sheet_names if 'Summary' in s and 'performance' in s]
sheet_names.sort()
print(f"Merge excel as below:\n{sheet_names}")
print("\n")
features = [[]] * 21
for sheet_name in sheet_names:
df_sheet = df[sheet_name]
df_sheet = df_sheet.values
features = np.hstack((features, df_sheet))

if len(sheet_names) == 1:
print("sheet not merge")
elif len(sheet_names) == 2:
print("2 sheets merge")
if 'huggingface' in sheet_names[0]:
features[:, 4:5] = features[:, 14:15]
features[:, 6:7] = features[:, 16:17]
else:
features[:, 4:5] = features[:, 14:15]
else:
print("3 sheets merge")
features[:, 4:5] = features[:, 24:25]
features[:, 6:7] = features[:, 16:17]

df_concat = StyleFrame(pd.DataFrame(features).iloc[:,:10])
for i in range(10):
df_concat.set_column_width(i, 22)
for j in range(1, 23):
df_concat.set_row_height(j, 30)
df_concat.to_excel(sheet_name='Perf_Summary', excel_writer=excel, index=False)
else:
sheet_names = list(df.keys())
sheet_names = [s for s in sheet_names if 'Summary' in s and 'accuracy' in s]
sheet_names.sort()
print(f"Merge excel as below:\n{sheet_names}")
print("\n")
features = [[]] * 11
for sheet_name in sheet_names:
df_sheet = df[sheet_name]
df_sheet = df_sheet.values
features = np.hstack((features, df_sheet))
if len(sheet_names) == 1:
print("sheet not merge")
elif len(sheet_names) == 2:
print("2 sheets merge")
if 'huggingface' in sheet_names[0]:
features[:, 3:4] = features[:, 12:13]
features[:, 5:6] = features[:, 14:15]
else:
features[:, 3:4] = features[:, 12:13]
else:
print("3 sheets merge")
features[:, 3:4] = features[:, 21:22]
features[:, 5:6] = features[:, 14:15]

df_concat = StyleFrame(pd.DataFrame(features).iloc[:,:9])
for i in range(10):
df_concat.set_column_width(i, 22)
for j in range(1, 13):
df_concat.set_row_height(j, 30)
df_concat.to_excel(sheet_name='Acc_Summary', excel_writer=excel, index=False)

def generate_report(excel, scenario_list, precision_list, mode_list, suite_list):
for sc in scenario_list:
Expand Down Expand Up @@ -693,8 +762,19 @@ def excel_postprocess(file, scenario, precison, mode, suite):
wdt.merge_cells(start_row=1, end_row=1, start_column=13, end_column=16)
wb.save(file)

if len(scenario) == 2:
wb.move_sheet("Perf_Summary", -(len(wb.worksheets)-1))
wb.move_sheet("Acc_Summary", -(len(wb.worksheets)-1))
elif len(scenario) == 1 and sc == 'accuracy':
wb.move_sheet("Acc_Summary", -(len(wb.worksheets)-1))
else:
wb.move_sheet("Perf_Summary", -(len(wb.worksheets)-1))


if __name__ == '__main__':
excel = StyleFrame.ExcelWriter('inductor_log/Inductor_E2E_Test_Report.xlsx')
generate_report(excel, args.scenario, args.precision, args.mode, args.suite)
for sc in args.scenario:
summary_conclusion(sc, excel)
excel_postprocess(excel, args.scenario, args.precision, args.mode, args.suite)
excel.close()
7 changes: 7 additions & 0 deletions .github/scripts/spec.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import torch

DEVICE_NAME = 'xpu'

MANUAL_SEED_FN = torch.xpu.manual_seed
EMPTY_CACHE_FN = torch.xpu.empty_cache
DEVICE_COUNT_FN = torch.xpu.device_count
Loading

0 comments on commit d9cf90e

Please sign in to comment.