sasha HF Staff commited on
Commit
961aa3a
·
verified ·
1 Parent(s): 189fa7e

Update failed_run.py

Browse files

adding uploading files too

Files changed (1) hide show
  1. failed_run.py +17 -0
failed_run.py CHANGED
@@ -29,6 +29,22 @@ args = parser.parse_args()
29
  # Updating request
30
  dataset = load_dataset("EnergyStarAI/requests_debug", split="test", token=TOKEN).to_pandas()
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  # Set benchmark to failed
33
  # TODO: This doesn't have to be try-except, we could actually check if the file is there.
34
  try:
@@ -41,6 +57,7 @@ try:
41
  print("Status set to FAILED")
42
  else:
43
  dataset.loc[dataset["model"].isin([args.model_name]), ['status']] = "COMPLETED"
 
44
  print("Status set to COMPLETE")
45
  # Add a new column for the error message if necessary
46
  if "error_message" not in dataset.columns:
 
29
  # Updating request
30
  dataset = load_dataset("EnergyStarAI/requests_debug", split="test", token=TOKEN).to_pandas()
31
 
32
+ def upload_results():
33
+ models_ran=[]
34
+ for f in os.scandir('./runs'):
35
+ if f.is_dir():
36
+ for s in os.scandir(f):
37
+ if s.is_dir() and s.name not in ['hooks','info','objects','refs','logs']:
38
+ for m in os.scandir(s):
39
+ models_ran.append(s.name+'/' + m.name)
40
+
41
+ print("Models ran are: " + str(models_ran))
42
+
43
+ requests_dset.loc[requests_dset["model"].isin(models_ran), ['status']] = "COMPLETED"
44
+ updated_dset =Dataset.from_pandas(requests_dset)
45
+ updated_dset.push_to_hub("EnergyStarAI/requests_debug", split="test", token=TOKEN)
46
+ print("Updated model status")
47
+
48
  # Set benchmark to failed
49
  # TODO: This doesn't have to be try-except, we could actually check if the file is there.
50
  try:
 
57
  print("Status set to FAILED")
58
  else:
59
  dataset.loc[dataset["model"].isin([args.model_name]), ['status']] = "COMPLETED"
60
+ upload_results()
61
  print("Status set to COMPLETE")
62
  # Add a new column for the error message if necessary
63
  if "error_message" not in dataset.columns: