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
Observation spaces that are registered using add_derived_observation_space() are unusable during construction time.
To Reproduce
Steps to reproduce the behavior:
In [1]: importcompiler_gymIn [2]: env=compiler_gym.make("llvm-v0", observation_space="AutophaseDict")
---------------------------------------------------------------------------LookupErrorTraceback (mostrecentcalllast)
<ipython-input-2-1bde98f62255>in<module>---->1env=compiler_gym.make("llvm-v0", observation_space="AutophaseDict")
~/anaconda3/envs/compiler_gym/lib/python3.8/site-packages/compiler_gym-0.2.0-py3.8.egg/compiler_gym/util/registration.pyinmake(id, **kwargs)
14defmake(id: str, **kwargs):
15"""Equivalent to :code:`gym.make()`."""--->16returngym.make(id, **kwargs)
1718~/anaconda3/envs/compiler_gym/lib/python3.8/site-packages/gym/envs/registration.pyinmake(id, **kwargs)
143144defmake(id, **kwargs):
-->145returnregistry.make(id, **kwargs)
146147defspec(id):
~/anaconda3/envs/compiler_gym/lib/python3.8/site-packages/gym/envs/registration.pyinmake(self, path, **kwargs)
88logger.info('Making new env: %s', path)
89spec=self.spec(path)
--->90env=spec.make(**kwargs)
91# We used to have people override _reset/_step rather than92# reset/step. Set _gym_disable_underscore_compat = True on~/anaconda3/envs/compiler_gym/lib/python3.8/site-packages/gym/envs/registration.pyinmake(self, **kwargs)
58else:
59cls=load(self.entry_point)
--->60env=cls(**_kwargs)
6162# Make the environment aware of which spec it came from.~/anaconda3/envs/compiler_gym/lib/python3.8/site-packages/compiler_gym-0.2.0-py3.8.egg/compiler_gym/envs/llvm/llvm_env.pyin__init__(self, benchmark, datasets_site_path, *args, **kwargs)
69# the LLVM service and are not included by the pip-installed package.70download_llvm_files()
--->71super().__init__(
72*args,
73**kwargs,
~/anaconda3/envs/compiler_gym/lib/python3.8/site-packages/compiler_gym-0.2.0-py3.8.egg/compiler_gym/envs/compiler_env.pyin__init__(self, service, rewards, datasets, benchmark, observation_space, reward_space, action_space, connection_settings, service_connection, logger)
316self.observation_space_spec: Optional[ObservationSpaceSpec] =None317self.reward_space_spec: Optional[Reward] =None-->318self.observation_space=observation_space319self.reward_space=reward_space320~/anaconda3/envs/compiler_gym/lib/python3.8/site-packages/compiler_gym-0.2.0-py3.8.egg/compiler_gym/envs/compiler_env.pyinobservation_space(self, observation_space)
541ifobservation_space:
542ifobservation_spacenotinself.observation.spaces:
-->543raiseLookupError(f"Observation space not found: {observation_space}")
544self.observation_space_spec=self.observation.spaces[observation_space]
545else:
LookupError: Observationspacenotfound: AutophaseDict
The workaround is to first construct the environment and then assign the observation space:
In [3]: env=compiler_gym.make("llvm-v0")
In [4]: env.observation_space="AutophaseDict"
Expected behavior
In [1]: importcompiler_gymIn [2]: env=compiler_gym.make("llvm-v0", observation_space="AutophaseDict")
Environment
Please fill in this checklist:
CompilerGym: v0.2.0
How you installed CompilerGym (conda, pip, source): source
OS: macOS
Python version: 3.8
Build command you used (if compiling from source): make install
The text was updated successfully, but these errors were encountered:
🐛 Bug
Observation spaces that are registered using
add_derived_observation_space()
are unusable during construction time.To Reproduce
Steps to reproduce the behavior:
The workaround is to first construct the environment and then assign the observation space:
Expected behavior
Environment
Please fill in this checklist:
The text was updated successfully, but these errors were encountered: