mirror of
https://github.com/huggingface/lerobot.git
synced 2026-06-02 20:01:25 +00:00
Enhance processing architecture with new components
- Added `RenameProcessor` to facilitate key renaming in observations, improving data handling flexibility. - Updated `__init__.py` to include `RenameProcessor` in module exports. - Refactored `NormalizationProcessor` and `ObservationNormalizer` to use `rsplit` for better key handling. - Introduced comprehensive tests for `NormalizationProcessor` and `RenameProcessor` to ensure functionality and robustness.
This commit is contained in:
@@ -151,7 +151,7 @@ class ObservationNormalizer:
|
||||
def load_state_dict(self, state: Mapping[str, Tensor]) -> None:
|
||||
self._tensor_stats.clear()
|
||||
for flat_key, tensor in state.items():
|
||||
key, stat_name = flat_key.split(".", 1)
|
||||
key, stat_name = flat_key.rsplit(".", 1)
|
||||
if key not in self._tensor_stats:
|
||||
self._tensor_stats[key] = {}
|
||||
self._tensor_stats[key][stat_name] = tensor
|
||||
@@ -382,7 +382,7 @@ class NormalizationProcessor:
|
||||
def load_state_dict(self, state: Mapping[str, Tensor]) -> None:
|
||||
self._tensor_stats.clear()
|
||||
for flat_key, tensor in state.items():
|
||||
key, stat_name = flat_key.split(".", 1)
|
||||
key, stat_name = flat_key.rsplit(".", 1)
|
||||
if key not in self._tensor_stats:
|
||||
self._tensor_stats[key] = {}
|
||||
self._tensor_stats[key][stat_name] = tensor
|
||||
|
||||
Reference in New Issue
Block a user