-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
set_env_attr and get_env_attr not working with current gym release #688
Labels
bug
Something isn't working
Comments
Could you please provide an example here to show the bug? Thanks! |
Sure! import gym
from tianshou.env import DummyVectorEnv
if __name__ == "__main__":
def create_env():
env = gym.make("CartPole-v1")
print(type(env)) # <class 'gym.wrappers.time_limit.TimeLimit'>
return env
train_envs = DummyVectorEnv(
[create_env]
)
train_envs.set_env_attr("test_attribute", 1337)
print(train_envs.get_env_attr("test_attribute")) # Returns: [1337]
print(hasattr(train_envs.workers[0].env, "test_attribute")) # Returns: True
print(hasattr(train_envs.workers[0].env.unwrapped, "test_attribute")) # Returns: False You can see that |
Fixed in #695 |
Trinkle23897
added a commit
that referenced
this issue
Jul 15, 2022
Cool, thanks! |
BFAnas
pushed a commit
to BFAnas/tianshou
that referenced
this issue
May 5, 2024
…ml#695) * fix thu-ml#689 * fix thu-ml#672 * refactor RMS class * fix thu-ml#688
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For completeness, I struggled to get your env.set_env_attr function to work. I found the error on OpenAI gym's side (see: openai/gym#2952). Maybe you could mention this issue somewhere in the documentation. I use gym 0.24.1.
The text was updated successfully, but these errors were encountered: