Repository navigation
Replace the HDF5 metrics with per-episode values in the episode results - #1456
Conversation
5891872 to
61e7a64
Compare
f96fd97 to
44d41b2
Compare
[Medium impact] The PR appears safe to merge. SummaryRemoves the HDF5 metrics path and uses episode results for the final Run table.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Policy rollout] --> B[Episode results]
B --> C[Experiment result]
C --> D[Run table]
B --> E[Evaluation report]
A --> F{Trajectory recording enabled?}
F -->|Yes| G[HDF5 trajectories]
Reviews (1) · Last reviewed commit: "Show each Run's success rate in the expe..." · Reviewed by Greptile |
🤖 Isaac Lab-Arena Review BotSummaryThis PR deletes the HDF5 metrics path: CI: every check on Design, Boundaries & Scope
Findings🟡 Warning: the branch conflicts with
🔵 Improvement: 🔵 Improvement: 🔵 Improvement: VerdictMinor fixes needed |
44d41b2 to
70560c0
Compare
a3fc94b to
bcb641f
Compare
#1456 deletes ObjectPeakSpeedExceededRateMetric, which the goal-pose, gear-insertion, assembly, and place-upright tasks used: it read the object's velocity at every step back from the HDF5 file and counted an episode if the speed ever went above 0.5 m/s. ObjectPeakSpeed records that peak speed per episode. It moves from the advanced external environment example into object_terms.py, next to ObjectDisplacement and OpennessChange, and the four tasks return it as object_peak_speed for the object they used for the metric. The old rate is the share of episodes above 0.5. The example now adds the library class to its environment, and the docs include the class from there. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
way to add their own: a value that belongs to the task, like how far the picked object moved, would have to be added by every environment that uses the task. #1456 deletes the task-level metrics that used to do this. TaskBase.get_episode_recorder_terms() is back, along with the composite task's _subtask_<i> naming and the builder's task_terms argument. PickAndPlaceTask uses it to record object_displacement for its picked object, so every pick-and-place episode line has it. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
#1456 deletes ObjectPeakSpeedExceededRateMetric, which the goal-pose, gear-insertion, assembly, and place-upright tasks used: it read the object's velocity at every step back from the HDF5 file and counted an episode if the speed ever went above 0.5 m/s. ObjectPeakSpeed, moved into isaaclab_arena.terms in #1468, records that peak speed per episode. The four tasks return it as object_peak_speed for the object they used for the metric. The old rate is the share of episodes above 0.5. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
way to add their own: a value that belongs to the task, like how far the picked object moved, would have to be added by every environment that uses the task. #1456 deletes the task-level metrics that used to do this. TaskBase.get_episode_recorder_terms() is back, along with the composite task's _subtask_<i> naming and the builder's task_terms argument. PickAndPlaceTask uses it to record object_displacement for its picked object, so every pick-and-place episode line has it. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
#1456 deletes ObjectPeakSpeedExceededRateMetric, which the goal-pose, gear-insertion, assembly, and place-upright tasks used: it read the object's velocity at every step back from the HDF5 file and counted an episode if the speed ever went above 0.5 m/s. ObjectPeakSpeed, moved into isaaclab_arena.terms in #1468, records that peak speed per episode. The four tasks return it as object_peak_speed for the object they used for the metric. The old rate is the share of episodes above 0.5. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
Isaac Lab already stores each exported episode's success as the "success" attribute of its HDF5 group. The recorder tests used the success metric's recorder term only to get a second copy of that value, so read the attribute instead. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
build_report already reads every Run's episode results, so print one row per Run with its episode count and success rate. The experiment runner and the policy runner both build the report, so this gives a console summary computed from the episode results. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
Tasks declared metrics through get_metrics(). Each metric added an Isaac Lab recorder term that wrote into the recorder HDF5, and MetricsManager read that file back to compute values that were only printed to the console. The per-episode JSONL already records success and progress for every episode, and the result JSON, report, plots and OSMO output all read it. Remove isaaclab_arena.metrics, TaskBase.get_metrics() and its implementations, env.compute_metrics(), the metrics field of the env cfg, and ArenaRunResult.metrics. rollout_policy() no longer returns metrics or reads the HDF5 each time an episode ends. object_moved_rate, revolute_joint_moved_rate and subtask_success_rate go away with it. Subtask completion is still in each JSONL record's progress block. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
The environment adds the progress tracking recorder term whenever a task tracks progress. That term records nothing, but it activates Isaac Lab's recorder manager, which then opens an HDF5 file for any export mode other than EXPORT_NONE. Without other recorder terms the file stays empty. With the metric recorder terms gone, every evaluation without trajectory recording would open such a file, as do mimic builds, which keep Isaac Lab's default recorder configuration. Export nothing when the configuration declares no recorder terms of its own. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
ObjectPeakSpeed lived in the advanced external environment example. The follow-up PR has Arena's own tasks record it, so it belongs next to the other recording code. It moves to isaaclab_arena/recording/object_terms.py, the example imports it, and the docs include it from there. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
The environment concepts page repeated, in a long section, what the external tasks page shows with a worked example. Remove the section and keep the external tasks page as the one place: it gets the anchor the other pages link to and two sentences on what the episode results hold, what a term returns, and that NaN is written as null. The author-environment skill points there. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
isaaclab_arena/terms is where Arena keeps ready-made terms that tasks and environments pick from, such as events.py and the HDF5 recorder terms in recorders.py. The episode recorder terms are the same kind of library, so object_terms.py in the recording package becomes isaaclab_arena/terms/episode_recorders.py. The recording package keeps the manager and the built-in terms that every episode records. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
Keep one short paragraph on the external tasks page that names the example's two terms and shows what a line holds, and drop the two literalinclude blocks. The authoring skill points to the example. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
object's position at every step back from the HDF5 file. Its measurement moves into ObjectDisplacement, a class-based episode recorder term: post_step() tracks the largest distance the object got from where it was after the episode's first step, and the episode's line records that distance in metres. The definition stays the same: motion during the first control step does not count, an object moved and put back still counts, and deformables use their mean node position. The old rate is the share of episodes whose distance is above 0.02 m, and a different threshold can be applied later without a new run. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
way to add their own: a value that belongs to the task, like how far the picked object moved, would have to be added by every environment that uses the task. #1456 deletes the task-level metrics that used to do this. TaskBase.get_episode_recorder_terms() is back, along with the composite task's _subtask_<i> naming and the builder's task_terms argument. PickAndPlaceTask uses it to record object_displacement for its picked object, so every pick-and-place episode line has it. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
close-door tasks used: it read the door's openness at every step back from the HDF5 file and counted an episode if the openness ever got more than min_openness_change away from the reset openness. OpennessChange is a class-based episode recorder term that records the largest change of the openness from the reset openness, as a fraction of the joint range. RotateRevoluteJointTask returns it as openness_change, so every open-door and close-door episode line has it. The old rate is the share of episodes above 0.05. Without a reset openness, the reference is 0, where the reset event leaves the joint; the old metric could not handle that case. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
#1456 deletes ObjectPeakSpeedExceededRateMetric, which the goal-pose, gear-insertion, assembly, and place-upright tasks used: it read the object's velocity at every step back from the HDF5 file and counted an episode if the speed ever went above 0.5 m/s. ObjectPeakSpeed, moved into isaaclab_arena.terms in #1468, records that peak speed per episode. The four tasks return it as object_peak_speed for the object they used for the metric. The old rate is the share of episodes above 0.5. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
OpenDoorTask's success check and the openness_change term both measure from the reset openness, and both repeated the fallback to 0 when no reset percentage is given. RotateRevoluteJointTask now resolves it once as reset_openness, and both read that attribute. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
Tasks now add terms that environment authors do not see. An environment that adds its own object_displacement while using PickAndPlaceTask got "is used more than once", although it defined the name once. The message now says the name is already used by a built-in or task term. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
torch, pytest and SimpleNamespace do not need the simulator; only the isaaclab_arena.recording imports stay inside the test functions. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
OpennessChange and its openness_change field did not say what moved, and did not point back to revolute_joint_moved_rate, the metric they replace. Rename them to RevoluteJointMovement and revolute_joint_movement, matching object_displacement and object_peak_speed, which already follow the names of their metrics. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
Keep one sentence about task terms on the external tasks page and the composite task design note, and drop the task concepts page sentence. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
RotateRevoluteJointTask stored the reset openness twice: as given and with None resolved to 0. The reset event now gets the resolved value, which resets the joint the same way, since rotate_revolute_joint() defaults to 0. Nothing passes None to RotateRevoluteJointEventCfg anymore, so its None branch goes too. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
Env 0's first reading equalled the reset openness, so a term that measured from the first reading would also have passed. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
TaskBase.get_episode_recorder_terms() documents the task route, and PickAndPlaceTask shows it in use. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
781aa22 to
1aa9388
Compare
ManagerTermBase.reset() does nothing, so a class term that forgot to override it carried its tracked values into the next episode. Make reset() abstract like post_step() and __call__(), so such a term fails when it is created. The dataset export test's StepCount had this gap. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
A class term reads its params in __init__, but the manager also passed them to __call__, so every class term had to accept arguments it did not use. Pass params only to function terms and call class terms as term(env, env_id), as the base class declares. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
Replace the `policy_runner.py` commands on the GR00T evaluation pages of the sequential static manipulation and locomanipulation workflows with `experiment_runner.py` and three new Experiment files. Replace the sample outputs with output from running these Experiments. ## Why this change? Experiments run with `experiment_runner.py` are becoming the only way to evaluate, but these two tutorial pages still use `policy_runner.py`. This is the follow-up promised in [#1459](#1459). The sample outputs were also out of date. On current `main`, the old `policy_runner.py` command for the 10-environment sequential step reaches a success rate of 0.73 over 45 episodes, where the page showed 0.98. The Experiment version reaches 0.83 over 46 episodes. ## What changes? - `gr1_put_ranch_bottle_in_fridge_gr00t_experiment.yaml` has one Run for Steps 1 and 2 of the sequential page. Step 2 sets 10 environments on the command line with `runs.gr1_put_ranch_bottle_in_fridge_and_close_door.environment_builder.num_envs=10`. - `gr1_put_sauce_bottles_in_fridge_gr00t_experiment.yaml` replaces `--object_set` in Step 3 with the asset selection variation. The Run builds the scene once per bottle and reports a success rate for each bottle. Before, each parallel environment held a different bottle and the page showed one combined rate. - `g1_locomanip_gr00t_experiment.yaml` has one Run for both locomanipulation steps. - Locomanipulation Step 2 now runs 1500 steps instead of 1200. An episode times out after 1500 steps, so with 1200 steps the attempts that timed out never counted. The old sample showed 1.0 over 2 episodes. With 1500 steps the same setup gives 0.5 over 6. - The locomanipulation device note said the evaluation uses `--device cpu`, but neither the old nor the new commands do. It now says the commands run physics on the GPU, and that `--device cpu` switches to CPU physics. - Step 4 of the sequential page already used `experiment_runner.py`. Its intro now builds on Steps 1 to 3. - The removed Low Hardware Requirements tab was the only place that mentioned `checkpoint-30000`. A sentence next to the server command now says to serve that checkpoint after training with that option, because that training also keeps `checkpoint-20000`. ## Validation I ran every command on both pages in the Arena Docker image built from `main`. The GR00T server ran from the Isaac-GR00T submodule with the pre-trained checkpoints from Hugging Face. All Runs completed: | Page step | Envs | Limit | Episodes | Success rate | | --- | --- | --- | --- | --- | | Sequential Step 1 | 1 | 2000 steps | 5 | 0.80 | | Sequential Step 2 | 10 | 2000 steps | 46 | 0.83 | | Sequential Step 3 | 10 | 40 episodes, 4 builds | 40 | 0.60 (ranch dressing 0.8, ketchup 0.6, barbecue 0.5, mayonnaise 0.5) | | Locomanipulation Step 1 | 1 | 1500 steps | 1 | 1.0 | | Locomanipulation Step 2 | 5 | 1500 steps | 6 | 0.5 | For comparison, the old `policy_runner.py` commands on `main` gave 0.73 over 45 episodes for sequential Step 2. For locomanipulation Step 2 at 1200 steps they gave 1.0 over 2 episodes, the same result as the Experiment with those settings. A 100-step locomanipulation run with `--device cpu` completed with the environment on the CPU. I did not re-run sequential Step 4, because its Experiment file and command did not change. After #1456 removed the metrics, I rebased onto `main` and re-rendered the sample outputs in the new Run table format. The tables come from `build_runs_info_table` and `build_categorical_variation_table` on `main`, applied to the saved episode results of the runs above. The numbers did not change. The three Experiment files load with `main`'s loader, and the docs build with `-W` passes. --------- Signed-off-by: Clemens Volk <cvolk@nvidia.com>
Follow-up to #1456: address Alex's review comments on #1739, which were not addressed before #1456 merged. Rename `ObjectDisplacement` to `ObjectMaximumDisplacement` and `RevoluteJointMovement` to `RevoluteJointMaximumMovement`, together with the episode result fields they write. ## Why this change? #1739 was merged into #1456 before these comments were addressed: - `ObjectDisplacement` reads like the object's displacement over time, while the term records the largest displacement in the episode. The same holds for `RevoluteJointMovement`. Recording the value at every step instead does not fit the episode results, which hold one line per episode; per-step data belongs in the trajectory HDF5 files. The terms are not in a release yet, so renaming them now breaks no released code. ## What changes? - The two term classes and the fields `PickAndPlaceTask` and `RotateRevoluteJointTask` record are renamed to `object_maximum_displacement` and `revolute_joint_maximum_movement`. `object_peak_speed` keeps its name, since "peak" already says it is a maximum. - `ObjectMaximumDisplacement` keeps measuring from the object's position after the episode's first step. Alex also asked whether it could measure from the resting position instead; the reply on #1739 explains why it does not. Breaking changes on `main`: - The episode result fields `object_displacement` and `revolute_joint_movement` are now `object_maximum_displacement` and `revolute_joint_maximum_movement`. Signed-off-by: Clemens Volk <cvolk@nvidia.com>
Remove the HDF5 metrics and record values about each episode in the episode results instead. Environments and tasks add episode recorder terms, the tasks that had metrics record those values again, and the experiment runner's Run table shows each Run's success rate.
This PR combines three reviewed PRs: this one, #1468 and #1739. Their review discussions stay there.
Why this change?
Arena kept results about each episode in two places. The episode results hold one JSON line per episode, which the report, the plots, the KPI exporters and the OSMO output read. The metrics saved data into an HDF5 file during the run, only to print a few numbers afterwards. So success was stored twice, every evaluation wrote an HDF5 file, and a metric took four definitions. The episode results are now the one place for values about an episode, and HDF5 files hold only trajectories and demonstrations.
What changes?
isaaclab_arena.metrics,TaskBase.get_metrics(),env.compute_metrics()andArenaRunResult.metrics. Without trajectory recording, no HDF5 file is written.experiment_runner.pyaddsRecorded Episodes,Success Rateand, for composite tasks,Subtask Success Ratescolumns, computed from the episode results. They replace the printed metrics.episode_recorder_terms, a task throughget_episode_recorder_terms(). A term is a function that runs when the episode ends, or anEpisodeRecorderTermclass that also updates its value inpost_step()after every control step. Its result goes into the episode line under the term's name.Ported task metrics:
mainObjectDisplacedRateMetric(PickAndPlaceTask)object_displacement, in mRevoluteJointMovedRateMetric(OpenDoorTask,CloseDoorTask)revolute_joint_movement, as a fraction of the joint rangeObjectPeakSpeedExceededRateMetric(GoalPoseTask,GearInsertionTask,AssemblyTask,PlaceUprightTask)object_peak_speed, in m/sArena records the values but no longer computes the old rates. A shared function for them will be added once something in Arena needs one.
Breaking changes:
get_metrics(), and code that calledenv.compute_metrics()reads the episode results instead. The metric rates and the policy runner's success rate are no longer printed.EpisodeRecorderTermand implementpost_step(),reset()and__call__(env, env_id); it reads its params in__init__.CoreEpisodeRecorderTermCfgandProgressTrackingRecorderare removed. The recorder term Arena adds is nowpost_step_hook(PostStepHookRecorder), which can go once Arena's Isaac Lab includes Separate recorder capture from batched episode storage IsaacLab#8822.Three figures still show a "Metrics" box and need to be redrawn:
open_door_task.png,arena_env_builder.pngandisaac_lab_arena_arch_overview.png.Usage example
Before:
After:
Each episode line then holds
"object_displacement": 0.031. The old rate issum(record["object_displacement"] > 0.02 for record in records) / len(records).Validation
After combining the three PRs and rebasing onto
main(26e069e), the 23 related test files pass locally on the GPU (226 tests). See #1468 and #1739 for the earlier runs. Not run: the full test suite and evaluations with real policies.