Skip to content

Commit

Permalink
minor updates:
Browse files Browse the repository at this point in the history
- add script to convert resnet best results to latex table
- formatting to make ruff happy

(cherry picked from commit f69f725)
  • Loading branch information
plutonium-239 committed Aug 22, 2024
1 parent 8eed547 commit 22957d9
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions experiments/resnet_best_results_to_latex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""Simple script to make a latex table from resnet results"""

import pandas as pd

df = pd.read_csv("results/resnet101_only/best_results-conv-cpu-usage_stats.csv")
df = df.set_index("model")
df = df.drop(columns=["Scaled M", "Scaled T"])
df = df.drop("memsave_resnet101_conv+relu+bn")
df = df[df["case"] != "SurgicalLast"]
df = df[df["case"] != "Conv"]

mem_div = df[df["case"] == "All"].loc["resnet101", "Memory Usage (GB)"]
time_div = df[df["case"] == "All"].loc["resnet101", "Time Taken (s)"]
df["Scaled M"] = df["Memory Usage (GB)"] / mem_div
df["Scaled T"] = df["Time Taken (s)"] / time_div

df["Memory [GiB]"] = df.apply(
lambda x: f"{x['Memory Usage (GB)']:.2f} ({x['Scaled M']:.2f})", axis=1
)
df["Time [s]"] = df.apply(
lambda x: f"{x['Time Taken (s)']:.2f} ({x['Scaled T']:.2f})", axis=1
)

df = df.drop(columns=["Scaled M", "Scaled T", "Memory Usage (GB)", "Time Taken (s)"])
df_p = df.pivot_table(
index="model", columns="case", values=df.columns[1:], aggfunc=lambda x: x
)

labels = {
"resnet101": "Default ResNet-101",
"memsave_resnet101_conv": "+ swap Convolution",
"memsave_resnet101_conv_full": "+ swap BatchNorm, ReLU",
}

df_p = df_p.rename(index=labels)
df_p = df_p.sort_index(ascending=False)

print(df_p["Memory [GiB]"].to_latex())
print(df_p["Time [s]"].to_latex())

0 comments on commit 22957d9

Please sign in to comment.