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

Update compatibility with gym environment #344

Open
delara38 opened this issue Jun 2, 2023 · 2 comments
Open

Update compatibility with gym environment #344

delara38 opened this issue Jun 2, 2023 · 2 comments

Comments

@delara38
Copy link

delara38 commented Jun 2, 2023

Hi,

the gym environments now return the 5-tuple (next state, action, reward, terminate, truncate, info) instead of their previous 4-tuple setup; however, RLHive still expects their previous setup at each transition and needs to be ammended.

I believe that all that is needed is to the step function in gym_env.py from

    def step(self, action):
        observation, reward, done, info = self._env.step(action)
        self._turn = (self._turn + 1) % self._num_players
        return observation, reward, done, self._turn, info

to (assuming that the rest of RLHive will continue to only return a done boolean)

    def step(self, action):
        observation, reward, terminate, truncate, info = self._env.step(action)
        done = terminate or truncate
        self._turn = (self._turn + 1) % self._num_players
        return observation, reward, done, self._turn, info
@dapatil211
Copy link
Collaborator

Hi @delara38,

Yes you are right. We have made these changes in the dev branch of the repo, and in fact are planning on making the return type of the environment a bit more structured with dataclasses. These changes will be integrated into the main branch and the next release in the next 2-3 weeks. For now, if you need the termination/truncation change, please use the dev branch.

@delara38
Copy link
Author

delara38 commented Jun 5, 2023

great thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants