#!/usr/bin/env bash
# Original VLAAI with skip connections ON (package vlaai.yaml has use_skip: false, which stops it learning; see
# logs/debug_vlaai.log). mat prep, with and without training augmentation.
cd "$(dirname "$0")/.."
PY=../../.venv/bin/python
QLOG=logs/queue_skip.log
for spec in "_skip_aug --augment" "_skip"; do
  set -- $spec; tag=$1; extra=$2; exp="vlaai__mat${tag}"
  [[ -f results/$exp.json ]] && continue
  echo "$(date '+%F %T') START $exp" | tee -a "$QLOG"
  if $PY run_experiment.py --decoder vlaai --prep mat --tag $tag --model-override '{"use_skip": true}' $extra < /dev/null >> logs/$exp.stdout 2>&1; then
    rm -f results/$exp.FAILED
    echo "$(date '+%F %T') DONE  $exp: $(grep 'MEAN over' logs/$exp.log | tail -1 | cut -d' ' -f3-)" | tee -a "$QLOG"
  else
    touch results/$exp.FAILED; echo "$(date '+%F %T') FAILED $exp" | tee -a "$QLOG"
  fi
  $PY summarize.py > /dev/null 2>&1 || true
done
echo "$(date '+%F %T') queue skip finished" | tee -a "$QLOG"
