2021-01-08 15:36:49 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Sample call:
|
|
|
|
# bash generate_checkpoints.sh 1.0.2 1.0.3 1.0.4
|
|
|
|
|
2021-08-10 08:13:31 +00:00
|
|
|
set -e
|
|
|
|
|
2021-01-08 15:36:49 +00:00
|
|
|
LEGACY_PATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
2021-08-10 08:13:31 +00:00
|
|
|
FROZEN_MIN_PT_VERSION="1.6"
|
2021-01-08 15:36:49 +00:00
|
|
|
|
|
|
|
echo $LEGACY_PATH
|
|
|
|
# install some PT version here so it does not need to reinstalled for each env
|
2021-08-10 08:13:31 +00:00
|
|
|
pip install virtualenv "torch==1.6" --quiet
|
2021-01-08 15:36:49 +00:00
|
|
|
|
|
|
|
ENV_PATH="$LEGACY_PATH/vEnv"
|
|
|
|
|
|
|
|
# iterate over all arguments assuming that each argument is version
|
|
|
|
for ver in "$@"
|
|
|
|
do
|
|
|
|
echo "processing version: $ver"
|
|
|
|
# mkdir "$LEGACY_PATH/$ver"
|
|
|
|
|
|
|
|
# create local env
|
|
|
|
echo $ENV_PATH
|
|
|
|
virtualenv $ENV_PATH --system-site-packages
|
|
|
|
# activate and install PL version
|
|
|
|
source "$ENV_PATH/bin/activate"
|
2021-01-12 01:36:12 +00:00
|
|
|
# there are problem to load ckpt in older versions since they are saved the newer versions
|
2021-08-10 08:13:31 +00:00
|
|
|
pip install "pytorch_lightning==$ver" "torch==$FROZEN_MIN_PT_VERSION" "torchmetrics" "scikit-learn" --quiet
|
2021-01-08 15:36:49 +00:00
|
|
|
|
|
|
|
python --version
|
|
|
|
pip --version
|
|
|
|
pip list | grep torch
|
|
|
|
|
2021-08-10 08:13:31 +00:00
|
|
|
python "$LEGACY_PATH/simple_classif_training.py"
|
|
|
|
cp "$LEGACY_PATH/simple_classif_training.py" ${LEGACY_PATH}/checkpoints/${ver}
|
2021-01-08 15:36:49 +00:00
|
|
|
|
|
|
|
mv ${LEGACY_PATH}/checkpoints/${ver}/lightning_logs/version_0/checkpoints/*.ckpt ${LEGACY_PATH}/checkpoints/${ver}/
|
|
|
|
rm -rf ${LEGACY_PATH}/checkpoints/${ver}/lightning_logs
|
|
|
|
|
|
|
|
deactivate
|
|
|
|
# clear env
|
|
|
|
rm -rf $ENV_PATH
|
|
|
|
|
|
|
|
done
|