-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
40 lines (29 loc) · 909 Bytes
/
main.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
""" Let's Begin the action :P """
import tensorflow as tf
from environment import Environment
from agent import Agent
from config import get_config
from utils import create_dirs
def main():
# Reset the graph
tf.reset_default_graph()
# Get the Config of the program and init the dirs
config = get_config()
create_dirs(config.experiment_dir)
# Create the Session of the graph
sess = tf.Session()
env = Environment(sess, config)
evaluation_env = Environment(sess, config, evaluation=True)
wasted = Agent(sess, config, env, evaluation_env)
if config.is_train:
try:
wasted.train_episodic()
except KeyboardInterrupt:
wasted.save()
elif config.is_play:
wasted.play()
else:
raise Exception("Please select a proper mode for our wasted agent")
sess.close()
if __name__ == '__main__':
main()