Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: "RSL-RL: A Learning Library for Robotics Research"
message: "If you use this work, please cite the following paper."
repository-code: "https://github.com/leggedrobotics/rsl_rl"
license: BSD-3-Clause
version: 5.3.0
version: 5.4.0
type: software
authors:
- family-names: Schwarke
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Please keep the lists sorted alphabetically.
* Fabian Jenelten
* Lorenzo Terenzi
* Marko Bjelonic
* Markus Portugall
* Matthijs van der Boon
* Özhan Özen
* Pascal Roth
Expand Down
23 changes: 14 additions & 9 deletions docs/api/utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,34 @@ Logger
:undoc-members:


Utils
-----
Log Writer
----------

.. automodule:: rsl_rl.utils.utils
.. automodule:: rsl_rl.utils.log_writer
:members:
:undoc-members:


Wandb Utils
-----------
Wandb Log Writer
----------------

.. automodule:: rsl_rl.utils.wandb_utils
.. automodule:: rsl_rl.utils.wandb_log_writer
:members:
:undoc-members:


Neptune Utils
-------------
Neptune Log Writer
------------------

.. automodule:: rsl_rl.utils.neptune_utils
.. automodule:: rsl_rl.utils.neptune_log_writer
:members:
:undoc-members:


Utils
-----

.. automodule:: rsl_rl.utils.utils
:members:
:undoc-members:

67 changes: 49 additions & 18 deletions docs/guide/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ Runner Configuration

Currently, RSL-RL implements two runner classes:
:class:`~rsl_rl.runners.on_policy_runner.OnPolicyRunner` and
:class:`~rsl_rl.runners.distillation_runner.DistillationRunner`. The
:class:`~rsl_rl.runners.on_policy_runner.OnPolicyRunner` is configured as follows:
:class:`~rsl_rl.runners.distillation_runner.DistillationRunner`, which are configured as follows.

OnPolicyRunner
^^^^^^^^^^^^^^

.. list-table::
:header-rows: 1
Expand All @@ -45,31 +47,19 @@ Currently, RSL-RL implements two runner classes:
- Type
- Default
- Description
* - ``num_steps_per_env``
- int
- required
- Number of environment steps collected per iteration.
* - ``obs_groups``
- dict[str, list[str]]
- required
- Mapping from observation sets to observation groups coming from the environment. See :ref:`here
<observation-configuration>` for more details.
* - ``num_steps_per_env``
- int
- required
- Number of environment steps collected per iteration.
* - ``save_interval``
- int
- required
- Number of iterations between checkpoints.
* - ``logger``
- str
- ``"tensorboard"``
- Logging service to use. Valid values: ``"tensorboard"``, ``"wandb"``, ``"neptune"``.
* - ``wandb_project``
- str
- required for W&B
- W&B project name used by the W&B writer.
* - ``neptune_project``
- str
- required for Neptune
- Neptune project name used by the Neptune writer.
* - ``run_name``
- str
- missing
Expand All @@ -83,6 +73,19 @@ Currently, RSL-RL implements two runner classes:
- ``None``
- Compile mode for the PyTorch models to accelerate training.
Valid values: ``None``, ``"default"``, ``"max-autotune-no-cudagraphs"``.
* - ``logger``
- str | dict
- ``"tensorboard"``
- Logging writer configuration. The plain strings ``"wandb"`` and ``"neptune"`` are
still accepted but deprecated.
* - ``wandb_project``
- str
- --
- Deprecated. Pass ``project_name`` inside the ``logger`` configuration instead.
* - ``neptune_project``
- str
- --
- Deprecated. Pass ``project_name`` inside the ``logger`` configuration instead.
* - ``algorithm``
- dict
- required
Expand All @@ -96,6 +99,9 @@ Currently, RSL-RL implements two runner classes:
- required
- Critic model configuration.

DistillationRunner
^^^^^^^^^^^^^^^^^^

For the :class:`~rsl_rl.runners.distillation_runner.DistillationRunner`, the ``actor`` and ``critic`` keys are simply
replaced by ``student`` and ``teacher`` keys, respectively:

