Giter Site home page Giter Site logo

Comments (24)

j8lp avatar j8lp commented on August 26, 2024

I'm getting this same error too. I'm new to tensorflow, but doesn't this mean that saved.data doesn't match the .checkpoint file?
InvalidArgumentError (see above for traceback): Assign requires shapes of both tensors to match. lhs shape= [4] rhs shape= [6] [[Node: save/Assign_3 = Assign[T=DT_FLOAT, _class=["loc:@deepq/q_func/action_value/fully_connected_1/biases"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/gpu:0"](deepq/q_func/action_value/fully_connected_1/biases, save/RestoreV2_3/_1)]]

from baselines.

siemanko avatar siemanko commented on August 26, 2024

Which version of Tensorflow are you using?

from baselines.

j8lp avatar j8lp commented on August 26, 2024

1.1.0 version for me

from baselines.

yenchenlin avatar yenchenlin commented on August 26, 2024

1.1.0 version for me

same here.

from baselines.

siemanko avatar siemanko commented on August 26, 2024

I have a hypothesis, but can you tell me your output of gym.make("Breakout-v4").action_space ?

from baselines.

yenchenlin avatar yenchenlin commented on August 26, 2024

I got:
Discrete(4)

from baselines.

j8lp avatar j8lp commented on August 26, 2024

same here. What's your hypothesis?

If it helps, here is what I get when I load the saved model and run tf.global_variables(). I'm new to tensorflow, so let me know if there is a better command I can use to debug.

[<tf.Variable 'deepq/eps:0' shape=() dtype=float32_ref>, <tf.Variable 'deepq/q_func/convnet/Conv/weights:0' shape=(8, 8, 4, 32) dtype=float32_ref>, <tf.Variable 'deepq/q_func/convnet/Conv/biases:0' shape=(32,) dtype=float32_ref>, <tf.Variable 'deepq/q_func/convnet/Conv_1/weights:0' shape=(4, 4, 32, 64) dtype=float32_ref>, <tf.Variable 'deepq/q_func/convnet/Conv_1/biases:0' shape=(64,) dtype=float32_ref>, <tf.Variable 'deepq/q_func/convnet/Conv_2/weights:0' shape=(3, 3, 64, 64) dtype=float32_ref>, <tf.Variable 'deepq/q_func/convnet/Conv_2/biases:0' shape=(64,) dtype=float32_ref>, <tf.Variable 'deepq/q_func/state_value/fully_connected/weights:0' shape=(7744, 512) dtype=float32_ref>, <tf.Variable 'deepq/q_func/state_value/fully_connected/biases:0' shape=(512,) dtype=float32_ref>, <tf.Variable 'deepq/q_func/state_value/fully_connected_1/weights:0' shape=(512, 1) dtype=float32_ref>, <tf.Variable 'deepq/q_func/state_value/fully_connected_1/biases:0' shape=(1,) dtype=float32_ref>, <tf.Variable 'deepq/q_func/action_value/fully_connected/weights:0' shape=(7744, 512) dtype=float32_ref>, <tf.Variable 'deepq/q_func/action_value/fully_connected/biases:0' shape=(512,) dtype=float32_ref>, <tf.Variable 'deepq/q_func/action_value/fully_connected_1/weights:0' shape=(512, 6) dtype=float32_ref>, <tf.Variable 'deepq/q_func/action_value/fully_connected_1/biases:0' shape=(6,) dtype=float32_ref>, <tf.Variable 'deepq/target_q_func/convnet/Conv/weights:0' shape=(8, 8, 4, 32) dtype=float32_ref>, <tf.Variable 'deepq/target_q_func/convnet/Conv/biases:0' shape=(32,) dtype=float32_ref>, <tf.Variable 'deepq/target_q_func/convnet/Conv_1/weights:0' shape=(4, 4, 32, 64) dtype=float32_ref>, <tf.Variable 'deepq/target_q_func/convnet/Conv_1/biases:0' shape=(64,) dtype=float32_ref>, <tf.Variable 'deepq/target_q_func/convnet/Conv_2/weights:0' shape=(3, 3, 64, 64) dtype=float32_ref>, <tf.Variable 'deepq/target_q_func/convnet/Conv_2/biases:0' shape=(64,) dtype=float32_ref>, <tf.Variable 'deepq/target_q_func/state_value/fully_connected/weights:0' shape=(7744, 512) dtype=float32_ref>, <tf.Variable 'deepq/target_q_func/state_value/fully_connected/biases:0' shape=(512,) dtype=float32_ref>, <tf.Variable 'deepq/target_q_func/state_value/fully_connected_1/weights:0' shape=(512, 1) dtype=float32_ref>, <tf.Variable 'deepq/target_q_func/state_value/fully_connected_1/biases:0' shape=(1,) dtype=float32_ref>, <tf.Variable 'deepq/target_q_func/action_value/fully_connected/weights:0' shape=(7744, 512) dtype=float32_ref>, <tf.Variable 'deepq/target_q_func/action_value/fully_connected/biases:0' shape=(512,) dtype=float32_ref>, <tf.Variable 'deepq/target_q_func/action_value/fully_connected_1/weights:0' shape=(512, 6) dtype=float32_ref>, <tf.Variable 'deepq/target_q_func/action_value/fully_connected_1/biases:0' shape=(6,) dtype=float32_ref>, <tf.Variable 'deepq_1/beta1_power:0' shape=() dtype=float32_ref>, <tf.Variable 'deepq_1/beta2_power:0' shape=() dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/convnet/Conv/weights/Adam:0' shape=(8, 8, 4, 32) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/convnet/Conv/weights/Adam_1:0' shape=(8, 8, 4, 32) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/convnet/Conv/biases/Adam:0' shape=(32,) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/convnet/Conv/biases/Adam_1:0' shape=(32,) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/convnet/Conv_1/weights/Adam:0' shape=(4, 4, 32, 64) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/convnet/Conv_1/weights/Adam_1:0' shape=(4, 4, 32, 64) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/convnet/Conv_1/biases/Adam:0' shape=(64,) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/convnet/Conv_1/biases/Adam_1:0' shape=(64,) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/convnet/Conv_2/weights/Adam:0' shape=(3, 3, 64, 64) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/convnet/Conv_2/weights/Adam_1:0' shape=(3, 3, 64, 64) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/convnet/Conv_2/biases/Adam:0' shape=(64,) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/convnet/Conv_2/biases/Adam_1:0' shape=(64,) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/state_value/fully_connected/weights/Adam:0' shape=(7744, 512) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/state_value/fully_connected/weights/Adam_1:0' shape=(7744, 512) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/state_value/fully_connected/biases/Adam:0' shape=(512,) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/state_value/fully_connected/biases/Adam_1:0' shape=(512,) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/state_value/fully_connected_1/weights/Adam:0' shape=(512, 1) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/state_value/fully_connected_1/weights/Adam_1:0' shape=(512, 1) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/state_value/fully_connected_1/biases/Adam:0' shape=(1,) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/state_value/fully_connected_1/biases/Adam_1:0' shape=(1,) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/action_value/fully_connected/weights/Adam:0' shape=(7744, 512) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/action_value/fully_connected/weights/Adam_1:0' shape=(7744, 512) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/action_value/fully_connected/biases/Adam:0' shape=(512,) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/action_value/fully_connected/biases/Adam_1:0' shape=(512,) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/action_value/fully_connected_1/weights/Adam:0' shape=(512, 6) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/action_value/fully_connected_1/weights/Adam_1:0' shape=(512, 6) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/action_value/fully_connected_1/biases/Adam:0' shape=(6,) dtype=float32_ref>, <tf.Variable 'deepq/deepq/q_func/action_value/fully_connected_1/biases/Adam_1:0' shape=(6,) dtype=float32_ref>]

from baselines.

siemanko avatar siemanko commented on August 26, 2024

Ok, that is very weird. For me it is Discrete(6). Potential fix is to update your atari-py. Also your gym version is 0.9.1, right?

from baselines.

yenchenlin avatar yenchenlin commented on August 26, 2024

Hello @siemanko , I tried both

pip install gym[atari] --upgrade
pip install atari-py --upgrade

but just got Requirement already up-to-date and the action space is still Discrete(4).

from baselines.

siemanko avatar siemanko commented on August 26, 2024

What about pip freeze | egrep '(gym=|atari-py=)'

from baselines.

yenchenlin avatar yenchenlin commented on August 26, 2024
atari-py==0.1.1
gym==0.9.1

from baselines.

j8lp avatar j8lp commented on August 26, 2024

same here. I'm guessing that we must have the wrong breakout environment installed somehow

from baselines.

siemanko avatar siemanko commented on August 26, 2024

Ok, definitely update atari-py. I am closing the issue, but let us know if it does not work.

from baselines.

j8lp avatar j8lp commented on August 26, 2024

So I tried reinstalling atari-py, and the Breakout environment still only has an actionspace of 4. I'm not sure if there is something wrong the .bin file or the interface. It's kind of a blackbox.

But I noticed that my Pong environment has an actionspace of 6. So if you replace Breakout with Pong, it works:

python -m baselines.deepq.experiments.atari.enjoy --model-dir /tmp/models/mo del-atari-prior-duel-breakout-1 --env Pong --dueling

Is Pong supposed to have an actionspace of 6? If not, then there is probably some incompatibility between my system and atari.

from baselines.

abhibhav14 avatar abhibhav14 commented on August 26, 2024

I had atari-py 0.0.18 before, and both Breakout and Pong had action spaces Discrete(6).
Upgrading to atari-py 0.1.1 actually broke this, and now my Breakout action space is Discrete(4).
I am using gym 0.9.1 with python3.
@j8lp Both those envs are supposed to have six actions each, No-op, right, left(or up/down), fire, fire+right and fire+left.

from baselines.

yenchenlin avatar yenchenlin commented on August 26, 2024

Hello @siemanko ,

can you tell me your atari-py version?

from baselines.

siemanko avatar siemanko commented on August 26, 2024

Yeah, it seems like mine is actually a bit outdated. It's atari-py==0.0.20.

from baselines.

j8lp avatar j8lp commented on August 26, 2024

I see. So the solution is to downgrade to 0.0.20? I'm going to try downgrading my Atari when I get back from work.

from baselines.

ViktorM avatar ViktorM commented on August 26, 2024

I've hit the same error:
python -m baselines.deepq.experiments.atari.download_model --blob model-atari-prior-duel-breakout-1 --model-dir /tmp/models
Downloading model-atari-prior-duel-breakout-1 to /tmp/models...
97% (125829120 of 128538210) |################################################## | Elapsed Time: 0:03:28 ETA: 0:00:04
(deep-rl) D:\Stanford\Deep_RL>python -m baselines.deepq.experiments.atari.enjoy --model-dir /tmp/models/model-atari-prior-duel-breakout-1 --env Breakout --dueling
2017-06-15 16:08:42.543058: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations.
2017-06-15 16:08:42.543284: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE2 instructions, but these are available on your machine and could speed up CPU computations.
2017-06-15 16:08:42.544578: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.
2017-06-15 16:08:42.545392: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-06-15 16:08:42.547625: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-06-15 16:08:42.550167: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-06-15 16:08:42.550868: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-06-15 16:08:42.551448: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
[2017-06-15 16:08:42,558] Making new env: BreakoutNoFrameskip-v4
Traceback (most recent call last):

File "C:\Users\Viktor\Anaconda3\envs\deep-rl\lib\site-packages\tensorflow\python\client\session.py", line 1039, in _do_call
  return fn(*args)
File "C:\Users\Viktor\Anaconda3\envs\deep-rl\lib\site-packages\tensorflow\python\client\session.py", line 1021, in _run_fn
  status, run_metadata)
File "C:\Users\Viktor\Anaconda3\envs\deep-rl\lib\contextlib.py", line 66, in __exit__
  next(self.gen)
File "C:\Users\Viktor\Anaconda3\envs\deep-rl\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 466, in raise_exception_on_not_ok_status
  pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [512,4] rhs shape= [512,6]
       [[Node: save/Assign_4 = Assign[T=DT_FLOAT, _class=["loc:@deepq/q_func/action_value/fully_connected_1/weights"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/cpu:0"](deepq/q_func/action_value/fully_connected_1/weights, save/RestoreV2_4)]]

So what Atari version is required?

from baselines.

ViktorM avatar ViktorM commented on August 26, 2024

My is atari-py==0.1.1

from baselines.

j8lp avatar j8lp commented on August 26, 2024

from baselines.

ViktorM avatar ViktorM commented on August 26, 2024

Yep, pong environment download and play are working for me.

from baselines.

DanielTakeshi avatar DanielTakeshi commented on August 26, 2024

Yes, this works for me, downgrading to atari-py 0.0.20. This should probably go in the setup.py file.

from baselines.

BNSneha avatar BNSneha commented on August 26, 2024

Neither atari 0.0.20 nor 0.1.1 gets rid of the tensor dimensions mismatch error. What else could be wrong?

from baselines.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.