Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handling situations where Copilot Arena's Leaderboard is not set / un…
Browse files Browse the repository at this point in the history
…able to be built
waynchi committed Dec 19, 2024
1 parent 36f8591 commit 32cc477
Showing 2 changed files with 15 additions and 9 deletions.
3 changes: 3 additions & 0 deletions fastchat/serve/monitor/copilot_arena.py
Original file line number Diff line number Diff line change
@@ -41,6 +41,9 @@ def process_copilot_arena_leaderboard(leaderboard):


def build_copilot_arena_tab():
if copilot_arena_leaderboard_url is None:
print("Copilot Arena Leaderboard URL is not set. Skipping this leaderboard.")
return
response = requests.get(copilot_arena_leaderboard_url)
if response.status_code == 200:
leaderboard = pd.DataFrame(response.json()["elo_data"])
21 changes: 12 additions & 9 deletions fastchat/serve/monitor/monitor.py
Original file line number Diff line number Diff line change
@@ -388,9 +388,7 @@ def highlight_rank_max(s):
(
"color: green; font-weight: bold"
if v > 0
else "color: red; font-weight: bold"
if v < 0
else ""
else "color: red; font-weight: bold" if v < 0 else ""
)
for v in s
]
@@ -493,9 +491,9 @@ def update_leaderboard_and_plots(category, filters):
arena_values = get_arena_table(
arena_df,
model_table_df,
arena_subset_df=arena_subset_df
if category != "Overall"
else arena_overall_sc_df,
arena_subset_df=(
arena_subset_df if category != "Overall" else arena_overall_sc_df
),
hidden_models=(
None
if len(filters) > 0 and "Show Deprecated" in filters
@@ -1052,10 +1050,15 @@ def build_leaderboard_tab(
build_full_leaderboard_tab(
elo_results_text, model_table_df, model_to_score
)
with gr.Tab("Copilot Arena Leaderboard", id=5):
from fastchat.serve.monitor.copilot_arena import build_copilot_arena_tab
try:
with gr.Tab("Copilot Arena Leaderboard", id=5):
from fastchat.serve.monitor.copilot_arena import (
build_copilot_arena_tab,
)

build_copilot_arena_tab()
build_copilot_arena_tab()
except Exception as e:
print(f"Unable to build Copilot Arena's Leaderboard. Error: {e}")

if not show_plot:
gr.Markdown(

0 comments on commit 32cc477

Please sign in to comment.