-
Notifications
You must be signed in to change notification settings - Fork 0
/
submit_cloud_train.sh
executable file
·68 lines (55 loc) · 1.57 KB
/
submit_cloud_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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
Help()
{
# Display Help
echo "Submit training task to GCP AI Platform."
echo
echo "Syntax: $0 [-a <archive name>] [-h]"
echo "options:"
echo "a specify target archive name (including extension, default to 'wip.tgz')."
echo "h Print this Help."
echo
}
archive=""
while getopts ":ha:" option; do
case $option in
h) # display Help
Help
exit;;
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 "$archive" ]]; then
archive="wip.tgz"
echo "using default archive name $archive"
fi
jobname="train_$(date +"%Y%m%d%H%M")"
if [[ ! -z "$JOB_PREFIX" ]]; then
jobname="${JOB_PREFIX}_${jobname}"
fi
echo "Submitting task.train withs params : --bucket $STEERING_BUCKET_NAME --archive $archive"
gcloud ai-platform jobs submit training "$jobname" \
--package-path $TRAINER_DIR/task \
--module-name task.train \
--scale-tier BASIC_GPU \
--region $REGION --python-version 3.7 --runtime-version 2.9 --job-dir $JOB_DIR --stream-logs -- --bucket $STEERING_BUCKET_NAME --archive $archive
# --packages ~/projects/rrl_2023/donkeycar/donkeycar.tar.gz \
model_file="model-$(basename $archive .tgz)"
./download_model.sh -m $model_file