This repository has been archived on 2025-12-23. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
2025ML-project-neural_compr.../config/local.sh

38 lines
952 B
Bash

#!/usr/bin/env bash
INPUT_FILE="config/sub.csv"
JOBID="$(date +%s | tail -c 9)"
GIT_HASH="$(git rev-parse --short HEAD)"
DATE="$(date "+%Y%m%d")"
ID="${JOBID}-${GIT_HASH}-${DATE}"
STAT_FILE="results/${ID}/results.csv"
MODELS=/home/tdpeuter/data/ml-models
mkdir -p "results/${ID}"
while read -r line; do
IFS=',' read -r id input model dataset context <<< "$line"
if [[ "${id}" == "id" ]]; then
continue
fi
output="results/${ID}/$(basename "${input}").${id}.pt"
python main.py compress \
--model-load-path "${MODELS}/${dataset}/${context}/${model}-1024.pt" \
--input-file "${input}" \
--output-file "${output}"
in_bytes="$(stat -c %s -- "${input}")"
out_bytes="$(stat -c %s -- "${output}")"
printf "%d,%s,%s,%s,%d,%d,%d\n" "$id" "$input" "$model" "$dataset" "$context" "$in_bytes" "$out_bytes" >> "${STAT_FILE}"
exit_code="${?}"
if [ "${exit_code}" -eq 0 ]; then
echo "DONE"
fi
done < "${INPUT_FILE}"