#!/bin/bash config_dir="/optimum-benchmark/examples/energy_star/" # This script is meant to be called from a python script \ # that provides the REPO_ID as the first argument. REPO_ID = $1 echo "Attempting to run." cat /tasks.txt | while read -r task; do # Example alternative: for task in "text_generation" "question_answering"; do cat /hardware.txt | while read -r hardware; do # Example alternative: for hardware in "a100-large" "l4x1" "l40sx1"; do echo "Attempting to benchmark ${hardware}" python /change_hardware.py --hardware ${hardware} # For each model cat /models.txt | while read -r model; do # Example alternative: for model in "NousResearch/Hermes-3-Llama-3.1-8B" "Qwen/Qwen2.5-7B-Instruct"; do # Read the name of the model and the experiment. echo "Benchmarking Model: ${model}, Task: ${task}, Hardware: ${hardware}" # Initialize the directory for output. now=$(date +%Y-%m-%d-%H-%M-%S) run_dir="/app/runs/${task}/${model}/${now}" 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 "${run_dir}" >> /failed_attempts.txt } done done done echo "Finished"# updating requests dataset and results dataset." #python /process_runs.py