#!/bin/bash config_dir="/optimum-benchmark/examples/energy_star/" # This script is meant to be called from a python script (app.py) \ MODEL=$1 TASK=$2 HARDWARE=$3 RUN_DIR=$4 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"