-
Notifications
You must be signed in to change notification settings - Fork 0
/
submit_cloud_makepilotmovie.sh
executable file
·77 lines (63 loc) · 1.9 KB
/
submit_cloud_makepilotmovie.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
Help()
{
# Display Help
echo "Submit makepilotmovie task to GCP AI Platform."
echo
echo "Syntax: $0 [-m <model.h5>] [-a <archive name>] [-h]"
echo "options:"
echo "m model filename (expecting .h5)."
echo "a archive filename to use (including extension, default to 'wip.tgz')."
echo "h Print this Help."
echo
}
model=""
archive=""
while getopts ":hm:a:" option; do
case $option in
h) # display Help
Help
exit;;
m) # Enter a name
model=$OPTARG;;
a) # Enter a name
archive=$OPTARG;;
\?) # Invalid option
echo "Error: Invalid option"
Help
exit;;
esac
done
if [[ -z "$TRAINER_DIR" ]]; then
echo "Missing env variable TRAINER_DIR !"
exit
fi
if [[ -z "$JOB_DIR" ]]; then
echo "Missing env variable JOB_DIR !"
exit
fi
if [[ -z "$STEERING_BUCKET_NAME" ]]; then
echo "Missing env variable STEERING_BUCKET_NAME !"
exit
fi
if [[ -z "$model" ]]; then
model="pilot-wip.h5"
echo "Using default model filename '$tub'"
fi
if [[ -z "$archive" ]]; then
archive="wip.tgz"
echo "using default archive name $archive"
fi
jobname="salient_$(date +"%Y%m%d%H%M")"
if [[ ! -z "$JOB_PREFIX" ]]; then
jobname="${JOB_PREFIX}_${jobname}"
fi
outfile="$(basename $model .h5)-salient.mp4"
echo "Submitting task.makemovie withs params : --out ${outfile} --bucket ${STEERING_BUCKET_NAME} --archive $archive--type linear --model ${model} --salient"
gcloud ai-platform jobs submit training "$jobname" \
--package-path $TRAINER_DIR/task \
--module-name task.makemovie \
--scale-tier BASIC_GPU \
--region $REGION --python-version 3.7 --runtime-version 2.9 --job-dir $JOB_DIR --stream-logs -- --out ${outfile} --bucket ${STEERING_BUCKET_NAME} --archive $archive --type linear --model ${model} --salient
src="gs://${STEERING_BUCKET_NAME}/movies"
gsutil cp ${src}/${outfile} .