#!/bin/bash

#PBS -N neural-compression-test-run
#PBS -l gpus=1
#PBS -l walltime=00:30:00
#PBS -m abe

CACHE_DIR="${VSC_SCRATCH}/.cache"                # Directory to use as cache
UV_DIR="${VSC_SCRATCH}/uv"                       # Directory to install packages
#HF_DIR="${CACHE_DIR}/huggingface"                # Directory to save models

module purge
module load PyTorch-bundle/2.1.2-foss-2023a-CUDA-12.1.1
module load Optuna/3.5.0-foss-2023a
module load matplotlib/2.2.5-foss-2023a-Python-2.7.18

cd "${PBS_O_WORKDIR}"

UV_PYTHON_INSTALL_DIR="${UV_DIR}/python" UV_PYTHON_INSTALL_DIR="${UV_DIR}/python" \
  uv --cache-dir="${CACHE_DIR}/uv" \
  venv "${UV_DIR}/venv" --clear

source "${UV_DIR}/venv/bin/activate"

UV_PYTHON_INSTALL_DIR="${UV_DIR}/python" UV_PYTHON_INSTALL_DIR="${UV_DIR}/python" \
  uv --cache-dir="${CACHE_DIR}/uv" \
  sync --active --no-dev

cd "${PBS_O_WORKDIR}/CNN-model"

python main_cnn.py --method train