LiangZhang1996 / DataLight-old

code for "Data Might be Enough: Bridge Real-World Traffic Signal Control Using Offline Reinforcement Learning"
GNU General Public License v3.0
10 stars 1 forks source link

cannot run your code: error occurs when running run_offline.py #2

Closed sallyqiansun closed 1 year ago

sallyqiansun commented 1 year ago

Call arguments received by layer 'dense_6' (type Dense): • inputs=tf.Tensor(shape=(100, 12, 6), dtype=float32) Traceback (most recent call last): File "miniconda3/envs/sq/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap self.run() File "miniconda3/envs/sq/lib/python3.7/multiprocessing/process.py", line 99, in run self._target(*self._args, **self._kwargs) File "datalight/utils/utils.py", line 20, in pipeline_wrapper ppl.run() File "datalight/utils/pipeline.py", line 111, in run memory=replay_memory) File "datalight/utils/pipeline.py", line 52, in generator_wrapper generator.train_model(memory) File "datalight/utils/generator.py", line 54, in train_model self.agents[0].train_network(memory) File "datalight/models/general_model_agent.py", line 244, in train_network tmp_cur_q = self.q_network(batch_Xs1) File "miniconda3/envs/sq/lib/python3.7/site-packages/keras/utils/traceback_utils.py", line 70, in error_handler raise e.with_traceback(filtered_tb) from None File "miniconda3/envs/sq/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 7215, in raise_from_not_ok_status raise core._status_to_exception(e) from None # pylint: disable=protected-access tensorflow.python.framework.errors_impl.InternalError: Exception encountered when calling layer 'dense_6' (type Dense).

LiangZhang1996 commented 1 year ago

It seems that the tensor recieved by 'dense_6' has a incorrect shape? Do you use the default memory dataset, or you just use your own dataset which may not be well organized.

sallyqiansun commented 1 year ago

Thanks for your quick response! I tried expert_mix.pkl and cycle_mix.pkl but neither works, do I need to uncomment the commented lines in run_offline.py in "LIST_STATE_FEATURE"?

LiangZhang1996 commented 1 year ago

No, The used features could not influence the running of the code, because I have well organized the code with flexible feature lengths with different feature combinations. I have two suggestions: 1. check the environment of Python, especially for TensorFlow and keras;

  1. forbid the multi-process with Python because it sometimes results in unexpected and unrecognized warning.
sallyqiansun commented 1 year ago

Thank you! The problem is solved.