Joschka Strueber commited on
Commit
047f32f
·
1 Parent(s): 93d753c

[Fix, Add] check for #api calls, bug in warning

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. src/dataloading.py +4 -0
app.py CHANGED
@@ -29,7 +29,7 @@ def create_heatmap(selected_models, selected_dataset, selected_metric):
29
  failed_models.append(selected_models[i])
30
 
31
  if failed_models:
32
- gr.Warning(f"Failed to load data for models: {'\n'.join(failed_models)}")
33
 
34
  # Create figure and heatmap using seaborn
35
  plt.figure(figsize=(8, 6))
 
29
  failed_models.append(selected_models[i])
30
 
31
  if failed_models:
32
+ gr.Warning(f"Failed to load data for models: {', '.join(failed_models)}")
33
 
34
  # Create figure and heatmap using seaborn
35
  plt.figure(figsize=(8, 6))
src/dataloading.py CHANGED
@@ -16,6 +16,7 @@ def get_leaderboard_models():
16
  dataset_list = api.list_datasets(author="open-llm-leaderboard")
17
 
18
  models = []
 
19
  for dataset in dataset_list:
20
  if dataset.id.endswith("-details"):
21
  # Format: "open-llm-leaderboard/<provider>__<model_name>-details"
@@ -29,6 +30,7 @@ def get_leaderboard_models():
29
  # Only perform the check if dataset_id is not in the ungated_models list.
30
  if model_name not in ungated_models:
31
  try:
 
32
  # Check if the dataset can be loaded; if not, skip it.
33
  datasets.get_dataset_config_names(model_name)
34
  except Exception as e:
@@ -36,6 +38,8 @@ def get_leaderboard_models():
36
 
37
  models.append(model_name)
38
 
 
 
39
  # Save model list as txt file
40
  with open("models.txt", "w") as f:
41
  for model in models:
 
16
  dataset_list = api.list_datasets(author="open-llm-leaderboard")
17
 
18
  models = []
19
+ count_api_calls = 0
20
  for dataset in dataset_list:
21
  if dataset.id.endswith("-details"):
22
  # Format: "open-llm-leaderboard/<provider>__<model_name>-details"
 
30
  # Only perform the check if dataset_id is not in the ungated_models list.
31
  if model_name not in ungated_models:
32
  try:
33
+ count_api_calls += 1
34
  # Check if the dataset can be loaded; if not, skip it.
35
  datasets.get_dataset_config_names(model_name)
36
  except Exception as e:
 
38
 
39
  models.append(model_name)
40
 
41
+ print(f"API calls: {count_api_calls}")
42
+
43
  # Save model list as txt file
44
  with open("models.txt", "w") as f:
45
  for model in models: