unitree_rl_gym icon indicating copy to clipboard operation
unitree_rl_gym copied to clipboard

Error in training traced to get_observations method

Open RaduCorcodel opened this issue 10 months ago • 1 comments

I'm trying to train the model and I'm getting the error:

python3 train.py --task=go2
Importing module 'gym_38' (/homes/corcodel/isaacgym/python/isaacgym/_bindings/linux-x86_64/gym_38.so)
Setting GYM_USD_PLUG_INFO_PATH to /homes/corcodel/isaacgym/python/isaacgym/_bindings/linux-x86_64/usd/plugInfo.json
PyTorch version 1.10.0+cu113
Device count 1
/homes/corcodel/isaacgym/python/isaacgym/_bindings/src/gymtorch
Using /homes/corcodel/.cache/torch_extensions/py38_cu113 as PyTorch extensions root...
Emitting ninja build file /homes/corcodel/.cache/torch_extensions/py38_cu113/gymtorch/build.ninja...
Building extension module gymtorch...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
ninja: no work to do.
Loading extension module gymtorch...
Setting seed: 1
Not connected to PVD
+++ Using GPU PhysX
Physics Engine: PhysX
Physics Device: cuda:0
GPU Pipeline: enabled
/homes/corcodel/anaconda3/envs/rl-go2/lib/python3.8/site-packages/torch/functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at  ../aten/src/ATen/native/TensorShape.cpp:2157.)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
Traceback (most recent call last):
  File "train.py", line 20, in <module>
    train(args)
  File "train.py", line 14, in train
    ppo_runner, train_cfg = task_registry.make_alg_runner(env=env, name=args.task, args=args)
  File "/homes/corcodel/unitree/unitree_rl_gym/legged_gym/utils/task_registry.py", line 119, in make_alg_runner
    runner = OnPolicyRunner(env, train_cfg_dict, log_dir, device=args.rl_device)
  File "/homes/corcodel/unitree/rsl_rl/rsl_rl/runners/on_policy_runner.py", line 29, in __init__
    obs, extras = self.env.get_observations()
ValueError: too many values to unpack (expected 2)

I tried the following:

import pdb
print(type(self.env.get_observations()))
print(len(self.env.get_observations()))
pdb.set_trace()

and I got:

<class 'torch.Tensor'>
4096

So clearly the function only returns the tensor but not the extras. The declaration of get_observations in vec_env.py shows that it should return tuple[torch.Tensor, dict] but in the implementation in base_task.py the return of get_observations is only a tensor (line 74 return self.obs_buf)

Any suggestions on how I could resolve this?

Best, Radu

RaduCorcodel avatar Apr 08 '24 18:04 RaduCorcodel