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
|
|
|
|
|
|
|
|
LEGACY_PATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
|
|
|
|
|
|
|
echo $LEGACY_PATH
|
|
|
|
# install some PT version here so it does not need to reinstalled for each env
|
|
|
|
pip install virtualenv "torch==1.5" --quiet --no-cache-dir
|
|
|
|
|
|
|
|
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
|
|
|
|
pip install "pytorch_lightning==$ver" "torch==1.3" --quiet --no-cache-dir
|
2021-01-08 15:36:49 +00:00
|
|
|
|
|
|
|
python --version
|
|
|
|
pip --version
|
|
|
|
pip list | grep torch
|
|
|
|
|
|
|
|
python "$LEGACY_PATH/zero_training.py"
|
|
|
|
cp "$LEGACY_PATH/zero_training.py" ${LEGACY_PATH}/checkpoints/${ver}
|
|
|
|
|
|
|
|
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
|