-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdist_train.sh
50 lines (41 loc) · 2.19 KB
/
dist_train.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
set -ex
CONFIG=$1
GPUS=$2
MASTER_PORT=$4
DATABLOB=$3
pip install -r extra_requirements.txt
# wheather the file exists, if not, download it
if [ ! -f "$DATABLOB/datasets/pretrained_models/stylegan2-ffhq-config-f.pt" ]; then
mkdir -p $DATABLOB/datasets/pretrained_models;
wget https://github.com/researchmm/language-guided-animation/releases/download/v0.0.0/stylegan2-ffhq-config-f.pt -O $DATABLOB/datasets/pretrained_models/stylegan2-ffhq-config-f.pt;
fi
if [ ! -f "$DATABLOB/datasets/CelebAMask-HQ/meta_train.pkl" ]; then
mkdir -p $DATABLOB/datasets/CelebAMask-HQ;
wget https://github.com/researchmm/language-guided-animation/releases/download/v0.0.0/meta_train.pkl -O $DATABLOB/datasets/CelebAMask-HQ/meta_train.pkl;
fi
if [ ! -f "$DATABLOB/datasets/CelebAMask-HQ/meta_test.pkl" ]; then
mkdir -p $DATABLOB/datasets/CelebAMask-HQ;
wget https://github.com/researchmm/language-guided-animation/releases/download/v0.0.0/meta_test.pkl -O $DATABLOB/datasets/CelebAMask-HQ/meta_test.pkl;
fi
if [ ! -f "$DATABLOB/datasets/CelebAMask-HQ/celeba_e4e_latents.pt" ]; then
mkdir -p $DATABLOB/datasets/CelebAMask-HQ;
wget https://github.com/researchmm/language-guided-animation/releases/download/v0.0.0/celeba_e4e_latents.pt -O $DATABLOB/datasets/CelebAMask-HQ/celeba_e4e_latents.pt;
fi
if [ ! -f "$DATABLOB/datasets/pretrained_models/stylegan2_pretrained/stylegan2-awesome-network-snapshot-metfaces2.pt" ]; then
mkdir -p $DATABLOB/datasets/pretrained_models/stylegan2_pretrained/;
wget https://github.com/researchmm/language-guided-animation/releases/download/v0.0.0/stylegan2-awesome-network-snapshot-metfaces2.pt -O $DATABLOB/datasets/pretrained_models/stylegan2_pretrained/stylegan2-awesome-network-snapshot-metfaces2.pt;
fi
# train
torchrun --nproc_per_node $GPUS \
--master_port $MASTER_PORT tools/dist_train.py \
--opts MODEL.N_INFERENCE_FRAMES 16 \
DATA.BATCH_SIZE 4 \
--cfg configs/$CONFIG.yaml \
--datablob $DATABLOB
# inference
torchrun --nproc_per_node $GPUS \
--master_port $MASTER_PORT tools/dist_inference.py \
--opts MODEL.N_INFERENCE_FRAMES 16 \
PRETRAINED.OUR_MODEL "Iter_002000.pth" \
--cfg configs/$CONFIG.yaml \
--datablob $DATABLOB