BulkCalcSpace / entrypoint.sh
meg's picture
meg HF Staff
Update entrypoint.sh
c83b217 verified
raw
history blame
891 Bytes
#!/bin/bash
config_dir="/optimum-benchmark/examples/energy_star/"
# This script is meant to be called from a python script (app.py) \
# that provides the REPO_ID as the first argument, etc.
REPO_ID=$1
MODEL=$2
TASK=$3
HARDWARE=$4
RUN_DIR=$5
echo "Attempting to run."
# Read the name of the model and the experiment.
echo "Benchmarking Model: ${MODEL}, Task: ${TASK}, Hardware: ${HARDWARE}"
# Initialize the directory for output.
mkdir -p "${RUN_DIR}"
# Save the task/model run directory to text file, for tracking purposes.
echo "${RUN_DIR}" >> attempts.txt
{ # try
# Let the benchmarking begin!
optimum-benchmark --config-name "${TASK}" --config-dir="${config_dir}" backend.model="${MODEL}" backend.processor="${MODEL}" hydra.run.dir="${RUN_DIR}" 2> "${RUN_DIR}/error.log"
} || { # catch
echo "Did not benchmark."
echo "${RUN_DIR}" >> failed_attempts.txt
}
echo "Finished"