File size: 1,256 Bytes
d023e59
 
939c209
c5729e2
ccb86e6
939c209
 
 
807b73e
939c209
216eab8
 
939c209
 
 
216eab8
 
9714a8a
939c209
216eab8
939c209
 
0351a9f
939c209
 
 
 
 
 
568dde5
 
79fff16
939c209
6c04bde
72e682c
 
 
c5729e2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash

# TODO: Why is this here? Can we delete it?
export SPACE="AIEnergyScore/launch-computation-example"

# Can use this for errors too: trap 'echo "An error occurred."' ERR

config_dir="/optimum-benchmark/examples/energy_star/"

echo "Attempting to run."
# 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 (task).
    IFS="," read model task <<< "${line}"
    echo "Benchmarking Model: ${model}, Task: ${task}"

    # Initialize the directory for output.
    now=$(date +%Y-%m-%d-%H-%M-%S)
    run_dir="/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

echo "Finished; updating requests dataset and results dataset."
python /process_runs.py

# Pausing space
echo "Pausing space."
python /pause_space.py
echo "Done."