mirror of
https://github.com/huggingface/lerobot.git
synced 2026-05-26 14:09:47 +00:00
feat(performance): improving implementation for better performances on big datasets
This commit is contained in:
@@ -205,11 +205,12 @@ class LeRobotDatasetMetadata:
|
|||||||
List of sorted episode indices that satisfy the predicate.
|
List of sorted episode indices that satisfy the predicate.
|
||||||
"""
|
"""
|
||||||
self.ensure_readable()
|
self.ensure_readable()
|
||||||
ep_table = self.episodes
|
|
||||||
if candidates is not None:
|
if candidates is not None:
|
||||||
candidate_set = set(candidates)
|
candidate_set = set(candidates)
|
||||||
ep_table = ep_table.filter(lambda ep: ep["episode_index"] in candidate_set)
|
combined = lambda ep: ep["episode_index"] in candidate_set and predicate(ep) # noqa: E731
|
||||||
filtered = ep_table.filter(predicate)
|
else:
|
||||||
|
combined = predicate
|
||||||
|
filtered = self.episodes.filter(combined, keep_in_memory=True, load_from_cache_file=False)
|
||||||
return sorted(int(idx) for idx in filtered["episode_index"])
|
return sorted(int(idx) for idx in filtered["episode_index"])
|
||||||
|
|
||||||
def _pull_from_repo(
|
def _pull_from_repo(
|
||||||
|
|||||||
Reference in New Issue
Block a user