mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 06:15:00 +00:00

# Aider chat conversation: USER: I ran this command: python benchmark/over_time.py And got this output: Traceback (most recent call last): File "/Users/gauthier/Projects/aider/benchmark/over_time.py", line 33, in <module> plot_over_time('_data/edit_leaderboard.yml') File "/Users/gauthier/Projects/aider/benchmark/over_time.py", line 15, in plot_over_time dates.append(datetime.strptime(entry['released'], '%Y-%m-%d')) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: strptime() argument 1 must be str, not datetime.date ASSISTANT: The error indicates that the `released` field in the YAML file is already a `datetime.date` object, so we don't need to parse it with `datetime.strptime`. We can directly use it in the plot. Here are the changes: benchmark/over_time.py ```python <<<<<<< SEARCH dates.append(datetime.strptime(entry['released'], '%Y-%m-%d')) ======= dates.append(entry['released']) >>>>>>> REPLACE ```
33 lines
888 B
Python
33 lines
888 B
Python
import matplotlib.pyplot as plt
|
|
import yaml
|
|
from datetime import datetime
|
|
|
|
def plot_over_time(yaml_file):
|
|
with open(yaml_file, 'r') as file:
|
|
data = yaml.safe_load(file)
|
|
|
|
dates = []
|
|
pass_rates = []
|
|
models = []
|
|
|
|
for entry in data:
|
|
if 'released' in entry and 'pass_rate_2' in entry:
|
|
dates.append(entry['released'])
|
|
pass_rates.append(entry['pass_rate_2'])
|
|
models.append(entry['model'])
|
|
|
|
plt.figure(figsize=(10, 6))
|
|
plt.scatter(dates, pass_rates, c='blue', alpha=0.5)
|
|
|
|
for i, model in enumerate(models):
|
|
plt.annotate(model, (dates[i], pass_rates[i]), fontsize=8, alpha=0.75)
|
|
|
|
plt.xlabel('Release Date')
|
|
plt.ylabel('Pass Rate 2')
|
|
plt.title('Model Performance Over Time')
|
|
plt.grid(True)
|
|
plt.tight_layout()
|
|
plt.show()
|
|
|
|
# Example usage
|
|
plot_over_time('_data/edit_leaderboard.yml')
|