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

[BUG]dm env action spec bug in vizdoom #264

Open
3 tasks done
hilanzy opened this issue May 18, 2023 · 0 comments
Open
3 tasks done

[BUG]dm env action spec bug in vizdoom #264

hilanzy opened this issue May 18, 2023 · 0 comments
Assignees

Comments

@hilanzy
Copy link

hilanzy commented May 18, 2023

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)
@hilanzy hilanzy changed the title dm env action spec bug in vizdoom[BUG] [BUG]dm env action spec bug in vizdoom May 18, 2023
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