hi-melnikov commited on
Commit
cd5319b
1 Parent(s): 9ee8875

support downloading directly into model_answers

Browse files
app.py CHANGED
@@ -75,7 +75,7 @@ def build_demo():
75
  logging.info("New submition: file saved to %s", file_path)
76
  API.upload_file(
77
  path_or_fileobj=file.name,
78
- path_in_repo="./external/" + file_path,
79
  repo_id="Vikhrmodels/openbench-eval",
80
  repo_type="dataset",
81
  )
 
75
  logging.info("New submition: file saved to %s", file_path)
76
  API.upload_file(
77
  path_or_fileobj=file.name,
78
+ path_in_repo="model_answers/external/" + file_path,
79
  repo_id="Vikhrmodels/openbench-eval",
80
  repo_type="dataset",
81
  )
data/leaderboard_logs/README.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Логи генерации leaderboard
2
+ Сюда из space отправляются после генерации
3
+ Сохраняется только последний за день
src/envs.py CHANGED
@@ -27,7 +27,6 @@ if not os.access(HF_HOME, os.W_OK):
27
  else:
28
  print("Write access confirmed for HF_HOME")
29
 
30
- EVAL_RESULTS_PATH = os.path.join(HF_HOME, "openbench")
31
  DATA_ARENA_PATH = os.path.join(HF_HOME, "data/arena-hard-v0.1")
32
 
33
  RESET_JUDGEMENT_ENV = "RESET_JUDGEMENT"
 
27
  else:
28
  print("Write access confirmed for HF_HOME")
29
 
 
30
  DATA_ARENA_PATH = os.path.join(HF_HOME, "data/arena-hard-v0.1")
31
 
32
  RESET_JUDGEMENT_ENV = "RESET_JUDGEMENT"
src/gen/gen_answer.py CHANGED
@@ -4,30 +4,29 @@ Usage:
4
  python gen_api_answer --parallel 32
5
  """
6
  import argparse
 
7
  import json
8
  import os
9
  import time
10
- import concurrent.futures
11
 
12
- import tiktoken
13
  import shortuuid
 
14
  import tqdm
15
-
16
  from utils import (
17
- load_questions,
18
- load_model_answers,
19
- make_config,
20
- get_endpoint,
21
- chat_completion_openai,
22
- chat_completion_yandex,
23
- chat_completion_gigachat,
24
  chat_completion_anthropic,
25
- chat_completion_openai_azure,
26
- chat_completion_mistral,
27
- chat_completion_gemini,
28
  chat_completion_cohere,
 
 
 
 
 
 
 
 
 
 
29
  reorg_answer_file,
30
- OPENAI_MODEL_LIST,
31
  temperature_config,
32
  )
33
 
@@ -139,7 +138,7 @@ if __name__ == "__main__":
139
  settings = make_config(args.setting_file)
140
  endpoint_list = make_config(args.endpoint_file)
141
 
142
- existing_answer = load_model_answers(os.path.join("data", settings["bench_name"], "model_answer"))
143
 
144
  print(settings)
145
 
@@ -150,7 +149,7 @@ if __name__ == "__main__":
150
  question_file = os.path.join("data", settings["bench_name"], "question.jsonl")
151
  questions = load_questions(question_file)
152
 
153
- answer_file = os.path.join("data", settings["bench_name"], "model_answer", f"{model}.jsonl")
154
  print(f"Output to {answer_file}")
155
 
156
  if "parallel" in endpoint_info:
 
4
  python gen_api_answer --parallel 32
5
  """
6
  import argparse
7
+ import concurrent.futures
8
  import json
9
  import os
10
  import time
 
11
 
 
12
  import shortuuid
13
+ import tiktoken
14
  import tqdm
 
15
  from utils import (
16
+ OPENAI_MODEL_LIST,
 
 
 
 
 
 
17
  chat_completion_anthropic,
 
 
 
18
  chat_completion_cohere,
19
+ chat_completion_gemini,
20
+ chat_completion_gigachat,
21
+ chat_completion_mistral,
22
+ chat_completion_openai,
23
+ chat_completion_openai_azure,
24
+ chat_completion_yandex,
25
+ get_endpoint,
26
+ load_model_answers,
27
+ load_questions,
28
+ make_config,
29
  reorg_answer_file,
 
30
  temperature_config,
31
  )
32
 
 
138
  settings = make_config(args.setting_file)
139
  endpoint_list = make_config(args.endpoint_file)
140
 
141
+ existing_answer = load_model_answers(os.path.join("data", settings["bench_name"], "model_answers", "internal"))
142
 
143
  print(settings)
144
 
 
149
  question_file = os.path.join("data", settings["bench_name"], "question.jsonl")
150
  questions = load_questions(question_file)
151
 
152
+ answer_file = os.path.join("data", settings["bench_name"], "model_answers", f"{model}.jsonl")
153
  print(f"Output to {answer_file}")
154
 
155
  if "parallel" in endpoint_info:
src/gen/gen_judgment.py CHANGED
@@ -143,8 +143,8 @@ if __name__ == "__main__":
143
  pattern = re.compile(configs["regex_pattern"])
144
 
145
  question_file = os.path.join("./data", configs["bench_name"], "question.jsonl")
146
- external_dir = os.path.join("./data", configs["bench_name"], "model_answer/external")
147
- internal_dir = os.path.join("./data", configs["bench_name"], "model_answer/internal")
148
  ref_answer_dir = os.path.join("data", configs["bench_name"], "reference_answer")
149
 
150
  questions = load_questions(question_file)
@@ -157,7 +157,7 @@ if __name__ == "__main__":
157
  # if user choose a set of models, only judge those models
158
  models = [
159
  model.split("/")[-1].split(".")[0]
160
- for model in glob.glob("./data/arena-hard-v0.1/model_answer/external/*.jsonl")
161
  ]
162
 
163
  ref_answers = None
 
143
  pattern = re.compile(configs["regex_pattern"])
144
 
145
  question_file = os.path.join("./data", configs["bench_name"], "question.jsonl")
146
+ external_dir = os.path.join("./data", configs["bench_name"], "model_answers/external")
147
+ internal_dir = os.path.join("./data", configs["bench_name"], "model_answers/internal")
148
  ref_answer_dir = os.path.join("data", configs["bench_name"], "reference_answer")
149
 
150
  questions = load_questions(question_file)
 
157
  # if user choose a set of models, only judge those models
158
  models = [
159
  model.split("/")[-1].split(".")[0]
160
+ for model in glob.glob("./data/arena-hard-v0.1/model_answers/external/*.jsonl")
161
  ]
162
 
163
  ref_answers = None
src/gen/show_result.py CHANGED
@@ -196,7 +196,7 @@ if __name__ == "__main__":
196
  args.load_battles and args.load_bootstrap
197
  ), "If loading prexisting bootstrapping data, you must also load preexisting battles."
198
 
199
- answer_dir = os.path.join("data", args.bench_name, "model_answer/external")
200
  model_answers = load_model_answers(answer_dir)
201
 
202
  if args.load_battles:
@@ -269,7 +269,7 @@ if __name__ == "__main__":
269
 
270
  huggingface_hub.HfApi().upload_file(
271
  path_or_fileobj=json_file_name,
272
- path_in_repo=f"leaderboard_logs/{json_file_name}",
273
- repo_id="Vikhrmodels/openbench-eval",
274
  repo_type="dataset",
275
  )
 
196
  args.load_battles and args.load_bootstrap
197
  ), "If loading prexisting bootstrapping data, you must also load preexisting battles."
198
 
199
+ answer_dir = os.path.join("data", args.bench_name, "model_answers/external")
200
  model_answers = load_model_answers(answer_dir)
