Skip to content

Training of environment Mjlab-Velocity-Rough-Unitree-Go1 crashes because of abnormal reward values #738

@chengruiz

Description

@chengruiz

Hello,

Training in the built-in environment Mjlab-Velocity-Rough-Unitree-Go1 crashes with

Traceback (most recent call last):
  File "/home/chengrui/Workspaces/mjlab/src/mjlab/scripts/train.py", line 255, in <module>
    main()
    ~~~~^^
  File "/home/chengrui/Workspaces/mjlab/src/mjlab/scripts/train.py", line 251, in main
    launch_training(task_id=chosen_task, args=args)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chengrui/Workspaces/mjlab/src/mjlab/scripts/train.py", line 202, in launch_training
    run_train(task_id, args, log_dir)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chengrui/Workspaces/mjlab/src/mjlab/scripts/train.py", line 172, in run_train
    runner.learn(
    ~~~~~~~~~~~~^
      num_learning_iterations=cfg.agent.max_iterations, init_at_random_ep_len=True
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/chengrui/Libraries/miniforge3/envs/mjlab/lib/python3.13/site-packages/rsl_rl/runners/on_policy_runner.py", line 102, in learn
    loss_dict = self.alg.update()
  File "/home/chengrui/Libraries/miniforge3/envs/mjlab/lib/python3.13/site-packages/rsl_rl/algorithms/ppo.py", line 259, in update
    self.actor(obs_batch, masks=masks_batch, hidden_state=hidden_states_batch[0], stochastic_output=True)
    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chengrui/Libraries/miniforge3/envs/mjlab/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1776, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/home/chengrui/Libraries/miniforge3/envs/mjlab/lib/python3.13/site-packages/torch/nn/modules/module.py", line 1787, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/chengrui/Libraries/miniforge3/envs/mjlab/lib/python3.13/site-packages/rsl_rl/models/mlp_model.py", line 122, in forward
    return self.distribution.sample()
           ~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/chengrui/Libraries/miniforge3/envs/mjlab/lib/python3.13/site-packages/torch/distributions/normal.py", line 81, in sample
    return torch.normal(self.loc.expand(shape), self.scale.expand(shape))
           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: normal expects all elements of std >= 0.0

This might be because abnormal reward values make training unstable.

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions