Toni-SM / skrl

Modular reinforcement learning library (on PyTorch and JAX) with support for NVIDIA Isaac Gym, Omniverse Isaac Gym and Isaac Lab
https://skrl.readthedocs.io/
MIT License
443 stars 43 forks source link

[Error] PPO on a single environment #101

Closed user-1701 closed 7 months ago

user-1701 commented 11 months ago

Sorry, this might be a trivial question

I am trying the recurrent PPO examples with my own single environment. In any case I will get this size error.

File "ppo_lstm", line 66, in compute
rnn_input = states.view(-1, self.sequence_length, states.shape[-1])  # (N, L, Hin): N=batch_size, L=sequence_length
RuntimeError: shape '[-1, 128, 23]' is invalid for input of size 736

23 is the observation size * 32 mini-batch size = 736

I registered the environment to vectorize it, setting the num_workers to 1, but I am not 100% sure if it worked. Making gym.vector.make() at least didn't give an error:

gym.envs.registration.register(id="PendulumNoVel-v1", entry_point="Custom_Working_Single_File_Env_With_Step_And_Reset:CustomEnv")
env = gym.vector.make("PendulumNoVel-v1", num_envs=1, asynchronous=False)
env = wrap_env(env)

I also tried without vectorizing, but it also didn`t work. SAC is working fine of course without vectorizing.

Basic information

Toni-SM commented 11 months ago

Hi @user-1701

Can you please share the agent configuration and the rollout buffer (memory) statements?