Spaces:
Sleeping
Sleeping
zhimin-z
commited on
Commit
·
b868fb7
1
Parent(s):
9c5411c
refine
Browse files
msr.py
CHANGED
|
@@ -29,6 +29,7 @@ AGENTS_REPO = "SWE-Arena/bot_data"
|
|
| 29 |
AGENTS_REPO_LOCAL_PATH = os.path.expanduser("~/bot_data") # Local git clone path
|
| 30 |
DUCKDB_CACHE_FILE = "cache.duckdb"
|
| 31 |
GHARCHIVE_DATA_LOCAL_PATH = os.path.expanduser("~/gharchive/data")
|
|
|
|
| 32 |
LEADERBOARD_REPO = "SWE-Arena/leaderboard_data"
|
| 33 |
LEADERBOARD_TIME_FRAME_DAYS = 180
|
| 34 |
|
|
@@ -750,7 +751,6 @@ def save_leaderboard_data_to_hf(leaderboard_dict, monthly_metrics):
|
|
| 750 |
raise Exception("No HuggingFace token found")
|
| 751 |
|
| 752 |
api = HfApi(token=token)
|
| 753 |
-
filename = "swe-review.json"
|
| 754 |
|
| 755 |
combined_data = {
|
| 756 |
'last_updated': datetime.now(timezone.utc).isoformat(),
|
|
@@ -761,21 +761,21 @@ def save_leaderboard_data_to_hf(leaderboard_dict, monthly_metrics):
|
|
| 761 |
}
|
| 762 |
}
|
| 763 |
|
| 764 |
-
with open(
|
| 765 |
json.dump(combined_data, f, indent=2)
|
| 766 |
|
| 767 |
try:
|
| 768 |
upload_file_with_backoff(
|
| 769 |
api=api,
|
| 770 |
-
path_or_fileobj=
|
| 771 |
-
path_in_repo=
|
| 772 |
repo_id=LEADERBOARD_REPO,
|
| 773 |
repo_type="dataset"
|
| 774 |
)
|
| 775 |
return True
|
| 776 |
finally:
|
| 777 |
-
if os.path.exists(
|
| 778 |
-
os.remove(
|
| 779 |
|
| 780 |
except Exception as e:
|
| 781 |
print(f"Error saving leaderboard data: {str(e)}")
|
|
|
|
| 29 |
AGENTS_REPO_LOCAL_PATH = os.path.expanduser("~/bot_data") # Local git clone path
|
| 30 |
DUCKDB_CACHE_FILE = "cache.duckdb"
|
| 31 |
GHARCHIVE_DATA_LOCAL_PATH = os.path.expanduser("~/gharchive/data")
|
| 32 |
+
LEADERBOARD_FILENAME = f"{os.path.basename(os.getcwd())}.json"
|
| 33 |
LEADERBOARD_REPO = "SWE-Arena/leaderboard_data"
|
| 34 |
LEADERBOARD_TIME_FRAME_DAYS = 180
|
| 35 |
|
|
|
|
| 751 |
raise Exception("No HuggingFace token found")
|
| 752 |
|
| 753 |
api = HfApi(token=token)
|
|
|
|
| 754 |
|
| 755 |
combined_data = {
|
| 756 |
'last_updated': datetime.now(timezone.utc).isoformat(),
|
|
|
|
| 761 |
}
|
| 762 |
}
|
| 763 |
|
| 764 |
+
with open(LEADERBOARD_FILENAME, 'w') as f:
|
| 765 |
json.dump(combined_data, f, indent=2)
|
| 766 |
|
| 767 |
try:
|
| 768 |
upload_file_with_backoff(
|
| 769 |
api=api,
|
| 770 |
+
path_or_fileobj=LEADERBOARD_FILENAME,
|
| 771 |
+
path_in_repo=LEADERBOARD_FILENAME,
|
| 772 |
repo_id=LEADERBOARD_REPO,
|
| 773 |
repo_type="dataset"
|
| 774 |
)
|
| 775 |
return True
|
| 776 |
finally:
|
| 777 |
+
if os.path.exists(LEADERBOARD_FILENAME):
|
| 778 |
+
os.remove(LEADERBOARD_FILENAME)
|
| 779 |
|
| 780 |
except Exception as e:
|
| 781 |
print(f"Error saving leaderboard data: {str(e)}")
|