Skip to content

Commit 5f7b5f2

Browse files
remove the sampler cause the relative index is added (#2521)
Co-authored-by: Michel Aractingi <[email protected]>
1 parent c55fbe1 commit 5f7b5f2

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

src/lerobot/scripts/lerobot_dataset_viz.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
import gc
6666
import logging
6767
import time
68-
from collections.abc import Iterator
6968
from pathlib import Path
7069

7170
import numpy as np
@@ -78,19 +77,6 @@
7877
from lerobot.utils.constants import ACTION, DONE, OBS_STATE, REWARD
7978

8079

81-
class EpisodeSampler(torch.utils.data.Sampler):
82-
def __init__(self, dataset: LeRobotDataset, episode_index: int):
83-
from_idx = dataset.meta.episodes["dataset_from_index"][episode_index]
84-
to_idx = dataset.meta.episodes["dataset_to_index"][episode_index]
85-
self.frame_ids = range(from_idx, to_idx)
86-
87-
def __iter__(self) -> Iterator:
88-
return iter(self.frame_ids)
89-
90-
def __len__(self) -> int:
91-
return len(self.frame_ids)
92-
93-
9480
def to_hwc_uint8_numpy(chw_float32_torch: torch.Tensor) -> np.ndarray:
9581
assert chw_float32_torch.dtype == torch.float32
9682
assert chw_float32_torch.ndim == 3
@@ -119,12 +105,10 @@ def visualize_dataset(
119105
repo_id = dataset.repo_id
120106

121107
logging.info("Loading dataloader")
122-
episode_sampler = EpisodeSampler(dataset, episode_index)
123108
dataloader = torch.utils.data.DataLoader(
124109
dataset,
125110
num_workers=num_workers,
126111
batch_size=batch_size,
127-
sampler=episode_sampler,
128112
)
129113

130114
logging.info("Starting Rerun")

0 commit comments

Comments
 (0)