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 lines9101112131413151617185 unmodified lines2425262526272829303132272829303132333435343536373637388 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 results# Uploading output to the results dataset.api.upload_folder( folder_path=out_dir, repo_id="AIEnergyScore/results_debug",5 unmodified lines token=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)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"
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)6 unmodified lines78910111213144 unmodified lines192021222324222526272825293031282932333435366 unmodified linesecho "Attempting to run."#if [[ $? = 0 ]]; then
touch 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 lines now=$(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" || (python /failed_run.py --run_dir "${run_dir}" --model_name "${backend_model}" && rm -rf $run_dir) 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)done
echo "Finished; uploading dataset results"echo "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"#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