You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exact command to reproduce: python rllib_cartpole.py for the following file
importgym.envs.classic_controlfromgym.spacesimportTuple, DiscreteimportrayfromrayimporttuneclassCustomCartpole(gym.envs.classic_control.CartPoleEnv):
"""Add a dimension to the cartpole action space that is ignored."""def__init__(self, env_config):
super().__init__()
# if override_actions is false this is just the Cartpole environmentself.override_actions=env_config['override_actions']
ifself.override_actions:
# 2 is the environment's normal action space# 4 is just a dummy number to give it an extra dimensionself.original_action_space=self.action_spaceself.action_space=Tuple([Discrete(2), Discrete(4)])
self.tuple_action_space=self.action_spacedefstep(self, action):
# call the cartpole environment with the original actionifself.override_actions:
self.action_space=self.original_action_spacereturnsuper().step(action[0])
else:
returnsuper().step(action)
defmain():
ray.init()
tune.run(
"PPO",
stop={"episode_reward_mean": 50},
config={
"env": CustomCartpole,
"env_config": {'override_actions': True},
"num_gpus": 0,
"num_workers": 1,
"eager": False,
"evaluation_interval": 1,
"evaluation_config": {
"explore": False,
},
"framework": "torch",
},
)
if__name__=='__main__':
main()
I have verified my script runs in a clean environment and reproduces the issue.
I have verified the issue also occurs with the latest wheels.
The text was updated successfully, but these errors were encountered:
ThomasLecat
added
bug
Something that is supposed to be working; but isn't
triage
Needs triage (eg: priority, bug/not-bug, and owning component)
labels
Aug 20, 2020
ericl
added
rllib
P2
Important issue, but not time-critical
and removed
triage
Needs triage (eg: priority, bug/not-bug, and owning component)
labels
Aug 20, 2020
The proposed fix makes sense to me. We could alternatively try to get the batch dimension of the tuple, but I don't see an existing helper method for that, so your proposal is probably simpler.
System information
What is the problem?
When using tuple action distributions (as advised in #6372) and exploration is disabled, the line:
ray/rllib/utils/exploration/stochastic_sampling.py
Line 75 in a462ae2
from
_get_torch_exploration_action
raises the following exception:A simple fix that supports any type of distribution would be:
I can submit a PR if it helps.
Reproduction (REQUIRED)
Exact command to reproduce: python
rllib_cartpole.py
for the following fileThe text was updated successfully, but these errors were encountered: