mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-27 19:56:09 +00:00
fix(processor): rename temporal padding metadata
This commit is contained in:
@@ -27,7 +27,7 @@ from lerobot.processor import (
|
||||
TransitionKey,
|
||||
)
|
||||
from lerobot.processor.converters import create_transition, identity_transition
|
||||
from lerobot.processor.rename_processor import rename_stats
|
||||
from lerobot.processor.rename_processor import rename_stats, rename_transition_keys
|
||||
from lerobot.utils.constants import ACTION, OBS_IMAGE, OBS_IMAGES, OBS_STATE
|
||||
from tests.conftest import assert_contract_is_typed
|
||||
|
||||
@@ -64,6 +64,22 @@ def test_basic_renaming():
|
||||
assert processed_obs["unchanged_key"] == "keep_me"
|
||||
|
||||
|
||||
def test_renaming_preserves_feature_suffixes_for_sampling_metadata():
|
||||
data = {
|
||||
"image": torch.zeros(1),
|
||||
"image_is_pad": torch.ones(1, dtype=torch.bool),
|
||||
"image_padding_mask": torch.ones(1, dtype=torch.bool),
|
||||
}
|
||||
|
||||
result = rename_transition_keys(data, {"image": "observation.images.camera1"})
|
||||
|
||||
assert set(result) == {
|
||||
"observation.images.camera1",
|
||||
"observation.images.camera1_is_pad",
|
||||
"observation.images.camera1_padding_mask",
|
||||
}
|
||||
|
||||
|
||||
def test_empty_rename_map():
|
||||
"""Test processor with empty rename map (should pass through unchanged)."""
|
||||
processor = RenameObservationsProcessorStep(rename_map={})
|
||||
|
||||
Reference in New Issue
Block a user