Skip to content

Commit ed5eae8

Browse files
Expose RL benchmark warm-up in Python API
Keep typed training and play requests equivalent to the CLI added by PR isaac-sim#6474. Translate warm-up steps through dispatch so callers do not need backend-specific arguments.
1 parent ce78a6e commit ed5eae8

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

source/isaaclab/isaaclab/benchmark/api.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ class BenchmarkTrainingRequest:
153153
num_envs: Number of parallel environments.
154154
seed: Environment and agent seed.
155155
max_iterations: Maximum training iterations.
156+
warmup_steps: Number of initial environment steps excluded from environment-step timing.
156157
ray_proc_id: Ray worker process identifier.
157158
video: Whether to record training videos.
158159
video_length: Recorded video length [steps].
@@ -182,6 +183,7 @@ class BenchmarkTrainingRequest:
182183
num_envs: int | None = None
183184
seed: int | None = None
184185
max_iterations: int | None = None
186+
warmup_steps: int = 0
185187
ray_proc_id: int | None = None
186188
video: bool = False
187189
video_length: int = 200
@@ -221,6 +223,7 @@ class BenchmarkPlayRequest:
221223
agent: Optional task agent configuration entry point.
222224
num_envs: Number of parallel environments.
223225
num_frames: Number of measured inference steps.
226+
warmup_steps: Number of initial environment steps excluded from environment-step timing.
224227
seed: Environment seed.
225228
measure_synchronized_step_breakdown: Whether to collect serialized synchronized
226229
environment/simulation step diagnostics.
@@ -237,6 +240,7 @@ class BenchmarkPlayRequest:
237240
agent: str | None = None
238241
num_envs: int | None = None
239242
num_frames: int = 100
243+
warmup_steps: int = 0
240244
seed: int | None = None
241245
measure_synchronized_step_breakdown: bool = False
242246
presets: tuple[str, ...] = field(default_factory=tuple)

source/isaaclab/isaaclab/benchmark/dispatch.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ def _request_argv(request: BenchmarkRequest) -> list[str]:
135135
elif request.workflow == "training":
136136
_append_value(argv, "--agent", request.agent)
137137
_append_value(argv, "--max_iterations", request.max_iterations)
138+
_append_value(argv, "--warmup_steps", request.warmup_steps)
138139
_append_value(argv, "--ray-proc-id", request.ray_proc_id)
139140
if request.video:
140141
argv.append("--video")
@@ -160,6 +161,7 @@ def _request_argv(request: BenchmarkRequest) -> list[str]:
160161
_append_value(argv, "--checkpoint", request.checkpoint)
161162
_append_value(argv, "--agent", request.agent)
162163
_append_value(argv, "--num_frames", request.num_frames)
164+
_append_value(argv, "--warmup_steps", request.warmup_steps)
163165

164166
if getattr(request, "measure_synchronized_step_breakdown", False):
165167
argv.append("--measure_synchronized_step_breakdown")

source/isaaclab/test/benchmark/test_api.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from isaaclab.benchmark import (
1818
BenchmarkLauncherConfig,
1919
BenchmarkOutputConfig,
20+
BenchmarkPlayRequest,
2021
BenchmarkResult,
2122
BenchmarkRuntimeRequest,
2223
BenchmarkTrainingRequest,
@@ -35,6 +36,7 @@ def test_training_request_builds_complete_cli() -> None:
3536
num_envs=64,
3637
seed=7,
3738
max_iterations=10,
39+
warmup_steps=12,
3840
ray_proc_id=4,
3941
video=True,
4042
video_length=100,
@@ -70,6 +72,8 @@ def test_training_request_builds_complete_cli() -> None:
7072
"custom_agent",
7173
"--max_iterations",
7274
"10",
75+
"--warmup_steps",
76+
"12",
7377
"--ray-proc-id",
7478
"4",
7579
"--video",
@@ -123,6 +127,14 @@ def test_runtime_request_uses_runtime_defaults() -> None:
123127
]
124128

125129

130+
def test_play_request_includes_warmup_steps() -> None:
131+
request = BenchmarkPlayRequest(backend="rsl_rl", task="Isaac-Cartpole-Direct", warmup_steps=12)
132+
133+
argv = dispatch._request_argv(request)
134+
135+
assert argv[argv.index("--warmup_steps") + 1] == "12"
136+
137+
126138
@pytest.mark.parametrize("workflow", ["runtime", "startup"])
127139
def test_task_workflow_help_does_not_require_task(workflow: str, monkeypatch, capsys) -> None:
128140
entrypoint = importlib.import_module(f"isaaclab.benchmark.entrypoints.{workflow}")

0 commit comments

Comments
 (0)