-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-shortcuts
executable file
·58 lines (45 loc) · 2.74 KB
/
setup-shortcuts
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
#!/bin/bash
# ======================================================================================================================
# Params
# ======================================================================================================================
SHELL_CONFIG_FILE=".$1rc"
echo "Shell: $1"
if [ "$2" == "gpu" ]
then
echo "Use: $2"
SUDO="sudo"
USE_GPU="$SUDO systemctl start bumblebeed; $SUDO optiprime"
fi
# ======================================================================================================================
# ======================================================================================================================
# Commands
# ======================================================================================================================
ENV_ACTIVATE="conda activate doom-agent"
REMOVE_TRAIN_FILES="$SUDO rm -rf logs metrics checkpoints"
TRAIN="$ENV_ACTIVATE; $USE_GPU python agent-train.py"
PLAY="$ENV_ACTIVATE; clear; $USE_GPU python agent-play.py"
DEMO_BASIC="$PLAY --config scenarios/basic/agent.yml --weights scenarios/basic/weights.h5"
DEMO_DEFEND="$PLAY --config scenarios/defend_the_center/agent.yml --weights scenarios/defend_the_center/weights/best_weights-loss_0.0208.h5"
TENSOR_BOARD="$ENV_ACTIVATE; tensorboard --logdir metrics"
# ======================================================================================================================
# ======================================================================================================================
# Functions
# ======================================================================================================================
function write() { echo -e $1 >> ~/$SHELL_CONFIG_FILE; }
function separator() { write "# ===================================================================================="; }
function header() { write ""; separator; write "# $1"; separator; }
# ======================================================================================================================
# ======================================================================================================================
# Main
# ======================================================================================================================
header "doom-agent config"
write 'export PATH=.:$PATH'
write "# Shortcuts..."
write "alias agent-train='$REMOVE_TRAIN_FILES; $TRAIN'"
write "alias agent-play='$PLAY'"
write "alias agent-demo-basic='$DEMO_BASIC'"
write "alias agent-demo-defend-the-center='$DEMO_DEFEND'"
write "alias agent-report='$REPORT'"
write "alias agent-metrics='$TENSOR_BOARD'"
separator
# ======================================================================================================================