trackmania-rl/tmrl

ValueError: too many values to unpack (expected 2)

3DJakob opened this issue · 6 comments

I'm trying to run the pretrained AI. I have follow the installation guide and the get started guide however when I try to run it I get this issue. I can see the program resizing my window from quarter of my screen to a 8th. I have tried running the game in the lowest possible resolution with a fps cap on 30 and I'm running on a 2060 super.

Here is the command log, do you have any idea what might cause this?

Running on:
Windows 11
Python 3.9.12

(base) C:\Windows\system32>python -m tmrl --test
DEBUG:root: PATH_DATA:C:\Users\jakob\TmrlData
INFO:numexpr.utils:Note: NumExpr detected 16 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
INFO:numexpr.utils:NumExpr defaulting to 8 threads.
INFO:root:Namespace(server=False, trainer=False, worker=False, test=True, benchmark=False, record_reward=False, check_env=False, no_wandb=False, config={})
DEBUG:root:Loading model from C:\Users\jakob\TmrlData\weights\SAC_4_LIDAR_pretrained.pth
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): api.ipify.org:80
DEBUG:urllib3.connectionpool:http://api.ipify.org:80 "GET / HTTP/1.1" 200 14
INFO:root:09/14/22 11:09:44 local IP: 192.168.1.127
INFO:root:09/14/22 11:09:44 public IP: 213.66.199.113
INFO:root:09/14/22 11:09:44 server IP: 127.0.0.1
DEBUG:root: virtual joystick in use
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,C:\ProgramData\Anaconda3\lib\site-packages\rtgym\envs\real_time_env.py:357: UserWarning: Time-step timed out. Elapsed since last time-step: 1.5917513370513916
  warnings.warn(f"Time-step timed out. Elapsed since last time-step: {now - self.__t_end}")

  File "C:\ProgramData\Anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\ProgramData\Anaconda3\lib\site-packages\tmrl\__main__.py", line 81, in <module>
    main(arguments)
  File "C:\ProgramData\Anaconda3\lib\site-packages\tmrl\__main__.py", line 42, in main
    rw.run_episodes(10000)
  File "C:\ProgramData\Anaconda3\lib\site-packages\tmrl\networking.py", line 956, in run_episodes
    self.run_episode(max_samples_per_episode, train=train)
  File "C:\ProgramData\Anaconda3\lib\site-packages\tmrl\networking.py", line 972, in run_episode
    obs = self.reset(collect_samples=False)
  File "C:\ProgramData\Anaconda3\lib\site-packages\tmrl\networking.py", line 867, in reset
    new_obs = self.env.reset()
  File "C:\ProgramData\Anaconda3\lib\site-packages\gym\core.py", line 323, in reset
    return self.env.reset(**kwargs)
  File "C:\ProgramData\Anaconda3\lib\site-packages\gym\core.py", line 379, in reset
    obs, info = self.env.reset(**kwargs)
ValueError: too many values to unpack (expected 2)

(base) C:\Windows\system32>

Hello, the resizing of the screen to one eighth of the screen happens not in the LIDAR version but in the FULL / IMG version of the environment, which will soon become the default but should not yet be on the main branch (it is only fully supported on the yb/dev branch at the moment). Have you changed the default environment parameters in config.json ?

It doesn't explain your error though, it seems to come from Gym (?), I hope the new team of Gym developpers are not once again randomly moving things around... Can you confirm your version of gym please?

(Note for the resizing: it can also happen if your screen is in some huge resolution, because the window is resized to a fixed resolution, which just happens to be one quarter of the screen in 1920*1080 resolution)

(Btw if this issue comes from the gym team doing random things as I suspect, the short-term fix will be to downgrade gym from pip)

Confirmed, this again comes from the crazy development practices of the gym library. pip install gym==0.25 should solve the issue for now, next release I will introduce version dependency on gym because they are becoming annoying.

I will upgrade the whole framework to gym 0.26 compatibility though, because they claim this one will be stable AND this new truncated output of the step function reproduces in a much more straightforward way what I have been doing for a long time with this complicated "__no_done" business in the info dictionary. See https://github.com/openai/gym/releases/tag/0.26.0

@yannbouteiller Thank you so much for the quick reply! pip install gym==0.25 did the trick! 🎉

You're welcome, FYI, tmrl version 0.3.0 has been updated to the new gym (>= 0.26) API

It also introduces support for the raw screenshot environment :D