From 69e8ab38bd0192b0296585bf3a0ec20014e7c780 Mon Sep 17 00:00:00 2001 From: pepijn Date: Thu, 11 Jun 2026 17:31:50 +0000 Subject: [PATCH] chore(datasets): trim sampler comment and drop duplicate tests Remove the verbose dataloader-guard comment and the two EpisodeAwareSampler tests that duplicated existing validation/warning coverage (no coverage loss). Co-authored-by: Cursor --- src/lerobot/scripts/lerobot_train.py | 6 +----- tests/datasets/test_sampler.py | 16 ---------------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/src/lerobot/scripts/lerobot_train.py b/src/lerobot/scripts/lerobot_train.py index 438d7dff1..cce0ea432 100644 --- a/src/lerobot/scripts/lerobot_train.py +++ b/src/lerobot/scripts/lerobot_train.py @@ -389,11 +389,7 @@ def train(cfg: TrainPipelineConfig, accelerator: "Accelerator | None" = None): # create dataloader for offline training if not cfg.dataset.streaming: - # All non-streaming (map-style) datasets use EpisodeAwareSampler. This is broader than the - # historical `hasattr(active_cfg, "drop_n_last_frames")` guard: configs that previously fell - # back to DataLoader's default random shuffle now get this sampler instead, so their data - # order changes for a given seed (a deliberate, reproducibility-breaking improvement). - # + # All non-streaming (map-style) datasets use EpisodeAwareSampler. # The order is a pure function of (seed, epoch), so every rank independently produces the # same permutation. accelerate then shards it disjointly across ranks via BatchSamplerShard # without needing a `generator` attribute to synchronize an RNG, and resume is sample-exact. diff --git a/tests/datasets/test_sampler.py b/tests/datasets/test_sampler.py index 3bce6e7cb..7a5fc0fe0 100644 --- a/tests/datasets/test_sampler.py +++ b/tests/datasets/test_sampler.py @@ -213,22 +213,6 @@ def test_deterministic_sampler_resume_is_exact_at_scale(): assert list(resumed) == epoch_0[start:] -def test_deterministic_sampler_validation_matches_episode_aware(): - with pytest.raises(ValueError, match="drop_n_first_frames must be >= 0"): - EpisodeAwareSampler([0], [10], drop_n_first_frames=-1) - with pytest.raises(ValueError, match="drop_n_last_frames must be >= 0"): - EpisodeAwareSampler([0], [10], drop_n_last_frames=-1) - with pytest.raises(ValueError, match="No valid frames remain"): - EpisodeAwareSampler([0, 1, 2], [1, 2, 3], drop_n_first_frames=1) - - -def test_deterministic_sampler_partial_episode_drop_warns(caplog): - with caplog.at_level(logging.WARNING, logger="lerobot.datasets.sampler"): - sampler = EpisodeAwareSampler([0, 1], [1, 6], drop_n_first_frames=1, shuffle=False) - assert list(sampler) == [2, 3, 4, 5] - assert "Episode 0" in caplog.text - - def test_compute_sampler_state(): # 100 frames, batch 10, 2 ranks -> 10 underlying batches, 5 per rank per epoch. assert compute_sampler_state(step=0, num_frames=100, batch_size=10, num_processes=2) == {