Corey Morris commited on
Commit
903d653
·
1 Parent(s): df074bd

columns named by files

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -8,6 +8,10 @@ import requests
8
  FILE_URL_1 = "https://raw.githubusercontent.com/EleutherAI/lm-evaluation-harness/master/results/llama/llama-30B/llama-30B_mmlu_5-shot.json"
9
  FILE_URL_2 = "https://raw.githubusercontent.com/EleutherAI/lm-evaluation-harness/master/results/llama/llama-13B/llama-13B_mmlu_5-shot.json"
10
 
 
 
 
 
11
  # Load data from both URLs
12
  response1 = requests.get(FILE_URL_1)
13
  data1 = response1.json()
@@ -19,11 +23,15 @@ data1_df = pd.DataFrame(data1['results']).T
19
  data2_df = pd.DataFrame(data2['results']).T
20
 
21
  # Rename 'acc' column to respective file names
22
- data1_df = data1_df.rename(columns={'acc': 'acc_file_1'})
23
- data2_df = data2_df.rename(columns={'acc': 'acc_file_2'})
 
 
 
 
24
 
25
  # Merge the dataframes on index (Here index is the sub-test names)
26
- data = pd.merge(data1_df['acc_file_1'], data2_df['acc_file_2'], left_index=True, right_index=True)
27
 
28
  def show_leaderboard():
29
  # Convert dataframe to html so that it can be displayed properly in Gradio
 
8
  FILE_URL_1 = "https://raw.githubusercontent.com/EleutherAI/lm-evaluation-harness/master/results/llama/llama-30B/llama-30B_mmlu_5-shot.json"
9
  FILE_URL_2 = "https://raw.githubusercontent.com/EleutherAI/lm-evaluation-harness/master/results/llama/llama-13B/llama-13B_mmlu_5-shot.json"
10
 
11
+ # Derive column names from the URLs
12
+ column_name_1 = FILE_URL_1.split('/')[-1].split('_')[0] # 'llama-30B'
13
+ column_name_2 = FILE_URL_2.split('/')[-1].split('_')[0] # 'llama-13B'
14
+
15
  # Load data from both URLs
16
  response1 = requests.get(FILE_URL_1)
17
  data1 = response1.json()
 
23
  data2_df = pd.DataFrame(data2['results']).T
24
 
25
  # Rename 'acc' column to respective file names
26
+ data1_df = data1_df.rename(columns={'acc': column_name_1})
27
+ data2_df = data2_df.rename(columns={'acc': column_name_2})
28
+
29
+ # Remove 'hendrycksTest-' from the index of both dataframes
30
+ data1_df.index = data1_df.index.str.replace('hendrycksTest-', '')
31
+ data2_df.index = data2_df.index.str.replace('hendrycksTest-', '')
32
 
33
  # Merge the dataframes on index (Here index is the sub-test names)
34
+ data = pd.merge(data1_df[column_name_1], data2_df[column_name_2], left_index=True, right_index=True)
35
 
36
  def show_leaderboard():
37
  # Convert dataframe to html so that it can be displayed properly in Gradio