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] MultiDiscreteTensorSpec .to("mps") #2135

Open
3 tasks done
dtsaras opened this issue Apr 29, 2024 · 0 comments
Open
3 tasks done

[BUG] MultiDiscreteTensorSpec .to("mps") #2135

dtsaras opened this issue Apr 29, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@dtsaras
Copy link

dtsaras commented Apr 29, 2024

Describe the bug

There is a bug when an EnvBase has a MultiDiscreteTensorSpec and moved to mps (I have not tested yet if the issue persists with cuda).

To Reproduce

The example below should suffice to reproduce the error:

from torchrl.data import MultiDiscreteTensorSpec

nodes=MultiDiscreteTensorSpec((1, 8))
nodes.to("mps")
  File "/Users/dtsaras/Documents/CS/rl/torchrl/envs/common.py", line 2812, in to
    self.__dict__["_input_spec"] = self.input_spec.to(device).lock_()
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/dtsaras/Documents/CS/rl/torchrl/data/tensor_specs.py", line 3715, in to
    kwargs[key] = value.to(dest)
                  ^^^^^^^^^^^^^^
  File "/Users/dtsaras/Documents/CS/rl/torchrl/data/tensor_specs.py", line 3715, in to
    kwargs[key] = value.to(dest)
                  ^^^^^^^^^^^^^^
  File "/Users/dtsaras/Documents/CS/rl/torchrl/data/tensor_specs.py", line 2961, in to
    return self.__class__(
           ^^^^^^^^^^^^^^^

Expected behavior

Expect the environment to move to the accelerator without complaining

System info

Describe the characteristic of your environment:

  • Describe how the library was installed (pip, source, ...)
  • Python version
  • Versions of any other relevant libraries
import torchrl, numpy, sys
print(torchrl.__version__, numpy.__version__, sys.version, sys.platform)

2024.4.24 1.26.4 3.11.9 (main, Apr 19 2024, 11:43:47) [Clang 14.0.6 ] darwin

Additional context

Add any other context about the problem here.

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)
@dtsaras dtsaras added the bug Something isn't working label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants