Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions langtest/utils/benchmark_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,7 @@ def __init__(self, path: str, *args, **kwargs) -> None:
self.save_dir = path
self.file_path = f"{path}summary.csv"

self.summary_df: pd.DataFrame = self.load_data_from_file(
self.file_path, *args, **kwargs
)
self.summary_df: pd.DataFrame = self.__update_summary_df()

def load_data_from_file(self, path: str, *args, **kwargs) -> pd.DataFrame:
"""
Expand Down Expand Up @@ -242,6 +240,8 @@ def add_report(
"""
Add a new report to the summary
"""
# Load and Update the summary dataframe
self.summary_df = self.__update_summary_df()

from datetime import datetime

Expand Down Expand Up @@ -328,3 +328,12 @@ def __group_by_cols(self):
@property
def df(self) -> pd.DataFrame:
return self.summary_df

def __update_summary_df(self):
"""
Update the summary dataframe
"""
if self.file_path.startswith("~"):
self.file_path = os.path.expanduser(self.file_path)
self.summary_df = self.load_data_from_file(self.file_path)
return self.summary_df