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 7, 2023
1 parent 422b632 commit ff9f67a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def ptq_quant_models(df, args):
acc_diff = np.around(top1 - fp_accuracy, decimals=3)
acc_ratio = np.around(top1 / fp_accuracy, decimals=3)

df.at[k, :] = [
df.loc[k] = [
model_name,
bias_corr,
fp_accuracy,
Expand Down
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 ff9f67a

Please sign in to comment.