NotAnyMike / gym

An improvement of CarRacing-v0 from OpenAI Gym in order to make the environment complex enough for Hierarchical Reinforcement Learning
https://notanymike.github.io/
Other
70 stars 24 forks source link

Converting to NHWC #33

Closed gpgn closed 5 years ago

gpgn commented 5 years ago

I like the work you did to adapt the CarRacing env and I'd like to use it, but I'm running into an issue with the tensor shape.

Following https://notanymike.github.io/Solving-CarRacing/ Ive got everything set up and I can do my own training, but I was hoping to use your pretrained weights (the weights_final.pkl you link to). You do mention:

in my case the dimensions changes to NxCxWxH

and:

if you are going to use it don’t forget the NHWC configuration

Currently I'm running into the following error, I assume because of above issue:

Traceback (most recent call last):
  File ".\agents\driver.py", line 32, in <module>
    model.set_env(env)
  File "C:\Python37\lib\site-packages\stable_baselines\common\base_class.py", line 96, in set_env
    "Error: the environment passed must have at least the same observation space as the model was trained on."
AssertionError: Error: the environment passed must have at least the same observation space as the model was trained on.

Is it possible to use your pre-trained weights, and what would I need to adjust to get it working? Thanks so much

PS: I noticed the following warning:

Warning: Due to some internal error on the stable version of tensorflow for CPU this code only works for GPU implementations: I am working in a solution

I currently only have CPU available, would that interfere with above?

NotAnyMike commented 5 years ago

Because of the problem with tf in cpu, the easiest way was to use the NHWC, the weights you have there have the NCHW config, so the dimensions won't match. I actually have a much more optimised model than those final weights and they have the NHWC config, so no need to change anything, the default config will work.

I will update the post and the weights this weekend.

Pd: if you are going to train a model using a complex map I recommend using built maps because it is much faster than creating the maps online

NotAnyMike commented 5 years ago

I updated the weights to work with NHWC and added an extra step in the instructions in the blog, let me know if it works.

Cheers