Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Internal: updated template generator tests for RSL-RL Distillation support.
10 changes: 7 additions & 3 deletions source/isaaclab_rl/test/test_template_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

_SINGLE_AGENT_RL_LIBRARIES = [
{"name": "rl_games", "algorithms": ["ppo"]},
{"name": "rsl_rl", "algorithms": ["ppo"]},
{"name": "rsl_rl", "algorithms": ["distillation", "ppo"]},
{"name": "skrl", "algorithms": ["amp", "ppo"]},
{"name": "sb3", "algorithms": ["ppo"]},
]
Expand Down Expand Up @@ -106,7 +106,7 @@ def _unregister(task_id: str) -> None:
False,
{
"rl_games": ["PPO"],
"rsl_rl": ["PPO"],
"rsl_rl": ["DISTILLATION", "PPO"],
"skrl": ["AMP", "PPO"],
"sb3": ["PPO"],
},
Expand All @@ -126,7 +126,7 @@ def _unregister(task_id: str) -> None:
True,
{
"rl_games": ["PPO"],
"rsl_rl": ["PPO"],
"rsl_rl": ["DISTILLATION", "PPO"],
"skrl": ["AMP", "IPPO", "MAPPO", "PPO"],
"sb3": ["PPO"],
},
Expand Down Expand Up @@ -181,6 +181,10 @@ def test_generator_registers_single_agent_rl_config_entry_points_for_all_librari

assert spec.kwargs["env_cfg_entry_point"] == f"{module_name}.{task_folder}_env_cfg:{task_class}EnvCfg"
assert spec.kwargs["rl_games_cfg_entry_point"] == f"{agents_module}:rl_games_ppo_cfg.yaml"
assert (
spec.kwargs["rsl_rl_distillation_cfg_entry_point"]
== f"{agents_module}.rsl_rl_distillation_cfg:DistillationRunnerCfg"
)
assert spec.kwargs["rsl_rl_cfg_entry_point"] == f"{agents_module}.rsl_rl_ppo_cfg:PPORunnerCfg"
assert spec.kwargs["skrl_amp_cfg_entry_point"] == f"{agents_module}:skrl_amp_cfg.yaml"
assert spec.kwargs["skrl_cfg_entry_point"] == f"{agents_module}:skrl_ppo_cfg.yaml"
Expand Down
19 changes: 10 additions & 9 deletions tools/template/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import importlib
import os
from collections.abc import Callable
from textwrap import fill

import rich.console
import rich.table
Expand Down Expand Up @@ -213,21 +214,21 @@ def main() -> None:
# - show supported RL libraries and features
rl_library_table = rich.table.Table(title="Supported RL libraries")
rl_library_table.add_column("RL/training feature", no_wrap=True)
rl_library_table.add_column("rl_games")
rl_library_table.add_column("rsl_rl")
rl_library_table.add_column("skrl")
rl_library_table.add_column("sb3")
rl_library_table.add_column("rl_games", overflow="fold")
rl_library_table.add_column("rsl_rl", overflow="fold")
rl_library_table.add_column("skrl", overflow="fold")
rl_library_table.add_column("sb3", overflow="fold")
rl_library_table.add_row("ML frameworks", "PyTorch", "PyTorch", "PyTorch, JAX", "PyTorch")
rl_library_table.add_row("Relative performance", "~1X", "~1X", "~1X", "~0.03X")
rl_library_table.add_row(
"Algorithms",
", ".join(algorithms_per_rl_library.get("rl_games", [])),
", ".join(algorithms_per_rl_library.get("rsl_rl", [])),
", ".join(algorithms_per_rl_library.get("skrl", [])),
", ".join(algorithms_per_rl_library.get("sb3", [])),
fill(", ".join(algorithms_per_rl_library.get("rl_games", [])), width=12, break_long_words=False),
fill(", ".join(algorithms_per_rl_library.get("rsl_rl", [])), width=12, break_long_words=False),
fill(", ".join(algorithms_per_rl_library.get("skrl", [])), width=12, break_long_words=False),
fill(", ".join(algorithms_per_rl_library.get("sb3", [])), width=12, break_long_words=False),
)
rl_library_table.add_row("Multi-agent support", State.No, State.No, State.Yes, State.No)
rl_library_table.add_row("Distributed training", State.Yes, State.No, State.Yes, State.No)
rl_library_table.add_row("Distributed training", State.Yes, State.Yes, State.Yes, State.No)
rl_library_table.add_row("Vectorized training", State.Yes, State.Yes, State.Yes, State.No)
rl_library_table.add_row("Fundamental/composite spaces", State.No, State.No, State.Yes, State.No)
cli_handler.output_table(rl_library_table)
Expand Down
2 changes: 1 addition & 1 deletion tools/template/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
TEMPLATE_DIR = os.path.join(ROOT_DIR, "tools", "template", "templates")

# RL algorithms
SINGLE_AGENT_ALGORITHMS = ["AMP", "PPO"]
SINGLE_AGENT_ALGORITHMS = ["AMP", "PPO", "DISTILLATION"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Algorithm expectations omit Distillation

Adding DISTILLATION changes the discovered RSL-RL single-agent algorithms to ["DISTILLATION", "PPO"], but the checked-in discovery tests still expect only ["PPO"], causing test_get_algorithms_per_rl_library_filters_by_workflow_type to fail.

MULTI_AGENT_ALGORITHMS = ["IPPO", "MAPPO"]
34 changes: 34 additions & 0 deletions tools/template/templates/agents/rsl_rl_distillation_cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause

from isaaclab.utils.configclass import configclass

from isaaclab_rl.rsl_rl import RslRlDistillationAlgorithmCfg, RslRlDistillationRunnerCfg, RslRlMLPModelCfg


@configclass
class DistillationRunnerCfg(RslRlDistillationRunnerCfg):
num_steps_per_env = 60
max_iterations = 150
save_interval = 50
experiment_name = "cartpole_direct"
obs_groups = {"student": ["policy"], "teacher": ["policy"]}
student = RslRlMLPModelCfg(
hidden_dims=[32, 32],
activation="elu",
obs_normalization=False,
distribution_cfg=RslRlMLPModelCfg.GaussianDistributionCfg(init_std=1.0),
)
teacher = RslRlMLPModelCfg(
hidden_dims=[32, 32],
activation="elu",
obs_normalization=False,
distribution_cfg=RslRlMLPModelCfg.GaussianDistributionCfg(init_std=0.0),
)
algorithm = RslRlDistillationAlgorithmCfg(
num_learning_epochs=2,
learning_rate=1.0e-3,
gradient_length=15,
)
1 change: 1 addition & 0 deletions tools/template/templates/agents/rsl_rl_ppo_cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class PPORunnerCfg(RslRlOnPolicyRunnerCfg):
max_iterations = 150
save_interval = 50
experiment_name = "cartpole_direct"
obs_groups = {"actor": ["policy"], "critic": ["policy"]}
actor = RslRlMLPModelCfg(
hidden_dims=[32, 32],
activation="elu",
Expand Down
3 changes: 2 additions & 1 deletion tools/template/templates/tasks/__init__task
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ gym.register(
{% for algorithm in rl_library.algorithms %}
{# configuration file #}
{% if rl_library.name == "rsl_rl" %}
{% set agent_config = "." ~ rl_library.name ~ "_" ~ algorithm ~ "_cfg:" ~ algorithm|upper ~ "RunnerCfg" %}
{% set runner_prefix = {"distillation": "Distillation"}.get(algorithm, algorithm|upper) %}
{% set agent_config = "." ~ rl_library.name ~ "_" ~ algorithm ~ "_cfg:" ~ runner_prefix ~ "RunnerCfg" %}
Comment on lines +30 to +31

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Distillation default entry point missing

When a project is generated with RSL-RL Distillation but without PPO, registration exposes only rsl_rl_distillation_cfg_entry_point, while the standard train and play commands request rsl_rl_cfg_entry_point, causing configuration loading to fail with Could not find configuration for the environment.

{% else %}
{% set agent_config = ":" ~ rl_library.name ~ "_" ~ algorithm ~ "_cfg.yaml" %}
{% endif %}
Expand Down
Loading