Repository navigation
Conversation
Integrate upstream main at 6d37745 to keep the branch current with shared API and dependency changes. Validate the merged revision with focused checks and all repository formatting and lint hooks. Remote CI remains separate.
Integrate upstream main at 908e849 to keep the branch current with shared API and dependency changes. Validate the merged revision with focused checks and all repository formatting and lint hooks. Remote CI remains separate.
Integrate upstream main at c498443 while preserving the branch behavior and source history. Validate the merged revision with focused checks and the required repository hooks. Remote CI remains separate.
Collect reusable reset-state catalogs with bounded generation and task-defined acceptance checks. Reuse the sampler from isaac-sim#8872 to keep outcome tracking and row selection in one implementation. Add a sparse Franka cube reference with an immediate commanded goal, physical reset generation, and per-environment evaluation quotas.
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryFranka Pour now uses
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Selected environments reset] --> B{Playback frozen?}
B -->|Yes| C[Choose playback rows]
B -->|No| D[Credit completed outcomes to old rows]
D --> E[Draw adaptive rows]
E --> F[Replace reserved draws with cyclic replay]
C --> G[Copy assigned row IDs to environment]
F --> G
G --> H[Restore task state]
Reviews (1) · Last reviewed commit: "Reuse the shared reset sampler in Franka..." · Reviewed by Greptile |
There was a problem hiding this comment.
Isaac Lab Review Bot
Needs attention: Scope and over-engineering (3), Compatibility and deprecation (2), Implementation (1), Style consistency (2), Test quality (2). Other reviewed categories look good.
- PR description: Title and body match the migration; reported validation lacks reset-cost measurements: provide baseline/candidate revisions, workload, hardware, backend, environment/catalog counts, warmup, and reset latency.
- Design and architecture: Architecture looks good.
- Scope and over-engineering: Minimal implementation: Extend reset_dataset.py and pour_env.py; keep reset_sampler.py for the functional legacy contract. Collapse duplicate requested-row storage into reset_dataset_row_id, skip unused replay permutations, and write replay slices directly without concatenation. Preserve outcome recording, shared sampling, cyclic replay, playback, and reseeding. No source modules were added. Scope is cohesive; no split recommended.
- API: API changes look good.
- Compatibility and deprecation: Breaking changes: Boolean masks become integer environment IDs, causing incorrect selection or out-of-bounds resets; preserve mask selection, and restore the uniform-mode metric value changed without deprecation.
- Implementation: Sliced resets allocate indices for every environment before selecting a subset; construct only the selected range at the sampler boundary.
- Style consistency: Added test signatures omit required concrete annotations; annotate helper parameters and returns, and add -> None to the tests.
- Test quality: The CUDA regression bypasses the repository device mask; parameterize it with test_devices(DeviceScope.CUDA) and use the selected device for its tensors and stream.
Significant concerns. Posted 10 inline findings.
Automated review; human maintainers own approval decisions.
| rows = self._sampler._sample_with_uniform_replay(num_envs) | ||
| if rows.shape != (num_envs,) or rows.dtype != torch.long: | ||
| raise RuntimeError("Adaptive sampler returned invalid reset-row IDs.") | ||
| env_ids = torch.as_tensor(env_ids, device=self._device, dtype=torch.long) |
There was a problem hiding this comment.
🔴 Critical · Compatibility — Preserve Boolean reset selections
Casting a Boolean mask to long turns True into environment ID 1; a one-environment all-True reset becomes out of bounds. Convert masks to selected indices before calling the sampler.
|
|
||
| self._replay_generator = torch.Generator(device=self._device) | ||
| seed = env.cfg.seed if env.cfg.seed is not None else self._replay_generator.seed() | ||
| self._replay_fraction = float(sampler_cfg.uniform_fraction) if sampling_mode == "adaptive" else 0.0 |
There was a problem hiding this comment.
🟡 Warning · Compatibility — Preserve the uniform-mode metric
Uniform mode previously reported the configured uniform_fraction through the sampler metric; this sets that metric to zero. Preserve the existing value during deprecation and report effective replay separately.
| seed = env.cfg.seed if env.cfg.seed is not None else self._replay_generator.seed() | ||
| self._replay_fraction = float(sampler_cfg.uniform_fraction) if sampling_mode == "adaptive" else 0.0 | ||
| self._restart_replay(seed) | ||
| self._requested_rows = torch.empty_like(env.reset_dataset_row_id) |
There was a problem hiding this comment.
🟡 Warning · Scope Complexity — Reuse the existing row buffer
_requested_rows duplicates the task’s per-environment row buffer and requires a forwarding helper. Write requested rows into env.reset_dataset_row_id and pass that buffer to the sampler.
| elif self._sampling_mode == "uniform": | ||
| rows = torch.randint(self._row_count, (num_envs,), device=self._device) | ||
| if isinstance(env_ids, slice): | ||
| env_ids = torch.arange(env.num_envs, device=self._device)[env_ids] |
There was a problem hiding this comment.
🟡 Warning · Implementation — Materialize only selected slice indices
A small sliced reset allocates indices for every environment before slicing them. Materialize only the selected range when the sampler needs tensor IDs.
| def _restart_replay(self, seed: int) -> None: | ||
| self._replay_generator.manual_seed(seed) | ||
| self._replay_credit = 0.0 | ||
| self._replay_order = torch.randperm(self._row_count, device=self._device, generator=self._replay_generator) |
There was a problem hiding this comment.
🟡 Warning · Scope Complexity — Defer the replay permutation
Uniform mode never consumes _replay_order, yet initialization and reseeding shuffle the entire catalog. Create the permutation on the first cyclic assignment; keep reseeding and credit reset.
| self._row_count, device=self._device, generator=self._replay_generator | ||
| ) | ||
| self._replay_cursor = 0 | ||
| self._reset_requested_rows(env_ids[slots], torch.cat(chunks)) |
There was a problem hiding this comment.
🟡 Warning · Scope Complexity — Remove replay concatenation
Each replay draw builds chunks and copies them through torch.cat, including single-slice draws. Write cyclic slices directly into the selected request slots, then reset the sampler once.
|
|
||
| class ResetDatasetSampler: | ||
| """Sample reset rows using a rolling-success kernel and exact cyclic replay.""" | ||
| """Legacy reset sampler for callers using the original task-local API. |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Restore the sampler behavior docstring
The replacement docstring drops the rolling-history and exact-replay behavior and puts migration advice in code. Describe the current behavior here; keep migration instructions in the changelog.
| pytestmark = [pytest.mark.unit, pytest.mark.kitless] | ||
|
|
||
|
|
||
| def _make_curriculum(num_envs, row_count, *, device="cpu", **overrides): |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Annotate the added test functions
The new helper has no parameter or return annotations, and the added tests omit -> None. Add concrete signature annotations as required by the contribution guide.
| def test_franka_pour_explicit_reset_seed_restarts_sampling(method): | ||
| """The real public reset methods reseed the task samplers on every explicit seed call.""" | ||
| count = 8 | ||
| _, buffers, _ = _make_curriculum(count, row_count=17) |
There was a problem hiding this comment.
🟡 Warning · Test Quality — Remove the unused sampler build
The seed test constructs and discards a curriculum and sampler, then constructs another for the same buffers. Reuse the first curriculum instead.
| assert sampler.metrics()["sampler/uniform_replay_fraction"] == pytest.approx(0.5) | ||
|
|
||
|
|
||
| @pytest.mark.skipif(not torch.cuda.is_available(), reason="requires a non-default CUDA stream") |
There was a problem hiding this comment.
🟡 Warning · Test Quality — Honor the CUDA device mask
The availability check and hard-coded CUDA device bypass the repository’s test device scope and can select an excluded GPU. Use test_devices(DeviceScope.CUDA) throughout this test.
Description
Move Franka Pour to the shared
isaaclab.envs.reset.ResetStateSamplerintroduced in #8872. The shared sampler records completed outcomes, scores the reset catalog, and draws adaptive starts. Pour owns its task-specific 50% shuffled cyclic replay, playback row selection, and dataset restoration.Existing reset artifacts and sampler configuration fields continue to work. The task keeps the previous Beta score and weight floor. Startup and unfinished manual resets contribute no outcome. Explicit
reset(seed=...)andreset_to(..., seed=...)calls reseed the Pour streams. Rerunning the same seed and reset order reproduces the new sequence. Historical Torch-based runs may draw different rows. The releasedResetDatasetSamplerremains available during its deprecation period. New consumers should useResetStateSampler.Validation
Long training convergence and hosted CI qualification remain follow-up work.