Repository navigation
Decorrelate placement candidate seeds across placement seeds - #1523
Conversation
Candidate i of environment e was seeded with placement_seed + e * candidates_per_env + i, so consecutive placement seeds shared all but one candidate and usually selected the same layout. Derive each candidate's seed from a hash of (placement_seed, env, candidate). Signed-off-by: Lionel Gulich <[email protected]>
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryThe PR derives each candidate seed from a SHA-256 hash of
Reviews (1) · Last reviewed commit: "Decorrelate placement candidate seeds ac..." · Reviewed by Greptile |
🤖 Isaac Lab-Arena Review BotSummaryThis PR changes how each placement candidate is seeded. Instead of Findings🟡 Warning: isaaclab_arena/relations/placement_candidate_generator.py:69 — The new seed also changes the clutter release order. 🟡 Warning: isaaclab_arena/relations/placement_candidate_generator.py:76 — 🔵 Improvement: isaaclab_arena/relations/placement_candidate_generator.py:77 — 🔵 Improvement: isaaclab_arena/tests/test_object_placer_reproducibility.py:145 — The new test could be a second parameter case of Test Coverage and CI Cost
VerdictMinor fixes needed |
|
CI note: the "Run tests" job failed twice (59 min, then 34 min on rerun). Both logs stop in |
Move the SHA-256 seed derivation into utils.random.derive_seed and use it for placement candidates, build-time variations (unchanged values), and pooled refills. A refill used to offset placement_seed by the previous candidate count, so seed s's refill replayed seed s + N's first batch; it now derives its seed from (base seed, solve index). Test the fix where it happens: consecutive seeds share no initial candidate, and an env's candidates do not depend on num_envs or the candidate count. Fold the consecutive-seed placer test into the different-seeds test, and let the tilted clutter test accept rods released side by side as well as stacked. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lionel Gulich <[email protected]>
alexmillane
left a comment
There was a problem hiding this comment.
LGTM.
Let's make a decision on Ben's question.
With the same objects in every env, the pool now indexes layouts by run-wide episode instead of keeping a queue per env. Arena numbers episode starts across envs, and the reset event gives the episode it starts layout j. Layout j is the best of max_placement_attempts candidates seeded from (placement_seed, j, candidate), solved in the fixed group j // layouts_per_solve. Fixed groups matter because the solver stops on its batch's mean loss. A run of N episodes therefore uses the same N layouts on 16 or 128 envs. Scenes with a RigidObjectSet keep the per-env queues, because each env's objects, and so its layouts, depend on num_envs. Per-env pool methods still work in episode mode; they fill the queues on first use, and layouts_per_env() lists the episode layouts so offline validation checks the layouts resets use. Signed-off-by: Lionel Gulich <[email protected]>
This reverts commit 7343afe. Episode-keyed layouts need the relation solver to stop each row on its own convergence; until then, solving layouts in fixed groups is serial and slow at high env counts. It moves to a follow-up PR together with a solver change, so this PR stays the placement seed fix. Signed-off-by: Lionel Gulich <[email protected]>
Resolve conflicts from the move of placement_candidate_generator.py to relations/optimization/: keep main's oriented-bounds sampling and alignment check, and seed both candidate sites with _seed_candidate. Point the reproducibility test's imports at the moved modules. Signed-off-by: Lionel Gulich <[email protected]>
Write each Run's placement diagnostics to its output directory, and add RoboLab and KitchenBench Experiments that measure placement success with the normal experiment runner. This replaces the standalone benchmark runner from the first revision of this PR. ## Why this change? A placement change can help one scene and hurt another, and a few hand-picked scenes don't show that. #1556 made each environment build record per-check validation counts, but the experiment runner dropped them after the build. This PR keeps them, so placement success can be measured across all the maintained specs. ## What changes? - `_build_environment_from_cfg()` in `run_execution.py` writes `placement_diagnostics_rebuild<i>.json` to the Run directory for every rebuild that solves relation placement. This applies to every Experiment, including policy evaluations. - `PlacementDiagnostics` gets `num_envs` and `save()` / `load()`. - `robolab_placement_experiment.yaml` and `kitchen_bench_placement_experiment.yaml` in `isaaclab_arena_benchmarking/experiment_configs/` have one Run per spec, each with 30 environments, a zero-action policy and one step. - Each Run has its own placement seed, 100000 apart, so tasks that share a scene solve different candidates. - Tests check that each experiment lists every spec in its folder and that no two Runs share candidate seeds. - `placement_success.py` reads an Experiment output directory into one `RunPlacementRecord` per Run and a `PlacementSuccessSummary`. It reports: - `valid_candidate_rate_first_batch`: the share of the first batch that passes every required check. - `valid_env_rate_after_retries`: the share of environments that need no best-loss fallback. - `batches_per_build`. - The docs page explains what is measured and how to run it. - `ci.yml` runs `isaaclab_arena_benchmarking/tests/test_placement_success.py`. Each Run builds its spec once. On `main`, the rebuilds of a Run get the same placement seed, so more rebuilds would repeat the same candidates. Once rebuilds get their own seeds (after #1523), the Experiments can use more rebuilds. The experiments are not in `tracked_benchmarks.yaml` yet. They can be added together with placement KPI fields, which David plans to wire up. ## Validation - The new tests, `test_placement_diagnostics.py`, `test_run_execution.py`, `test_experiment_runner.py` and `test_arena_experiment_result.py` pass locally, with the camera test run in its own process as in CI. That includes one test that runs a one-Run placement Experiment and reads its diagnostics back. - Three real Runs (`banana_on_plate` and two KitchenBench specs, 30 environments) took 81 s through `experiment_runner.py` on one GPU, from app start to the result file. The KitchenBench pick spec took the longest, about 50 s. - My local image has no cuRobo v2, so these ran on the core from before #1550 with this PR's changes applied. CI covers the current image. - The full 80-spec Experiments have not been run yet. --------- Signed-off-by: zhx06 <[email protected]>
Fix the placement pool fallback so it fills an environment's remaining slots when the last batch finds too few valid layouts. Native uv CI has failed on `main` since #1523 because of this. Also run `test_placement_success.py` in native uv CI, as Docker CI does. ## Why this change? With `allow_best_loss_fallbacks`, which is on by default, `PooledObjectPlacer` fell back only when its last batch had no valid layout. If the last batch had some valid layouts but too few, the build raised `Placement pool could not fill ...`. So finding one more valid layout could turn a passing build into a failing one. #1523 changed the candidate seeds, and the farmhouse2 banana spec now hits this in native uv CI. It finds 3 of 5 valid layouts, but its last batch has 1, so the build fails. Before #1523 it found 1, its last batch had none, and fallback filled the rest. ## What changes? - On the last batch, `PooledObjectPlacer` stores an environment's valid layouts first, then fills its remaining slots with best-loss layouts. With `allow_best_loss_fallbacks=False`, an environment that is still short still fails the build. The docs described the old rule and now describe the new one. - `uv-ci.yml` runs `isaaclab_arena_benchmarking/tests/test_placement_success.py`, as `ci.yml` has since #1560. ## Validation - A new test in `test_heterogeneous_placement.py` covers a last batch with too few valid layouts, with fallback on and off. Its fallback-on case fails on `main` and passes here. The placement test files pass in the Isaac Sim 6.2 container. - With the farmhouse2 spec limited to 3 placement attempts, seeds 0 and 7 fail on `main` and build with this change. This PR's native uv job runs the farmhouse2 test on the stack where it fails. `main`'s latest uv run also failed `test_droid_deformable_environment[physx]`, which this PR doesn't address. --------- Signed-off-by: zhx06 <[email protected]>
Fix
placement_seedso consecutive seeds produce independent layouts.Why this change?
PlacementCandidateGeneratorseeded candidateiof environmentewithplacement_seed + e * candidates_per_env + i. With 50 candidates,placement_seed=42used seeds 42–91 andplacement_seed=43used 43–92, so the two shared 49 of 50 candidates.ObjectPlacerkeeps the best-ranked candidate, so consecutive seeds usually returned the same layout. Parallel environments overlapped the same way: environment 1 of seed 42 used the same seeds as environment 0 of seed 92. Pool refills had the same problem, because a refill offsetplacement_seedby the number of candidates already used.In a cluttered syringe scene, seeds 42, 43 and 44 rendered identical layouts, while seeds 42, 142 and 242 differed.
What changes?
PlacementCandidateGenerator._seed_candidateseeds each candidate from a SHA-256 hash of(placement_seed, env_id, candidate_id). Both seeding sites, candidate sampling and clutter release, use it.(base seed, "pool_refill", solve index)instead of offsettingplacement_seed.utils.random.derive_seedholds the hash and is shared withVariationBase; variation values are unchanged.The same seed still reproduces the same layout, but layouts for a given seed differ from those produced before this change.
Not in this PR: the set of scenes still depends on
num_envs, because the pool keeps a queue per env and storesceil(pool_size / num_envs)layouts in each. A follow-up PR will key layouts by run-wide episode. It needs a solver change first, so this PR leaves that part out.Validation
num_envsor the candidate count. The different-seeds test covers seeds 43 and 123 and failed before this change for 43.test_object_placer_reproducibility,test_placement_events,test_placement_sampler,test_heterogeneous_placement,test_relation_solver_interface,test_clutter_placement,test_object_placer_init,test_placement_result,test_placement_layouts,test_validate_placementandtest_variation_base. They ran against the pinned Isaac Lab (e3f7d9f) with warp 1.17, outside the container.