Spaces:
Paused
Paused
Update app.py
Browse files
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 |
-
|
| 21 |
curr_runtime = API.get_space_runtime(repo_id=REPO_ID)
|
| 22 |
-
|
| 23 |
if curr_runtime != hardware:
|
| 24 |
-
|
| 25 |
API.request_space_hardware(repo_id=REPO_ID, hardware=hardware)
|
| 26 |
for model in model_file:
|
| 27 |
model = model.strip()
|
| 28 |
-
|
| 29 |
for task in task_file:
|
| 30 |
task = task.strip()
|
| 31 |
-
|
| 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 |
-
|
| 38 |
try:
|
| 39 |
API.create_repo(repo_id=f"{RESULTS_DSET}", repo_type="dataset",)
|
| 40 |
print(f"Created results dataset repository")
|
| 41 |
except:
|
| 42 |
-
|
| 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)
|