dvilasuero commited on
Commit
0ef5ea2
·
verified ·
1 Parent(s): 9fae527

Upload eval_runner_v2.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. eval_runner_v2.py +7 -6
eval_runner_v2.py CHANGED
@@ -76,16 +76,16 @@ if __name__ == "__main__":
76
  with urllib.request.urlopen(eval_script_url) as response:
77
  eval_code = response.read().decode('utf-8')
78
 
79
- # Write eval code to a temporary file
80
- with tempfile.NamedTemporaryFile(mode='w', suffix='.py', delete=False) as f:
 
81
  f.write(eval_code)
82
- temp_eval_file = f.name
83
 
84
  try:
85
  # Run inspect eval with the downloaded script
86
  print(f"Running inspect eval with model {model}...")
87
  cmd = [
88
- "inspect", "eval", temp_eval_file,
89
  "--model", model,
90
  "--log-dir", log_dir,
91
  ]
@@ -103,5 +103,6 @@ if __name__ == "__main__":
103
  bundle_and_upload_to_space(log_dir, hf_space_id, hf_token)
104
 
105
  finally:
106
- # Clean up temp file
107
- os.unlink(temp_eval_file)
 
 
76
  with urllib.request.urlopen(eval_script_url) as response:
77
  eval_code = response.read().decode('utf-8')
78
 
79
+ # Write eval code to a file in current directory (inspect needs relative paths)
80
+ eval_filename = "downloaded_eval.py"
81
+ with open(eval_filename, 'w') as f:
82
  f.write(eval_code)
 
83
 
84
  try:
85
  # Run inspect eval with the downloaded script
86
  print(f"Running inspect eval with model {model}...")
87
  cmd = [
88
+ "inspect", "eval", eval_filename,
89
  "--model", model,
90
  "--log-dir", log_dir,
91
  ]
 
103
  bundle_and_upload_to_space(log_dir, hf_space_id, hf_token)
104
 
105
  finally:
106
+ # Clean up eval file
107
+ if os.path.exists(eval_filename):
108
+ os.unlink(eval_filename)