forked from keisuke-nakata/minerl2020_submission
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
executable file
·59 lines (51 loc) · 1.59 KB
/
run.py
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
import aicrowd_helper
import train
import test
import logging
import os
import coloredlogs
coloredlogs.install(logging.DEBUG)
EVALUATION_RUNNING_ON = os.getenv('EVALUATION_RUNNING_ON', None)
EVALUATION_STAGE = os.getenv('EVALUATION_STAGE', 'all')
EXITED_SIGNAL_PATH = os.getenv('EXITED_SIGNAL_PATH', 'shared/exited')
# Hyperparameters
n_pretrain_steps = 750000
frame_skip = 4
frame_stack = 4
gpu = 0
lr = 6.25e-5
minibatch_size = 32
n_experts = 64
use_noisy_net = "before-pretraining"
n_clusters = 40
# Training Phase
if EVALUATION_STAGE in ['all', 'training']:
aicrowd_helper.training_start()
try:
#train.main(frame_skip, frame_stack, gpu, lr, minibatch_size, n_experts,
# use_noisy_net, n_clusters)
aicrowd_helper.training_end()
except Exception as e:
logging.error(e, exc_info=True)
aicrowd_helper.training_error()
# Testing Phase
if EVALUATION_STAGE in ['all', 'testing']:
if EVALUATION_RUNNING_ON in ['local']:
try:
os.remove(EXITED_SIGNAL_PATH)
except FileNotFoundError:
pass
aicrowd_helper.inference_start()
try:
test.main(frame_skip, frame_stack, gpu, n_clusters, use_noisy_net)
aicrowd_helper.inference_end()
except Exception as e:
logging.error(e, exc_info=True)
aicrowd_helper.inference_error()
if EVALUATION_RUNNING_ON in ['local']:
from pathlib import Path
Path(EXITED_SIGNAL_PATH).touch()
# Launch instance manager
if EVALUATION_STAGE in ['manager']:
from minerl.env.malmo import launch_instance_manager
launch_instance_manager()