Expand All @@ -120,6 +126,31 @@ replaced by ``student`` and ``teacher`` keys, respectively:
- required
- Teacher model configuration.

Logger
^^^^^^
The ``logger`` key of the runner configuration defines the logging writer used to log training metrics and other
information during training. RSL-RL supports TensorBoard, Weights & Biases, and Neptune out of the box. While
TensorBoard does not require any configuration and is set using the plain string ``"tensorboard"``, the other logging
backends are configured by passing a dictionary with the following keys:

.. list-table::
:header-rows: 1
:class: no-wrap-type-column

* - Key
- Type
- Default
- Description
* - ``class_name``
- str
- required
- Logger class name. Valid values: ``"WandbLogWriter"``, ``"NeptuneLogWriter"``.
* - ``project_name``
- str
- required
- Name of the project.
Comment thread
ClemensSchwarke marked this conversation as resolved.


Algorithm Configuration
-----------------------

Expand Down
9 changes: 8 additions & 1 deletion docs/guide/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ Library Features
RSL-RL is intentionally kept minimal and focuses on a small set of components that cover common robotics workflows while
remaining easy to adapt. The following sections summarize the main features currently available.

.. note::
Adding new algorithms, models, or loggers is straightforward and does not require modifying the library itself.
Custom classes can simply be passed as part of the configuration, enabling users to work with the pip version of the
Comment thread
ClemensSchwarke marked this conversation as resolved.
Outdated
library.

Algorithms
^^^^^^^^^^

Expand Down Expand Up @@ -198,7 +203,9 @@ not constrain the way an **Extension** may be implemented, allowing for arbitrar
Utils
^^^^^
**Utils** include various helpers for the library, such as a :class:`~rsl_rl.utils.logger.Logger` to record the learning
process, or functions to resolve configuration settings.
process, or functions to resolve configuration settings. For example, the :func:`~rsl_rl.utils.utils.resolve_callable`
function allows users to pass classes via the configuration dictionary, enabling the use of custom models, loggers, etc.
without modifying the library.

.. _example-integration:

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "rsl-rl-lib"
version = "5.3.0"
version = "5.4.0"
keywords = ["reinforcement-learning", "robotics"]
maintainers = [
{ name="Clemens Schwarke", email="cschwarke@ethz.ch" },
Expand Down
6 changes: 6 additions & 0 deletions rsl_rl/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

"""Helper functions."""

from .log_writer import LogWriter
from .neptune_log_writer import NeptuneLogWriter
from .utils import (
check_nan,
compile_model,
Expand All @@ -16,8 +18,12 @@
split_and_pad_trajectories,
unpad_trajectories,
)
from .wandb_log_writer import WandbLogWriter

__all__ = [
"LogWriter",
"NeptuneLogWriter",
"WandbLogWriter",
"check_nan",
"compile_model",
"get_param",
Expand Down
43 changes: 43 additions & 0 deletions rsl_rl/utils/log_writer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright (c) 2021-2026, ETH Zurich and NVIDIA CORPORATION
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause

from __future__ import annotations

import pathlib
from abc import ABC, abstractmethod


class LogWriter(ABC):
"""Abstract base class for logging backends.

Log writers are configured via ``cfg["logger"]``, a dict with a ``"class_name"`` key pointing to the subclass and
any additional keys forwarded as constructor kwargs. The class is resolved via
:func:`~rsl_rl.utils.resolve_callable`. Only :meth:`add_scalar` must be implemented; all other methods are no-ops.
"""

@abstractmethod
def add_scalar(self, tag: str, scalar_value: float, global_step: int) -> None:
"""Log a scalar metric.

Args:
tag: Name of the metric.
scalar_value: Value of the metric.
global_step: Current training iteration.
"""

def store_config(self, env_cfg: dict | object, train_cfg: dict) -> None:
"""Upload environment and training configuration. Called once at training start."""

def save_model(self, model_path: str, it: int) -> None:
"""Upload a model checkpoint."""

def save_file(self, path: str) -> None:
"""Upload an arbitrary file."""

def save_video(self, video: pathlib.Path, it: int) -> None:
"""Upload a video file."""

def stop(self) -> None:
"""Finalize and close the logging run."""
Loading
Loading