hi-melnikov commited on
Commit
b19c539
1 Parent(s): cd4e205

finally fixed subprocess

Browse files
Files changed (3) hide show
  1. app.py +2 -2
  2. src/envs.py +1 -0
  3. src/leaderboard/build_leaderboard.py +12 -16
app.py CHANGED
@@ -103,10 +103,10 @@ def update_board():
103
  os.environ[RESET_JUDGEMENT_ENV] = "0"
104
 
105
  # gen_judgement_file = os.path.join(HF_HOME, "src/gen/gen_judgement.py")
106
- # subprocess.Popen(["python3", gen_judgement_file])
107
 
108
  show_result_file = os.path.join(HF_HOME, "src/gen/show_result.py")
109
- subprocess.Popen("python3", show_result_file, "--output")
110
 
111
  # update the gr item
112
  # TODO
 
103
  os.environ[RESET_JUDGEMENT_ENV] = "0"
104
 
105
  # gen_judgement_file = os.path.join(HF_HOME, "src/gen/gen_judgement.py")
106
+ # subprocess.run(["python3", gen_judgement_file], check=True)
107
 
108
  show_result_file = os.path.join(HF_HOME, "src/gen/show_result.py")
109
+ subprocess.run(["python3", show_result_file, "--output"], check=True)
110
 
111
  # update the gr item
112
  # TODO
src/envs.py CHANGED
@@ -28,6 +28,7 @@ else:
28
  print("Write access confirmed for HF_HOME")
29
 
30
  EVAL_RESULTS_PATH = os.path.join(HF_HOME, "openbench")
 
31
 
32
  RESET_JUDGEMENT_ENV = "RESET_JUDGEMENT"
33
 
 
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"
34
 
src/leaderboard/build_leaderboard.py CHANGED
@@ -7,7 +7,7 @@ import time
7
  import pandas as pd
8
  from huggingface_hub import snapshot_download
9
 
10
- from src.envs import EVAL_RESULTS_PATH
11
 
12
  # Configure logging
13
  logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
@@ -53,47 +53,43 @@ 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("data/arena-hard-v0.1/model_answer/internal/", exist_ok=True)
57
- os.makedirs("data/arena-hard-v0.1/model_answer/external/", exist_ok=True)
58
- os.makedirs("data/arena-hard-v0.1/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.Popen("pwd")
65
- subprocess.Popen("ls")
66
-
67
- print(subprocess.run("pwd"))
68
- print(subprocess.run("ls"))
69
-
70
- logging.info(subprocess.Popen(f"ls {EVAL_RESULTS_PATH}"))
71
 
72
  # copy the trusted model answers to data
73
- subprocess.Popen(
74
  [
75
  "rsync",
76
  "-azP",
77
  "--ignore-existing",
78
  f"{EVAL_RESULTS_PATH}/internal/*",
79
- "data/arena-hard-v0.1/model_answer/internal/",
80
  ],
 
81
  )
82
  # copy the judgement pre generated
83
  # Will be rewritten after we switch to new gen for each submit
84
- subprocess.Popen(
85
  [
86
  "rsync",
87
  "-azP",
88
  "--ignore-existing",
89
  f"{EVAL_RESULTS_PATH}/model_judgment/*",
90
- "data/arena-hard-v0.1/model_judgement/",
91
  ],
 
92
  )
93
 
94
 
95
  def build_leadearboard_df():
96
  # Retrieve the leaderboard DataFrame
97
- with open("data/leaderboard.jsong", "r", encoding="utf-8") as eval_file:
98
  leaderboard_df = pd.DataFrame.from_records(json.load(eval_file))
99
  return leaderboard_df.copy()
 
7
  import pandas as pd
8
  from huggingface_hub import snapshot_download
9
 
10
+ from src.envs import DATA_ARENA_PATH, EVAL_RESULTS_PATH, HF_HOME
11
 
12
  # Configure logging
13
  logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
 
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(["ls", EVAL_RESULTS_PATH], check=True)
 
 
 
 
 
 
65
 
66
  # copy the trusted model answers to data
67
+ subprocess.run(
68
  [
69
  "rsync",
70
  "-azP",
71
  "--ignore-existing",
72
  f"{EVAL_RESULTS_PATH}/internal/*",
73
+ f"{DATA_ARENA_PATH}/model_answer/internal/",
74
  ],
75
+ check=True,
76
  )
77
  # copy the judgement pre generated
78
  # Will be rewritten after we switch to new gen for each submit
79
+ subprocess.run(
80
  [
81
  "rsync",
82
  "-azP",
83
  "--ignore-existing",
84
  f"{EVAL_RESULTS_PATH}/model_judgment/*",
85
+ f"{DATA_ARENA_PATH}/model_judgement/",
86
  ],
87
+ check=True,
88
  )
89
 
90
 
91
  def build_leadearboard_df():
92
  # Retrieve the leaderboard DataFrame
93
+ with open(f"{HF_HOME}/data/leaderboard.jsong", "r", encoding="utf-8") as eval_file:
94
  leaderboard_df = pd.DataFrame.from_records(json.load(eval_file))
95
  return leaderboard_df.copy()