Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix render_mode for ProcConcatVec envs #236

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions supersuit/vector/concat_vec_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, vec_env_fns, obs_space=None, act_space=None):
if not hasattr(vec_envs[i], "num_envs"):
vec_envs[i] = SingleVecEnv([lambda: vec_envs[i]])
self.metadata = self.vec_envs[0].metadata
self.render_mode = self.vec_envs[0].render_mode
self.observation_space = vec_envs[0].observation_space
self.action_space = vec_envs[0].action_space
tot_num_envs = sum(env.num_envs for env in vec_envs)
Expand Down
1 change: 1 addition & 0 deletions supersuit/vector/markov_vector_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def __init__(self, par_env, black_death=False):
"""
self.par_env = par_env
self.metadata = par_env.metadata
self.render_mode = par_env.unwrapped.render_mode
self.observation_space = par_env.observation_space(par_env.possible_agents[0])
self.action_space = par_env.action_space(par_env.possible_agents[0])
assert all(
Expand Down
9 changes: 4 additions & 5 deletions supersuit/vector/multiproc_vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,12 @@ def async_loop(
elif name == "env_is_wrapped":
comp_infos = vec_env.env_is_wrapped(data)

elif name == "render":
render_result = vec_env.render(data)
if data == "rgb_array":
comp_infos = render_result

else:
raise AssertionError("bad tuple instruction name: " + name)
elif instr == "render":
render_result = vec_env.render()
if vec_env.render_mode == "rgb_array":
comp_infos = render_result
elif instr == "terminate":
return
else:
Expand Down
1 change: 1 addition & 0 deletions supersuit/vector/single_vec_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class SingleVecEnv:
def __init__(self, gym_env_fns, *args):
assert len(gym_env_fns) == 1
self.gym_env = gym_env_fns[0]()
self.render_mode = self.gym_env.render_mode
self.observation_space = self.gym_env.observation_space
self.action_space = self.gym_env.action_space
self.num_envs = 1
Expand Down
2 changes: 1 addition & 1 deletion test/dummy_aec_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def __init__(self, observations, observation_spaces, action_spaces):
super().__init__()
self._observations = observations
self._observation_spaces = observation_spaces

self.render_mode = None
self.agents = sorted([x for x in observation_spaces.keys()])
self.possible_agents = self.agents[:]
self._agent_selector = agent_selector(self.agents)
Expand Down
Loading