memory = Memory(REPLAY_SIZE) agent = Agent(env, memory) initial_observation = env.reset() if 'cuda' in str(device): print('The GPU is being used') else: print('The CPU is being used') if option_dict['random']: play_random(env, UP_ACTION, DOWN_ACTION, seconds=5) if option_dict['train']: print("Training") print("ReplayMemory will require {}gb of GPU RAM".format(round(REPLAY_SIZE * 32 * 84 * 84 / 1e+9, 2))) agent.reset_environtment() train(env, net, target_net, epsilon_data, agent, memory, GAMMA, device, DELAY_LEARNING, TARGET_UPDATE_FREQ, BATCH_SIZE, model) if option_dict['oldnetwork']: file_path = './pull/pong_v4_data/DQN/DQN_10_6-1700.dat' seconds = 120 test_old_network(env, net, file_path, seconds, device)