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

Error in Store_transition in pytorch dqns #54

Open
Vis03al opened this issue Jan 11, 2023 · 4 comments
Open

Error in Store_transition in pytorch dqns #54

Vis03al opened this issue Jan 11, 2023 · 4 comments

Comments

@Vis03al
Copy link

Vis03al commented Jan 11, 2023

In "main_torch_dqn_lunar_lander_2020.py" file

--> self.state_memory[index] = state
It says
"ValueError: setting an array element with a sequence. The requested array would exceed the maximum number of dimension of 1"

When i alter few things to get rid off this error i am getting into another error
,could you help me out

@alvynabranches
Copy link

Traceback (most recent call last):
File "/home/alvynabranches/aichess/lunar_lander.py", line 32, in
agent.store_transition(observation, action, reward, observation_, int(done))
File "/home/../aichess/engines/dddqn.py", line 111, in store_transition
self.memory.store_transition(state, action, reward, state_, done)
File "/home/../aichess/engines/dddqn.py", line 22, in store_transition
self.state_memory[index] = state
ValueError: setting an array element with a sequence. The requested array would exceed the maximum number of dimension of 1.

@alvynabranches
Copy link

Same error for DQN as well as DDQN

@philtabor
Copy link
Owner

which version of gym are you using?

@dawmro
Copy link

dawmro commented May 25, 2024

Find your env.reset()
and change it to: env.reset()[0]

Why? Look here:

(method) def reset(
    *,
    seed: int | None = None,
    options: dict[str, Any] | None = None
) -> tuple[Any, dict[str, Any]]

Another thing: If you are using gymnasium instead of gym, remember that done has been replaced with terminated, truncated. Addjust your functions accordingly.

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

4 participants