race-simulation icon indicating copy to clipboard operation
race-simulation copied to clipboard

main_train_rl_agent_dqn.py: QNetwork cannot use save_weights()

Open aryanguls opened this issue 1 year ago • 0 comments

On running the main_train_rl_agent_dqn.py to train the VSE I get the following error -

INFO: Training progress: 90%...
INFO: Training progress: 100%...
Traceback (most recent call last):
  File "/Users/aryanguls/Desktop/CS239_Project/Open_Loop_Planning_for_QLearning/race-simulation/main_train_rl_agent_dqn.py", line 310, in <module>
    agent._target_q_network.save_weights(tmp_file_path_)
AttributeError: 'QNetwork' object has no attribute 'save_weights'. Did you mean: 'set_weights'?

And then on changing it to set_weights to see what that would do -

INFO: Training progress: 90%...
INFO: Training progress: 100%...
Traceback (most recent call last):
  File "/Users/aryanguls/Desktop/CS239_Project/Open_Loop_Planning_for_QLearning/race-simulation/main_train_rl_agent_dqn.py", line 310, in <module>
    agent._target_q_network.set_weights(tmp_file_path_)
  File "/Users/aryanguls/Desktop/CS239_Project/CS239/lib/python3.10/site-packages/keras/src/engine/base_layer.py", line 1797, in set_weights
    raise ValueError(
ValueError: You called `set_weights(weights)` on layer "TargetQNetwork" with a weight list of length 141, but the layer was expecting 6 weights. Provided weights: /Users/aryanguls/Desktop/CS239_Project/Open_Loop_P...

Any ideas on how can I solve this/which package dependencies might be causing the issue?

aryanguls avatar Mar 07 '24 01:03 aryanguls