TypeError: a bytes-like object is required, not 'tuple' deepQlearning

155 Views Asked by At

so I am trying to run the a deep q learning code from the book: Python Deep Learning: Exploring deep learning techniques, neural network architectures and GANs with PyTorch, Keras and TensorFlow. When I copy pasted the code, it was out of format so I tried to work on the indintations, spaces,...etc manually. When I run the code I get the following error:

TypeError                                 Traceback (most recent call last)
<ipython-input-365-8b0bd613b3e8> in <module>
      1 if __name__ == '__main__':
      2     session, q_network, t_network, t_net_updates, frame_proc, saver, train_op, env = initialize()
----> 3     deep_q_learning()

<ipython-input-363-ca3b0c8573ad> in deep_q_learning()
     49         if COMPRESS_ER:
     50             mini_batch = [pickle.loads(zlib.decompress(comp_item)) 
---> 51     for comp_item in mini_batch]
     52 
     53         states_batch, action_batch, reward_batch, next_states_batch, terminal_batch = map(np.array, zip(*mini_batch))

<ipython-input-363-ca3b0c8573ad> in <listcomp>(.0)
     49         if COMPRESS_ER:
     50             mini_batch = [pickle.loads(zlib.decompress(comp_item)) 
---> 51     for comp_item in mini_batch]
     52 
     53         states_batch, action_batch, reward_batch, next_states_batch, terminal_batch = map(np.array, zip(*mini_batch))

TypeError: a bytes-like object is required, not 'tuple'

Can you please explain and help me resolve the issue? I think that during the reformatting I may have missed something. If the error message is not enough I can provide the notebook.

Thanks in advance.

0

There are 0 best solutions below