ppo standard example, with other environment not working (other shape)
Closed this issue · 2 comments
so i tried the standard code for the ppo for another environment, but the input shape is 3 dimensional instead of 1 dimensional, so i wonder if there is a way to let the ppo know what the shape is and how i would modify my code to be able to at least run it (or be able to train it well in the best case)
this is the code where i replaced the 'LunarLander-v2' environment
env_fn = lambda : gym.make('CarRacing-v0')
ac_kwargs = dict(hidden_sizes=[64,64],activation=tf.nn.relu,)
logger_kwargs = dict(output_dir="spinupexp\"+getsavepath(), exp_name='ppo_experiment')
ppo(env_fn=env_fn,
ac_kwargs=ac_kwargs,
steps_per_epoch=5000,
epochs=250,
logger_kwargs=logger_kwargs)
the inputshape for the environments are
(8,) lunar lander
(96, 96, 3) racing car
trace back gives me
ValueError: Can not squeeze dim[1], expected a dimension of 1, got 96 for 'v/Squeeze' (op: 'Squeeze') with input shapes: [?,96,96,1].
also i can't find any docu for hidden_sizes, maybe i'm just blind or it's prerequisite, but if anyone could explain me what it is, or point to a ressource, which is explaining i'd also be very thankful
any help is appreciated 💯
Hi, I met similar shape problems when trying to run in other environments. I modified the input's shape to make it compatible. Here is my solution and hope it could help you: #115
@quarterpastsix Hi! The best way to do this would be for you to write a custom actor_critic
function which uses appropriately-sized convolutional neural networks to process the image observations from the CarRacing-v0
task. The default actor_critic
uses a multi-layer perceptron architecture, which cannot handle image-like inputs.