Closed Jaage closed 8 months ago
Hi @araffin, if this is a duplicate, can you please provide the link to the original? And what checkboxes need more clarification?
I have checked that there is no similar issue in the repo
Try harder next time =)
Duplicate of https://github.com/DLR-RM/stable-baselines3/issues/1509, #1295 and #913
but it seems we need to update the env checker to warn when users are using dict obs space.
Am I doing something wrong, is there an automatic way to handle this somewhere that I have missed, or do I need to manually map my Discrete observation to start from 0 before?
yes or you can use a wrapper.
but it seems we need to update the env checker to warn when users are using dict obs space.
The env checker was up to date, you were using the Discrete
constructor the wrong way (second argument is not start
)
š Bug
I have a
spaces.Discrete(19, 2)
observation as part of my observation. The documentation for the Discrete space lists the space of possible values as {a, a+1, ..., a+n-1}, thus my observation space for this value will be {2, 3, ..., 20}. However, model.learn() does not seem to account for this non-zero start, as it errors during the one hot encoding because torch.nn.functional.one_hot creates a tensor from 0 to observation_space.n:return F.one_hot(obs.long(), num_classes=int(observation_space.n)).float()
. So torch creates a tensor of length 19, and thus errors when trying to one-hot encode the value 20.Am I doing something wrong, is there an automatic way to handle this somewhere that I have missed, or do I need to manually map my Discrete observation to start from 0 before?
Thank you.
Code example
Relevant log output / Error message
System Info
Checklist