Closed liamf555 closed 3 years ago
Looking over the code for VecNormalize, it seems like that if obs space is Dict
, it assumes all subspaces are Box
and applies normalization. This should be updated only to apply normalization on Box
spaces to make it work with your case. @araffin does this sound reasonable? At the very least it should throw an exception if a subspace is not a Box
.
Hello,
yes I'm aware of this issue.
I think we either need to allow specification of excluded_keys
or included_keys
to the constructor.
I would appreciate a PR that solves this issue ;)
I recently faced exactly the same issue. I opened PR with the solution that I used, though I'm not sure if the new param name is clear enough from API perspective. Let me know WDYT, I will be more than glad to update.
Important Note: We do not do technical support, nor consulting and don't answer personal questions per email. Please post your question on the RL Discord, Reddit or Stack Overflow in that case.
Question
Is it possible to mix box and discrete spaces in a dict observation, whilst also using the vecnormalise wrapper?
Additional context
I'm attempting to build a dict observation consisting of a box space and a discrete space for a custom env, specified as:
I am using PPO, and so vectorise and vecnormalise the environment. The discrete observations will start out as 1, and will at some point become 0. This causes the normalised observations to become negative. In the example below, I am running PPO with 8 envs, so 7 of the discrete values are 1 and one env the discrete value is 0, causing the negative value when normalised:
which causes an error in
preprocess_obs
, specifically the lines:which gives a RuntimeError:
Is what I am trying to do okay, how can I overcome this issue?
Checklist