maddpg
maddpg copied to clipboard
Error when setting display to true
When I set display = True I get the error below. These are the versions I have for the known dependencies: Python (3.6) OpenAI gym (0.10.5) tensorflow (1.8.0) numpy (1.14.5)
File "C:\Users\AAJ\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1322, in _do_call
return fn(*args)
File "C:\Users\AAJ\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1307, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "C:\Users\AAJ\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1409, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [4,64] rhs shape= [16,64]
[[Node: save/Assign_39 = Assign[T=DT_FLOAT, _class=["loc:@agent_0/target_p_func/fully_connected/weights"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](agent_0/target_p_func/fully_connected/weights, save/RestoreV2:39)]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "train.py", line 193, in <module>
train(arglist)
File "train.py", line 96, in train
U.load_state(arglist.load_dir)
File "d:\red mirror\dr so\multi agent examples\maddpg-master\maddpg\common\tf_util.py", line 230, in load_state
saver.restore(get_session(), fname)
File "C:\Users\AAJ\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\training\saver.py", line 1802, in restore
{self.saver_def.filename_tensor_name: save_path})
File "C:\Users\AAJ\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 900, in run
run_metadata_ptr)
File "C:\Users\AAJ\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1135, in _run
feed_dict_tensor, options, run_metadata)
File "C:\Users\AAJ\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1316, in _do_run
run_metadata)
File "C:\Users\AAJ\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1335, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [4,64] rhs shape= [16,64]
[[Node: save/Assign_39 = Assign[T=DT_FLOAT, _class=["loc:@agent_0/target_p_func/fully_connected/weights"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](agent_0/target_p_func/fully_connected/weights, save/RestoreV2:39)]]
Caused by op 'save/Assign_39', defined at:
File "train.py", line 193, in <module>
train(arglist)
File "train.py", line 96, in train
U.load_state(arglist.load_dir)
File "d:\red mirror\dr so\multi agent examples\maddpg-master\maddpg\common\tf_util.py", line 229, in load_state
saver = tf.train.Saver()
File "C:\Users\AAJ\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\training\saver.py", line 1338, in __init__
self.build()
File "C:\Users\AAJ\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\training\saver.py", line 1347, in build
self._build(self._filename, build_save=True, build_restore=True)
File "C:\Users\AAJ\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\training\saver.py", line 1384, in _build
build_save=build_save, build_restore=build_restore)
File "C:\Users\AAJ\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\training\saver.py", line 835, in _build_internal
restore_sequentially, reshape)
File "C:\Users\AAJ\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\training\saver.py", line 494, in _AddRestoreOps
assign_ops.append(saveable.restore(saveable_tensors, shapes))
File "C:\Users\AAJ\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\training\saver.py", line 185, in restore
self.op.get_shape().is_fully_defined())
File "C:\Users\AAJ\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\ops\state_ops.py", line 283, in assign
validate_shape=validate_shape)
File "C:\Users\AAJ\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\ops\gen_state_ops.py", line 63, in assign
use_locking=use_locking, name=name)
File "C:\Users\AAJ\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "C:\Users\AAJ\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 3392, in create_op
op_def=op_def)
File "C:\Users\AAJ\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\ops.py", line 1718, in __init__
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
InvalidArgumentError (see above for traceback): Assign requires shapes of both tensors to match. lhs shape= [4,64] rhs shape= [16,64]
[[Node: save/Assign_39 = Assign[T=DT_FLOAT, _class=["loc:@agent_0/target_p_func/fully_connected/weights"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](agent_0/target_p_func/fully_connected/weights, save/RestoreV2:39)]]
Did you find a solution?
Hi I solved this problem by using python train.py --scenario simple --display
instead.
--diaplay is set as a bool switch, so changing the default bool of it won't work.
You can find more info about it by google argparse action store_true
Good day!
delete this code :if arglist.display or arglist.restore or arglist.benchmark: add this code: if arglist.restore or arglist.benchmark: