Corey Morris commited on
Commit
1b89da7
1 Parent(s): 546eedf

reading in file urls from a file. Added additional data sources

Browse files
Files changed (2) hide show
  1. app.py +22 -23
  2. file_urls.txt +12 -0
app.py CHANGED
@@ -4,39 +4,38 @@ import numpy as np
4
  import json
5
  import requests
6
 
7
- # URLs for the two JSON files
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()
18
- response2 = requests.get(FILE_URL_2)
19
- data2 = response2.json()
20
 
21
- # Convert data from both URLs into DataFrames
22
- data1_df = pd.DataFrame(data1['results']).T
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
  # Transpose the dataframe to swap rows and columns
37
  data = data.transpose()
38
 
39
- # select only columns moral_scenarios and moral_disputes
40
  data = data[['moral_scenarios', 'moral_disputes']]
41
 
42
  def show_leaderboard():
 
4
  import json
5
  import requests
6
 
7
+ # Read URLs from a file, one per line
8
+ with open('file_urls.txt', 'r') as f:
9
+ file_urls = [line.strip() for line in f.readlines()]
10
 
11
+ dataframes = []
 
 
12
 
13
+ for url in file_urls:
14
+ # Derive column names from the URLs
15
+ column_name = url.split('/')[-1].split('_')[0]
 
 
16
 
17
+ # Load data from URL
18
+ response = requests.get(url)
19
+ data = response.json()
20
 
21
+ # Convert data into a DataFrame
22
+ df = pd.DataFrame(data['results']).T
 
23
 
24
+ # Rename 'acc' column to respective file names
25
+ df = df.rename(columns={'acc': column_name})
 
26
 
27
+ # Remove 'hendrycksTest-' from the index
28
+ df.index = df.index.str.replace('hendrycksTest-', '')
29
+
30
+ dataframes.append(df[[column_name]]) # keep only the column of interest
31
+
32
+ # Merge the dataframes on index
33
+ data = pd.concat(dataframes, axis=1)
34
 
35
  # Transpose the dataframe to swap rows and columns
36
  data = data.transpose()
37
 
38
+ # Select only columns 'moral_scenarios' and 'moral_disputes'
39
  data = data[['moral_scenarios', 'moral_disputes']]
40
 
41
  def show_leaderboard():
file_urls.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ https://raw.githubusercontent.com/EleutherAI/lm-evaluation-harness/master/results/llama/llama-30B/llama-30B_mmlu_5-shot.json
2
+ https://raw.githubusercontent.com/EleutherAI/lm-evaluation-harness/master/results/llama/llama-13B/llama-13B_mmlu_5-shot.json
3
+ https://raw.githubusercontent.com/EleutherAI/lm-evaluation-harness/master/results/llama/llama-7B/llama-7B_mmlu_5-shot.json
4
+ https://raw.githubusercontent.com/EleutherAI/lm-evaluation-harness/master/results/mpt/mpt-7b/mpt-7b_mmlu_5-shot.json
5
+ https://raw.githubusercontent.com/EleutherAI/lm-evaluation-harness/master/results/opt/opt-66b/opt-66b.json
6
+ https://raw.githubusercontent.com/EleutherAI/lm-evaluation-harness/master/results/opt/opt-6.7b/opt-6.7b.json
7
+ https://raw.githubusercontent.com/EleutherAI/lm-evaluation-harness/master/results/opt/opt-350m/opt-350m.json
8
+ https://raw.githubusercontent.com/EleutherAI/lm-evaluation-harness/master/results/opt/opt-30b/opt-30b.json
9
+ https://raw.githubusercontent.com/EleutherAI/lm-evaluation-harness/master/results/opt/opt-2.7b/opt-2.7b.json
10
+ https://raw.githubusercontent.com/EleutherAI/lm-evaluation-harness/master/results/opt/opt-13b/opt-13b.json
11
+ https://raw.githubusercontent.com/EleutherAI/lm-evaluation-harness/master/results/opt/opt-125m/opt-125m.json
12
+ https://raw.githubusercontent.com/EleutherAI/lm-evaluation-harness/master/results/opt/opt-1.3b/opt-1.3b.json