-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.py
45 lines (31 loc) · 1.11 KB
/
test.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
import logging
import coloredlogs
import aicrowd_gym
import minerl
from config import EVAL_EPISODES, EVAL_MAX_STEPS
coloredlogs.install(logging.DEBUG)
MINERL_GYM_ENV = 'MineRLObtainDiamondShovel-v0'
def main():
# NOTE: It is important that you use "aicrowd_gym" instead of regular "gym"!
# Otherwise, your submission will fail.
env = aicrowd_gym.make(MINERL_GYM_ENV)
# Load your model here
# NOTE: The trained parameters must be inside "train" directory!
# model = None
for i in range(EVAL_EPISODES):
obs = env.reset()
done = False
for step_counter in range(EVAL_MAX_STEPS):
# Step your model here.
# Currently, it's doing random actions
random_act = env.action_space.sample()
obs, reward, done, info = env.step(random_act)
if done:
break
print(f"[{i}] Episode complete")
# Close environment and clean up any bigger memory hogs.
# Otherwise, you might start running into memory issues
# on the evaluation server.
env.close()
if __name__ == "__main__":
main()