201
 
202
  if args.load_battles:
 
269
 
270
  huggingface_hub.HfApi().upload_file(
271
  path_or_fileobj=json_file_name,
272
+ path_in_repo=f"data/leaderboard_logs/{json_file_name}",
273
+ repo_id="Vikhrmodels/leaderboard",
274
  repo_type="dataset",
275
  )
src/leaderboard/build_leaderboard.py CHANGED
@@ -53,43 +53,27 @@ def download_dataset(repo_id, local_dir, repo_type="dataset", max_attempts=3, ba
53
 
54
  def download_openbench():
55
  """Downloads pre generated data"""
56
- os.makedirs(f"{DATA_ARENA_PATH}/model_answer/internal/", exist_ok=True)
57
- os.makedirs(f"{DATA_ARENA_PATH}/model_answer/external/", exist_ok=True)
58
- os.makedirs(f"{DATA_ARENA_PATH}/model_answer/model_judgement/", exist_ok=True)
59
- os.makedirs(EVAL_RESULTS_PATH, exist_ok=True)
60
 
61
  # download answers of different models that we trust
62
- download_dataset("Vikhrmodels/openbench-eval", EVAL_RESULTS_PATH)
63
-
64
- subprocess.run(["pwd"], check=False)
65
- logging.info(EVAL_RESULTS_PATH)
66
- print("\nFiles openbench-eval:")
67
- subprocess.run(["ls", EVAL_RESULTS_PATH], check=False)
68
 
69
  print("\nInternal models in openbench-eval:")
70
- subprocess.run(["ls", f"{EVAL_RESULTS_PATH}/internal/"], check=False)
 
 
 
71
 
72
  print("\nJudgement in openbench-eval")
73
- subprocess.run(["ls", f"{EVAL_RESULTS_PATH}/model_judgment/gpt-4-1106-preview"], check=False)
74
 
75
- # copy the trusted model answers to data
76
- subprocess.run(
77
- [
78
- "rsync",
79
- "-azPvh",
80
- f"{EVAL_RESULTS_PATH}/internal/*",
81
- f"{DATA_ARENA_PATH}/model_answer/internal/",
82
- ],
83
- check=True,
84
- )
85
- # copy the judgement pre generated
86
- # Will be rewritten after we switch to new gen for each submit
87
  subprocess.run(
88
  [
89
  "rsync",
90
  "-azPvh",
91
- f"{EVAL_RESULTS_PATH}/model_judgment/*",
92
- f"{DATA_ARENA_PATH}/model_judgement/",
93
  ],
94
  check=True,
95
  )
 
53
 
54
  def download_openbench():
55
  """Downloads pre generated data"""
56
+ os.makedirs(DATA_ARENA_PATH, exist_ok=True)
 
 
 
57
 
58
  # download answers of different models that we trust
59
+ download_dataset("Vikhrmodels/openbench-eval", DATA_ARENA_PATH)
 
 
 
 
 
60
 
61
  print("\nInternal models in openbench-eval:")
62
+ subprocess.run(["ls", f"{DATA_ARENA_PATH}/model_answers/internal/"], check=False)
63
+
64
+ print("\External models in openbench-eval:")
65
+ subprocess.run(["ls", f"{DATA_ARENA_PATH}/model_answers/external/"], check=False)
66
 
67
  print("\nJudgement in openbench-eval")
68
+ subprocess.run(["ls", f"{DATA_ARENA_PATH}/model_judgment/gpt-4-1106-preview"], check=False)
69
 
70
+ # copy the model answers / judgements to data folder
 
 
 
 
 
 
 
 
 
 
 
71
  subprocess.run(
72
  [
73
  "rsync",
74
  "-azPvh",
75
+ f"{EVAL_RESULTS_PATH}/*",
76
+ f"{DATA_ARENA_PATH}/",
77
  ],
78
  check=True,
79
  )