Skip to content

Commit

Permalink
Fix (ptq/benchmark): better dataframe creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Giuseppe5 committed Dec 4, 2023
1 parent 652ca8e commit e36faa4
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,18 +270,16 @@ def ptq_torchvision_models(args):
acc_diff = np.around(top1 - fp_accuracy, decimals=3)
acc_ratio = np.around(top1 / fp_accuracy, decimals=3)

options_names = [k.replace('_', ' ').capitalize() for k in config_namespace.__dict__.keys()]
torchvision_df = pd.DataFrame(
columns=options_names + [
'Top 1% floating point accuracy',
'Top 1% quant accuracy',
'Floating point accuracy - quant accuracy',
'Quant accuracy / floating point accuracy',
'Calibration size',
'Calibration batch size',
'Torch version',
'Brevitas version'])
torchvision_df.at[0, :] = [v for _, v in config_namespace.__dict__.items()] + [
column_names = [k.replace('_', ' ').capitalize() for k in config_namespace.__dict__.keys()] + [
'Top 1% floating point accuracy',
'Top 1% quant accuracy',
'Floating point accuracy - quant accuracy',
'Quant accuracy / floating point accuracy',
'Calibration size',
'Calibration batch size',
'Torch version',
'Brevitas version']
values = [v for _, v in config_namespace.__dict__.items()] + [
fp_accuracy,
top1,
acc_diff,
Expand All @@ -290,6 +288,8 @@ def ptq_torchvision_models(args):
args.batch_size_calibration,
torch_version,
brevitas_version]
torchvision_df = pd.DataFrame([values], columns=column_names)

folder = './multirun/' + str(args.idx)
os.makedirs(folder, exist_ok=True)
torchvision_df.to_csv(os.path.join(folder, 'RESULTS_TORCHVISION.csv'), index=False)
Expand Down

0 comments on commit e36faa4

Please sign in to comment.