4
4
from __future__ import print_function
5
5
from vizdoom import *
6
6
import itertools as it
7
- import pickle
8
7
from random import sample , randint , random
9
8
from time import time , sleep
10
9
import numpy as np
@@ -215,7 +214,7 @@ def initialize_vizdoom(config_file_path):
215
214
print ("Loading model from: " , model_savefile )
216
215
saver .restore (session , model_savefile )
217
216
else :
218
- init = tf .initialize_all_variables ()
217
+ init = tf .global_variables_initializer ()
219
218
session .run (init )
220
219
print ("Starting the training!" )
221
220
@@ -228,7 +227,7 @@ def initialize_vizdoom(config_file_path):
228
227
229
228
print ("Training..." )
230
229
game .new_episode ()
231
- for learning_step in trange (learning_steps_per_epoch ):
230
+ for learning_step in trange (learning_steps_per_epoch , leave = False ):
232
231
perform_learning_step (epoch )
233
232
if game .is_episode_finished ():
234
233
score = game .get_total_reward ()
@@ -246,7 +245,7 @@ def initialize_vizdoom(config_file_path):
246
245
print ("\n Testing..." )
247
246
test_episode = []
248
247
test_scores = []
249
- for test_episode in trange (test_episodes_per_epoch ):
248
+ for test_episode in trange (test_episodes_per_epoch , leave = False ):
250
249
game .new_episode ()
251
250
while not game .is_episode_finished ():
252
251
state = preprocess (game .get_state ().screen_buffer )
@@ -263,7 +262,6 @@ def initialize_vizdoom(config_file_path):
263
262
264
263
print ("Saving the network weigths to:" , model_savefile )
265
264
saver .save (session , model_savefile )
266
- # pickle.dump(get_all_param_values(net), open('weights.dump', "wb"))
267
265
268
266
print ("Total elapsed time: %.2f minutes" % ((time () - time_start ) / 60.0 ))
269
267
0 commit comments