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

TypeError: Input must be namedtuple or namedarraytuple instance or class, got <class 'numpy.ndarray'> #31

Open
robjlyons opened this issue Apr 10, 2022 · 3 comments

Comments

@robjlyons
Copy link

I'm trying to run this in Windows.

I have tried several versions of Pytorch but with no luck.

Do I have a package version wrong?

Error and pip list pasted below.

Thanks,

Error output

Unable to import tensorboard SummaryWriter, proceeding without.
wandb: Currently logged in as: anony-mouse-162437 (use wandb login --relogin to force relogin)
Unable to import tensorboard SummaryWriter, proceeding without.
wandb: wandb version 0.12.14 is available! To upgrade, please run:
wandb: $ pip install wandb --upgrade
wandb: Tracking run with wandb version 0.12.13
wandb: Run data is saved locally in wandb\run-20220410_121943-2wa5jydb
wandb: Run wandb offline to turn off syncing.
wandb: Syncing run playful-spaceship-10
wandb: View project at https://wandb.ai/anony-mouse-162437/SPR?apiKey=8f90936030ab76c4ea4b4a01c63d86a1ba05bec7
wandb: View run at https://wandb.ai/anony-mouse-162437/SPR/runs/2wa5jydb?apiKey=8f90936030ab76c4ea4b4a01c63d86a1ba05bec7
wandb: WARNING Do NOT share these links with anyone. They can be used to claim your runs.
logger_context received log_dir outside of x:\ai plays pokemon\ai\spr\src\rlpyt\data: prepending by x:\ai plays pokemon\ai\spr\src\rlpyt\data/local//
2022-04-10 12:19:45.841568 | dqn_breakout_0 Runner master CPU affinity: [0, 1, 2, 3].
2022-04-10 12:19:45.842067 | dqn_breakout_0 Runner master Torch threads: 4.
←[32musing seed 0←[0m
Spatial latent size is torch.Size([64, 7, 7])
Initialized model with 3775151 parameters
Spatial latent size is torch.Size([64, 7, 7])
Initialized model with 3775151 parameters
2022-04-10 12:21:31.139408 | dqn_breakout_0 Sampler decorrelating envs, max steps: 0
2022-04-10 12:21:31.141906 | dqn_breakout_0 Agent at itr 0, sample eps 1.0 (min itr: 50, max_itr: 1000)
2022-04-10 12:21:31.142393 | dqn_breakout_0 Serial Sampler initialized.
2022-04-10 12:21:31.142393 | dqn_breakout_0 Running 100000 iterations of minibatch RL.
2022-04-10 12:21:33.068301 | dqn_breakout_0 Initialized agent model on device: cuda:0.
2022-04-10 12:21:33.087765 | dqn_breakout_0 From sampler batch size 1, training batch size 32, and replay ratio 64, computed 2 updates per iteration.
2022-04-10 12:21:33.088264 | dqn_breakout_0 Agent setting min/max epsilon itrs: 2000, 2001
2022-04-10 12:21:33.113717 | dqn_breakout_0 Frame-based buffer using 4-frame sequences.
Traceback (most recent call last):
File "x:\ai plays pokemon\ai\spr\src\rlpyt\rlpyt\utils\buffer.py", line 33, in buffer_from_example
buffer_type = namedarraytuple_like(example)
File "x:\ai plays pokemon\ai\spr\src\rlpyt\rlpyt\utils\collections.py", line 202, in namedarraytuple_like
raise TypeError("Input must be namedtuple or namedarraytuple instance"
TypeError: Input must be namedtuple or namedarraytuple instance or class, got <class 'numpy.ndarray'>.

Pip list

Package Version Location


ale-py 0.7.4
atari-py 0.2.9
certifi 2021.10.8
charset-normalizer 2.0.12
click 8.1.2
cloudpickle 1.6.0
colorama 0.4.4
cycler 0.11.0
docker-pycreds 0.4.0
fonttools 4.32.0
future 0.18.2
gitdb 4.0.9
GitPython 3.1.27
gym 0.17.3
gym-notices 0.0.6
idna 3.3
importlib-metadata 4.11.3
importlib-resources 5.6.0
joblib 1.1.0
kiwisolver 1.4.2
kornia 0.6.4
matplotlib 3.2.2
numpy 1.21.5
opencv-python 4.5.5.64
packaging 21.3
pathtools 0.1.2
Pillow 9.1.0
pip 21.2.4
promise 2.3
protobuf 3.20.0
psutil 5.9.0
pyglet 1.5.0
pyparsing 3.0.7
PyPrind 2.11.3
python-dateutil 2.8.2
PyYAML 6.0
recordclass 0.17.2
requests 2.27.1
rlpyt 0.1.1.dev0 x:\ai plays pokemon\ai\spr\src\rlpyt
scikit-learn 1.0.2
scipy 1.8.0
sentry-sdk 1.5.8
setproctitle 1.2.2
setuptools 58.0.4
shortuuid 1.0.8
six 1.16.0
smmap 5.0.0
threadpoolctl 3.1.0
torch 1.9.1+cu111
torchaudio 0.9.1
torchvision 0.10.1+cu111
typing_extensions 4.1.1
urllib3 1.26.9
wandb 0.12.13
wheel 0.37.1
wincertstore 0.2
zipp 3.8.0

@MaxASchwarzer
Copy link
Collaborator

What's 'example' in this stacktrace -- is it standard, or have you changed it to be from pokemon? If the latter, I think you need to process it so that it's a namedtuple of numpy arrays before you pass it in.

@robjlyons
Copy link
Author

Hi, thanks for the reply.

I have not changed anything within buffer.py so example should still be example.

Thanks

@MSKBOX
Copy link

MSKBOX commented Jan 31, 2025

same question,have you solved it?

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

3 participants