calclavia / rl

Reinforcement learning algorithms implemented using Keras and OpenAI Gym
13 stars 1 forks source link

Error while saving (a3c example) #6

Open kfeeeeee opened 7 years ago

kfeeeeee commented 7 years ago

While trying the a3c example provided I encountered the following error:

Training model
Training ACAgentRunner...
[2017-04-10 16:30:50,699] Making new env: CartPole-v0
Training ACAgentRunner...
[2017-04-10 16:30:51,751] Making new env: CartPole-v0
Training ACAgentRunner...
[2017-04-10 16:30:52,808] Making new env: CartPole-v0
Training ACAgentRunner...
[2017-04-10 16:30:53,878] Making new env: CartPole-v0
Training ACAgentRunner...
[2017-04-10 16:30:54,935] Making new env: CartPole-v0
Training ACAgentRunner...
[2017-04-10 16:30:56,057] Making new env: CartPole-v0
Training ACAgentRunner...
[2017-04-10 16:30:57,118] Making new env: CartPole-v0
Training ACAgentRunner...
Exception in thread Thread-20:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/home/jsteffen/rl-master/rl/util.py", line 30, in save_worker
    agent.save(sess)
  File "/home/jsteffen/rl-master/rl/a3c.py", line 223, in save
    self.model.model.save_weights(self.model_path + '/model_' + str(self.save_count) + '.h5')
  File "/home/jsteffen/venv3/lib/python3.5/site-packages/keras/engine/topology.py", line 2465, in save_weights
    save_weights_to_hdf5_group(f, self.layers)
  File "/home/jsteffen/venv3/lib/python3.5/site-packages/keras/engine/topology.py", line 2715, in save_weights_to_hdf5_group
    weight_values = K.batch_get_value(symbolic_weights)
  File "/home/jsteffen/venv3/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 1977, in batch_get_value
    return get_session().run(ops)
  File "/home/jsteffen/venv3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 767, in run
    run_metadata_ptr)
  File "/home/jsteffen/venv3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 905, in _run
    raise RuntimeError('The Session graph is empty.  Add operations to the '
RuntimeError: The Session graph is empty.  Add operations to the graph before calling run().
calclavia commented 7 years ago

Thanks! I'll look into that.