mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 09:14:59 +00:00
Refactored plot_swe_bench_lite function to dynamically handle file names and titles.
This commit is contained in:
parent
aa1e34982d
commit
4d02a8aa58
1 changed files with 17 additions and 7 deletions
|
@ -1,7 +1,8 @@
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from imgcat import imgcat
|
from imgcat import imgcat
|
||||||
from matplotlib import rc
|
from matplotlib import rc
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
def plot_swe_bench_lite(data_file):
|
def plot_swe_bench_lite(data_file):
|
||||||
with open(data_file, "r") as file:
|
with open(data_file, "r") as file:
|
||||||
|
@ -41,7 +42,10 @@ def plot_swe_bench_lite(data_file):
|
||||||
bars = []
|
bars = []
|
||||||
for model, pass_rate, color in zip(models, pass_rates, colors):
|
for model, pass_rate, color in zip(models, pass_rates, colors):
|
||||||
alpha = 0.9 if "Aider" in model else 0.3
|
alpha = 0.9 if "Aider" in model else 0.3
|
||||||
bar = ax.bar(model, pass_rate, color=color, alpha=alpha, zorder=3)
|
hatch = ""
|
||||||
|
#if "lite" not in data_file:
|
||||||
|
# hatch = "///" if "(570)" in model else ""
|
||||||
|
bar = ax.bar(model, pass_rate, color=color, alpha=alpha, zorder=3, hatch=hatch)
|
||||||
bars.append(bar[0])
|
bars.append(bar[0])
|
||||||
|
|
||||||
for model, bar in zip(models, bars):
|
for model, bar in zip(models, bars):
|
||||||
|
@ -63,18 +67,24 @@ def plot_swe_bench_lite(data_file):
|
||||||
|
|
||||||
# ax.set_xlabel("Models", fontsize=18)
|
# ax.set_xlabel("Models", fontsize=18)
|
||||||
ax.set_ylabel("Instances resolved (%)", fontsize=18, color=font_color)
|
ax.set_ylabel("Instances resolved (%)", fontsize=18, color=font_color)
|
||||||
ax.set_title("SWE Bench Lite", fontsize=20)
|
if "lite" in data_file:
|
||||||
|
title = "SWE Bench Lite"
|
||||||
|
else:
|
||||||
|
title = "SWE Bench"
|
||||||
|
ax.set_title(title, fontsize=20)
|
||||||
# ax.set_ylim(0, 29.9)
|
# ax.set_ylim(0, 29.9)
|
||||||
plt.xticks(
|
plt.xticks(
|
||||||
fontsize=16,
|
fontsize=16,
|
||||||
color=font_color,
|
color=font_color,
|
||||||
)
|
)
|
||||||
plt.tight_layout(pad=3.0)
|
plt.tight_layout(pad=3.0)
|
||||||
plt.savefig("swe_bench_lite.jpg")
|
|
||||||
plt.savefig("swe_bench_lite.svg")
|
out_fname = Path(data_file)
|
||||||
|
plt.savefig(out_fname.with_suffix(".jpg").name)
|
||||||
|
plt.savefig(out_fname.with_suffix(".svg").name)
|
||||||
imgcat(fig)
|
imgcat(fig)
|
||||||
ax.xaxis.label.set_color(font_color)
|
ax.xaxis.label.set_color(font_color)
|
||||||
|
|
||||||
|
|
||||||
# Example usage
|
fname = sys.argv[1]
|
||||||
plot_swe_bench_lite("benchmark/swe-bench-lite.txt")
|
plot_swe_bench_lite(fname)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue