sail-sg / envpool

C++-based high-performance parallel environment execution engine (vectorized env) for general RL environments.

Home Page:https://envpool.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG]dm env action spec bug in vizdoom

hilanzy opened this issue · comments

Describe the bug

Cant call action_spec() in vizdoom when set use_combined_action=True. And if I use make_gym action_space is OK, Is this a bug or is my usage incorrect?

Steps to reproduce the behavior.

import envpool

env = envpool.make_dm(
  "D1Basic-v1",
  num_envs=1,
  use_combined_action=True,
)
env.action_spec()
ValueError                                Traceback (most recent call last)
Cell In[18], line 8
      1 import envpool
      3 env = envpool.make_dm(
      4   "D1Basic-v1",
      5   num_envs=1,
      6   use_combined_action=True,
      7 )
----> 8 env.action_spec()

File [~/miniconda3/envs/moss/lib/python3.10/site-packages/envpool/python/dm_envpool.py:41](https://file+.vscode-resource.vscode-cdn.net/home/lanzhiyi/depot/moss/examples/vizdoom/test/~/miniconda3/envs/moss/lib/python3.10/site-packages/envpool/python/dm_envpool.py:41), in DMEnvPoolMixin.action_spec(self)
     39 """Action spec from EnvSpec."""
     40 if not hasattr(self, "_dm_action_spec"):
---> 41   self._dm_action_spec = self.spec.action_spec()
     42 return self._dm_action_spec

File [~/miniconda3/envs/moss/lib/python3.10/site-packages/envpool/python/env_spec.py:110](https://file+.vscode-resource.vscode-cdn.net/home/lanzhiyi/depot/moss/examples/vizdoom/test/~/miniconda3/envs/moss/lib/python3.10/site-packages/envpool/python/env_spec.py:110), in EnvSpecMixin.action_spec(self)
    108   spec.pop("env_id")
    109   spec.pop("players.env_id")
--> 110   return dm_spec_transform(
    111     list(spec.keys())[0],
    112     list(spec.values())[0], "act"
    113   )
    114 spec = {
...
--> 309   raise ValueError(_DTYPE_NOT_INTEGRAL.format(dtype))
    311 num_values = int(num_values)
    312 maximum = num_values - 1

ValueError: `dtype` must be integral, got float64.
Output is truncated. View as a [scrollable element](command:cellOutput.enableScrolling?eefd2dd9-96af-47d6-a881-796f6d248eed) or open in a [text editor](command:workbench.action.openLargeOutput?eefd2dd9-96af-47d6-a881-796f6d248eed). Adjust cell output [settings](command:workbench.action.openSettings?%5B%22%40tag%3AnotebookOutputLayout%22%5D)...

Expected behavior

Action sepc of vizdoom dm_env.

Screenshots

If applicable, add screenshots to help explain your problem.

System info

Describe the characteristic of your environment:

import envpool, numpy, sys
print(envpool.__version__, numpy.__version__, sys.version, sys.platform)

Executing above code got:

0.8.2 1.22.4 3.10.9 (main, Jan 11 2023, 15:21:40) [GCC 11.2.0] linux

Additional context

Set use_combined_action=Flase can avoid this problem.

Reason and Possible fixes

If you know or suspect the reason for this bug, paste the code lines and suggest modifications.

Checklist

  • I have checked that there is no similar issue in the repo (required)
  • I have read the documentation (required)
  • I have provided a minimal working example to reproduce the bug (required)