mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-27 19:56:09 +00:00
bb3ef3537f
Declaring a numeric feature with `shape=(0,)` crashed `save_episode()` in two
distinct places, leaving `dtype: "string"` as the only (type-lossy) workaround:
- `compute_episode_stats` -> `RunningQuantileStats.update` reshaped a size-0
array, raising "ValueError: cannot reshape array of size 0 into shape (0)".
- `get_hf_features_from_features` mapped it to a fixed-size Arrow list of
length 0, which pyarrow rejects ("list_size needs to be a strict positive
integer").
The issue only reported the first error; the second surfaces once the first is
fixed. This change handles both:
- Skip zero-width features during episode stats, exactly as string/language
features are already skipped.
- Store 1-D zero-width features as a variable-length sequence (length=-1) so
each per-frame value is simply an empty list.
Adds a unit test (stats layer) and an integration test that records, saves, and
reads back a zero-width feature, asserting it round-trips as an empty vector and
is excluded from stats.
Fixes #3654
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>