|
#!/usr/bin/env bash |
|
|
|
|
|
|
|
|
|
|
|
set -x |
|
|
|
PY_ARGS=${@:2} |
|
|
|
set -o pipefail |
|
|
|
OUTPUT_BASE=$(echo $1 | sed -e "s/configs/exps/g" | sed -e "s/.args$//g") |
|
mkdir -p $OUTPUT_BASE |
|
|
|
for RUN in $(seq 100); do |
|
ls $OUTPUT_BASE | grep run$RUN && continue |
|
OUTPUT_DIR=$OUTPUT_BASE/run$RUN |
|
mkdir $OUTPUT_DIR && break |
|
done |
|
|
|
|
|
rmpyc() { |
|
rm -rf $(find -name __pycache__) |
|
rm -rf $(find -name "*.pyc") |
|
} |
|
|
|
|
|
echo "Backing up to log dir: $OUTPUT_DIR" |
|
rmpyc && cp -r models datasets util main.py engine.py submit_dance.py $1 $OUTPUT_DIR |
|
echo " ...Done" |
|
|
|
|
|
cleanup() { |
|
echo "Packing source code" |
|
rmpyc |
|
|
|
echo " ...Done" |
|
} |
|
|
|
args=$(cat $1) |
|
|
|
pushd $OUTPUT_DIR |
|
trap cleanup EXIT |
|
|
|
|
|
echo "Logging git status" |
|
git status > git_status |
|
git rev-parse HEAD > git_tag |
|
git diff > git_diff |
|
echo $PY_ARGS > desc |
|
echo " ...Done" |
|
|
|
python -m torch.distributed.launch --nproc_per_node=8 --use_env main.py ${args} --output_dir . |& tee -a output.log |
|
|