Open TheTrash opened 4 years ago
Related to #11 , exhibits the same behaviour of adding a dimension. For a quick fix, add a squeeze layer via keras.backend.squeeze
I appreciate your response and your explaination. Now, i've apparently solved my issued searching on keras-rl( not 2 ) git some soluction in various issues.
And here is my ( for now ) solution #229 I hope this can be quite helpful
For the next people that will have this issue this is how i've changed the method in dqn.py ( and i suppose in the other agent of this library )
#on dqn.py
def process_state_batch(self, batch):
#batch = numpy.array(batch)
#print(batch)
if self.processor is None:
#return numpy.squeeze(batch, axis=1)
return batch
return self.processor.process_state_batch(batch)
I suppose the error is in the numpy.array that add the extra dimension for some reasons. But, as you can see, i'm not using the processor so i'm not sure this can be valid for the processor's method.
After some searching, I found the issue in the function compute_q_values In the function, the state value is being forcefully put in another array.
def compute_q_values(self, state):
q_values = self.compute_batch_q_values([state]).flatten()
assert q_values.shape == (self.nb_actions,)
return q_values
After removing the explicit list conversion. It works fine for me.
So this is my setting:
keras==2.3.1 keras-rl2 tensorflow-gpu==2.0.0-beta1 numpy==1.16.4
And when i fit the DQN agent, my model go on full craziness
This is the error :
But it start here:
row #169 core.py
I'm quite new in this library, maybe i'm missing something