Spaces:
Runtime error
Runtime error
meg-huggingface commited on
Commit ·
79fff16
1
Parent(s): c5729e2
Simplifying logic of handling failures & successes...it seemed like it was getting a bit ovelry complicated.
Browse filesFiles changed (2)
- create_results.py+11-13
- entrypoint.sh+8-4
8 unmodified lines9101112131415165 unmodified lines222324252627282930313233343536373839408 unmodified linesapi = HfApi(token=TOKEN)out_dir = sys.argv[1]# Uploading resultsapi.upload_folder(folder_path=out_dir,repo_id="AIEnergyScore/results_debug",5 unmodified linestoken=TOKEN)requests_dset = requests.to_pandas()models_ran = []for f in os.scandir(out_dir):if f.is_dir():for s in os.scandir(f):if s.is_dir() and s.name not in ['hooks', 'info', 'objects', 'refs','logs']:for m in os.scandir(s):models_ran.append(s.name + '/' + m.name)print("Models ran are: " + str(models_ran))requests_dset.loc[requests_dset["model"].isin(models_ran), ['status']] = "COMPLETED"updated_dset = Dataset.from_pandas(requests_dset)updated_dset.push_to_hub("AIEnergyScore/requests_debug", split="test",token=TOKEN)8 unmodified lines91011121314151617185 unmodified lines2425262728293031323334353637388 unmodified linesapi = HfApi(token=TOKEN)out_dir = sys.argv[1]all_attempts_read = open("attempts.txt", "r+").readlines()failed_attempts_read = open("failed_attempts.txt", "r+").readlines()# Uploading output to the results dataset.api.upload_folder(folder_path=out_dir,repo_id="AIEnergyScore/results_debug",5 unmodified linestoken=TOKEN)requests_dset = requests.to_pandas()for line in all_attempts_read:experiment_name, model = line.strip().split(',')if line not in failed_attempts_read:requests_dset.loc[requests_dset["model"] == model, ['status']] = "COMPLETED"else:requests_dset.loc[requests_dset["model"] == model, ['status']] = "FAILED"updated_dset = Dataset.from_pandas(requests_dset)updated_dset.push_to_hub("AIEnergyScore/requests_debug", split="test",token=TOKEN)
6 unmodified lines7891011124 unmodified lines171819202122232425262728293031326 unmodified linesecho "Attempting to run."#if [[ $? = 0 ]]; then# For each line in the requests dataset....python /parse_requests.py | while read -r line; do# Read the name of the model and the experiment.4 unmodified linesnow=$(date +%Y-%m-%d-%H-%M-%S)run_dir="./runs/${experiment_name}/${backend_model}/${now}"mkdir -p "$run_dir"# Let the benchmarking begin!optimum-benchmark --config-name "${experiment_name}" --config-dir /optimum-benchmark/examples/energy_star/ backend.model="${backend_model}" backend.processor="${backend_model}" hydra.run.dir="${run_dir}" 2> "${run_dir}/error.log" || (python /failed_run.py --run_dir "${run_dir}" --model_name "${backend_model}" && rm -rf $run_dir)doneecho "Finished; uploading dataset results"python /create_results.py ./runsecho "Uploading all output from the /runs folder."python /upload_run_folder.py --run_dir "/runs"# Pausing spaceecho "Pausing space."6 unmodified lines78910111213144 unmodified lines1920212223242526272829303132333435366 unmodified linesecho "Attempting to run."#if [[ $? = 0 ]]; thentouch attempts.txttouch failed_attempts.txt# For each line in the requests dataset....python /parse_requests.py | while read -r line; do# Read the name of the model and the experiment.4 unmodified linesnow=$(date +%Y-%m-%d-%H-%M-%S)run_dir="./runs/${experiment_name}/${backend_model}/${now}"mkdir -p "$run_dir"echo "${experiment_name},${backend_model}" >> attempts.txt# Let the benchmarking begin!optimum-benchmark --config-name "${experiment_name}" --config-dir /optimum-benchmark/examples/energy_star/ backend.model="${backend_model}" backend.processor="${backend_model}" hydra.run.dir="${run_dir}" 2> "${run_dir}/error.log" ||echo "${experiment_name},${backend_model}" >> failed_attempts.txt #(python /failed_run.py --run_dir "${run_dir}" --model_name "${backend_model}" && rm -rf $run_dir)doneecho "Finished; updating requests dataset and results dataset."python /create_results.py ./runs#echo "Uploading all output from the /runs folder."#python /upload_run_folder.py --run_dir "/runs"# Pausing spaceecho "Pausing space."
create_results.py+11-13
entrypoint.sh+8-4