meg HF Staff commited on
Commit
af18f6f
·
verified ·
1 Parent(s): 8a060db

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -17,29 +17,29 @@ def start_train():
17
  hardware_file = open("hardware.txt", "r+").readlines()
18
  for hardware in hardware_file:
19
  hardware = hardware.strip()
20
- print(f"Requested hardware is {hardware}")
21
  curr_runtime = API.get_space_runtime(repo_id=REPO_ID)
22
- print(f"Current hardware is {curr_runtime}")
23
  if curr_runtime != hardware:
24
- print("Trying to switch.")
25
  API.request_space_hardware(repo_id=REPO_ID, hardware=hardware)
26
  for model in model_file:
27
  model = model.strip()
28
- print(f"Attempting to benchmark model {model}.")
29
  for task in task_file:
30
  task = task.strip()
31
- print(f"Attempting to benchmark model {model} on task {task}.")
32
  # Create the name of the directory for output.
33
  now = time.time()
34
  run_dir = f"runs/{task}/{model}/{now}"
35
  os.system(f"./entrypoint.sh {REPO_ID} {model} {task} {hardware} {run_dir}")
36
  # Uploads all run output to the results dataset.
37
- print(f"Uploading {run_dir} to {RESULTS_DSET}")
38
  try:
39
  API.create_repo(repo_id=f"{RESULTS_DSET}", repo_type="dataset",)
40
  print(f"Created results dataset repository")
41
  except:
42
- print(f"Using pre-existing dataset respository.")
43
  API.upload_folder(folder_path=run_dir, repo_id=f"{RESULTS_DSET}", repo_type="dataset",)
44
  print("Pausing space")
45
  API.pause_space(REPO_ID)
 
17
  hardware_file = open("hardware.txt", "r+").readlines()
18
  for hardware in hardware_file:
19
  hardware = hardware.strip()
20
+ os.system(f"echo 'Requested hardware is {hardware}'")
21
  curr_runtime = API.get_space_runtime(repo_id=REPO_ID)
22
+ os.system(f"echo 'Current hardware is {curr_runtime}'")
23
  if curr_runtime != hardware:
24
+ os.system("echo 'Trying to switch.'")
25
  API.request_space_hardware(repo_id=REPO_ID, hardware=hardware)
26
  for model in model_file:
27
  model = model.strip()
28
+ os.system(f"echo 'Attempting to benchmark model {model}.'")
29
  for task in task_file:
30
  task = task.strip()
31
+ os.system(f"echo 'Attempting to benchmark model {model} on task {task}.'")
32
  # Create the name of the directory for output.
33
  now = time.time()
34
  run_dir = f"runs/{task}/{model}/{now}"
35
  os.system(f"./entrypoint.sh {REPO_ID} {model} {task} {hardware} {run_dir}")
36
  # Uploads all run output to the results dataset.
37
+ os.system(f"echo 'Uploading {run_dir} to {RESULTS_DSET}'")
38
  try:
39
  API.create_repo(repo_id=f"{RESULTS_DSET}", repo_type="dataset",)
40
  print(f"Created results dataset repository")
41
  except:
42
+ os.system("echo 'Using pre-existing dataset respository.'")
43
  API.upload_folder(folder_path=run_dir, repo_id=f"{RESULTS_DSET}", repo_type="dataset",)
44
  print("Pausing space")
45
  API.pause_space(REPO_ID)