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

Issue with env.step #6

Open
sayantanauddy opened this issue Jan 3, 2023 · 3 comments
Open

Issue with env.step #6

sayantanauddy opened this issue Jan 3, 2023 · 3 comments

Comments

@sayantanauddy
Copy link

First of all, thanks for making this repository available to everyone!

I am facing a problem related to running continual world and maybe you can help. I followed the docker instructions in the readme and set up and built the container. Inside the container, when I run

python3 run_single.py --seed 0 --steps 2e3 --log_every 250 --task hammer-v1 --logger_output tsv tensorboard

I get the following error, which complains about the number of arguments returned by env.step():

/usr/local/lib/python3.6/dist-packages/gym/spaces/box.py:127: UserWarning: WARN: Box bound precision lowered by casting to float32
  logger.warn(f"Box bound precision lowered by casting to {self.dtype}")
Traceback (most recent call last):
  File "run_single.py", line 62, in <module>
    main(logger, **args)
  File "run_single.py", line 53, in main
    sac.run()
  File "/continualworld/continualworld/sac/sac.py", line 560, in run
    next_obs, reward, done, info = self.env.step(action)
  File "/continualworld/continualworld/utils/wrappers.py", line 19, in step
    obs, reward, done, info = self.env.step(action)
  File "/usr/local/lib/python3.6/dist-packages/gym/wrappers/time_limit.py", line 50, in step
    observation, reward, terminated, truncated, info = self.env.step(action)
ValueError: not enough values to unpack (expected 5, got 4)

I edited the file /usr/local/lib/python3.6/dist-packages/gym/wrappers/time_limit.py and removed the truncated return value and after this the script run_single.py runs fine.

    def step(self, action):
        """Steps through the environment and if the number of steps elapsed exceeds ``max_episode_steps`` then truncate.

        Args:
            action: The environment step action

        Returns:
            The environment step ``(observation, reward, terminated, truncated, info)`` with `truncated=True`
            if the number of steps elapsed >= max episode steps

        """
        observation, reward, terminated, info = self.env.step(action)
        #observation, reward, terminated, truncated, info = self.env.step(action)
        self._elapsed_steps += 1

        if self._elapsed_steps >= self._max_episode_steps:
            truncated = True

        # return observation, reward, terminated, truncated, info
        return observation, reward, terminated, info

I am not sure if this is an issue with a version of gym or something else. I am pretty sure I followed the exact steps described in the readme. Perhaps you can suggest a remedy so that I can run the example code without any hacks like changing the internals of llibrary functions? Thanks in advance.

@piotrmilos
Copy link

piotrmilos commented Jan 3, 2023 via email

@sayantanauddy
Copy link
Author

@piotrmilos Thanks for the quick response.

I can confirm that this issue is resolved by downgrading to gym 0.25.2, since version 0.26.0 broke backward compatibility (more details here).

Please consider adding the specific gym version as a dependency. Thanks agian.

@piotrmilos
Copy link

piotrmilos commented Jan 13, 2023 via email

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