From b8bdbc1c5be93364541a0f627b4e7c21be3742b5 Mon Sep 17 00:00:00 2001 From: Simon Alibert Date: Wed, 23 Oct 2024 18:17:56 +0200 Subject: [PATCH] Fix check_delta_timestamps --- lerobot/common/datasets/utils.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lerobot/common/datasets/utils.py b/lerobot/common/datasets/utils.py index 394723c0..ccb57197 100644 --- a/lerobot/common/datasets/utils.py +++ b/lerobot/common/datasets/utils.py @@ -298,10 +298,11 @@ def check_delta_timestamps( """ outside_tolerance = {} for key, delta_ts in delta_timestamps.items(): - abs_delta_ts = torch.abs(torch.tensor(delta_ts)) - within_tolerance = (abs_delta_ts % (1 / fps)) <= tolerance_s - if not torch.all(within_tolerance): - outside_tolerance[key] = torch.tensor(delta_ts)[~within_tolerance] + within_tolerance = [abs(ts * fps - round(ts * fps)) <= tolerance_s for ts in delta_ts] + if not all(within_tolerance): + outside_tolerance[key] = [ + ts for ts, is_within in zip(delta_ts, within_tolerance, strict=True) if not is_within + ] if len(outside_tolerance) > 0: if raise_value_error: