-
Notifications
You must be signed in to change notification settings - Fork 1
/
train.py
33 lines (22 loc) · 874 Bytes
/
train.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
import argparse
from datetime import datetime
import random
import torch
from memory import ReplayMemory
from environment import DoomEnvironment
from agent import DQNAgent
from time import time,sleep
parser = argparse.ArgumentParser(description='RBDoom')
if __name__ == '__main__':
env = DoomEnvironment(config_file_path = "scenarios/basic.cfg", scenario_file_path = "scenarios/basic.wad",
resolution = (64,64), stack_size = 4)
actions = env.get_actions()
resolution = (64, 64)
memory = ReplayMemory(resolution = resolution, stack_size = 4)
agent = DQNAgent(action_count = len(actions), replay_memory = memory)
print("Starting the training!")
agent.train(env)
env.game.close()
print("======================================")
print("Training finished. It's time to watch!")
env.watch(agent)