not-lain commited on
Commit
1fd97ea
·
1 Parent(s): a85c46c

update task list populate code

Browse files
Files changed (2) hide show
  1. src/about.py +1 -1
  2. src/populate.py +15 -4
src/about.py CHANGED
@@ -14,7 +14,7 @@ class Tasks(Enum):
14
  # task_key in the json file, metric_key in the json file, name to display in the leaderboard
15
  task0 = Task("openai", "acc_norm", "OpenAi")
16
  task1 = Task("anthropic", "acc_norm", "Anthropic")
17
- task1 = Task("hf", "acc_norm", "HuggingFace")
18
 
19
  NUM_FEWSHOT = 0 # Change with your few shot
20
  # ---------------------------------------------------
 
14
  # task_key in the json file, metric_key in the json file, name to display in the leaderboard
15
  task0 = Task("openai", "acc_norm", "OpenAi")
16
  task1 = Task("anthropic", "acc_norm", "Anthropic")
17
+ task2 = Task("hf", "acc_norm", "HuggingFace")
18
 
19
  NUM_FEWSHOT = 0 # Change with your few shot
20
  # ---------------------------------------------------
src/populate.py CHANGED
@@ -30,8 +30,12 @@ def get_evaluation_queue_df(save_path: str, cols: list) -> list[pd.DataFrame]:
30
  for entry in entries:
31
  if ".json" in entry:
32
  file_path = os.path.join(save_path, entry)
33
- with open(file_path) as fp:
34
- data = json.load(fp)
 
 
 
 
35
 
36
  data[EvalQueueColumn.model.name] = make_clickable_model(data["model"])
37
  data[EvalQueueColumn.revision.name] = data.get("revision", "main")
@@ -42,8 +46,15 @@ def get_evaluation_queue_df(save_path: str, cols: list) -> list[pd.DataFrame]:
42
  sub_entries = [e for e in os.listdir(f"{save_path}/{entry}") if not e.startswith(".")]
43
  for sub_entry in sub_entries:
44
  file_path = os.path.join(save_path, entry, sub_entry)
45
- with open(file_path) as fp:
46
- data = json.load(fp)
 
 
 
 
 
 
 
47
 
48
  data[EvalQueueColumn.model.name] = make_clickable_model(data["model"])
49
  data[EvalQueueColumn.revision.name] = data.get("revision", "main")
 
30
  for entry in entries:
31
  if ".json" in entry:
32
  file_path = os.path.join(save_path, entry)
33
+ try:
34
+ with open(file_path, encoding='utf-8') as fp:
35
+ data = json.load(fp)
36
+ except UnicodeDecodeError as e:
37
+ print(f"Unicode decoding error in {file_path}: {e}")
38
+ continue
39
 
40
  data[EvalQueueColumn.model.name] = make_clickable_model(data["model"])
41
  data[EvalQueueColumn.revision.name] = data.get("revision", "main")
 
46
  sub_entries = [e for e in os.listdir(f"{save_path}/{entry}") if not e.startswith(".")]
47
  for sub_entry in sub_entries:
48
  file_path = os.path.join(save_path, entry, sub_entry)
49
+ try:
50
+ with open(file_path, encoding='utf-8') as fp:
51
+ data = json.load(fp)
52
+ except json.JSONDecodeError:
53
+ print(f"Error reading {file_path}")
54
+ continue
55
+ except UnicodeDecodeError as e:
56
+ print(f"Unicode decoding error in {file_path}: {e}")
57
+ continue
58
 
59
  data[EvalQueueColumn.model.name] = make_clickable_model(data["model"])
60
  data[EvalQueueColumn.revision.name] = data.get("revision", "main")