mirror of
https://github.com/huggingface/lerobot.git
synced 2026-06-02 03:41:25 +00:00
* refactor(converters): move batch transition functions to converters module - Moved `_default_batch_to_transition` and `_default_transition_to_batch` functions from `pipeline.py` to `converters.py` for better organization and separation of concerns. - Updated references in `RobotProcessor` to use the new location of these functions. - Added tests to ensure correct functionality of the transition functions, including handling of index and task_index fields. - Removed redundant tests from `pipeline.py` to streamline the test suite. * refactor(processor): reorganize EnvTransition and TransitionKey definitions - Moved `EnvTransition` and `TransitionKey` classes from `pipeline.py` to a new `core.py` module for better structure and maintainability. - Updated import statements across relevant modules to reflect the new location of these definitions, ensuring consistent access throughout the codebase. * refactor(converters): rename and update dataset frame conversion functions - Replaced `to_dataset_frame` with `transition_to_dataset_frame` for clarity and consistency in naming. - Updated references in `record.py`, `pipeline.py`, and tests to use the new function name. - Introduced `merge_transitions` to streamline the merging of transitions, enhancing readability and maintainability. - Adjusted related tests to ensure correct functionality with the new naming conventions. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix(processor): solve conflict artefacts * refactor(converters): remove unused identity function and update type hints for merge_transitions * refactor(processor): remove unused identity import and clean up gym_manipulator.py --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Steven Palma <steven.palma@huggingface.co>
98 lines
3.0 KiB
Python
98 lines
3.0 KiB
Python
#!/usr/bin/env python
|
|
|
|
# Copyright 2025 The HuggingFace Inc. team. All rights reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
from .batch_processor import ToBatchProcessor
|
|
from .converters import (
|
|
batch_to_transition,
|
|
create_transition,
|
|
merge_transitions,
|
|
transition_to_batch,
|
|
transition_to_dataset_frame,
|
|
)
|
|
from .core import EnvTransition, TransitionKey
|
|
from .delta_action_processor import MapDeltaActionToRobotAction, MapTensorToDeltaActionDict
|
|
from .device_processor import DeviceProcessor
|
|
from .gym_action_processor import Numpy2TorchActionProcessor, Torch2NumpyActionProcessor
|
|
from .hil_processor import (
|
|
AddTeleopActionAsComplimentaryData,
|
|
AddTeleopEventsAsInfo,
|
|
GripperPenaltyProcessor,
|
|
ImageCropResizeProcessor,
|
|
InterventionActionProcessor,
|
|
RewardClassifierProcessor,
|
|
TimeLimitProcessor,
|
|
)
|
|
from .joint_observations_processor import JointVelocityProcessor, MotorCurrentProcessor
|
|
from .normalize_processor import NormalizerProcessor, UnnormalizerProcessor, hotswap_stats
|
|
from .observation_processor import VanillaObservationProcessor
|
|
from .pipeline import (
|
|
ActionProcessor,
|
|
DoneProcessor,
|
|
IdentityProcessor,
|
|
InfoProcessor,
|
|
ObservationProcessor,
|
|
ProcessorKwargs,
|
|
ProcessorStep,
|
|
ProcessorStepRegistry,
|
|
RewardProcessor,
|
|
RobotProcessor,
|
|
TruncatedProcessor,
|
|
)
|
|
from .rename_processor import RenameProcessor
|
|
from .tokenizer_processor import TokenizerProcessor
|
|
|
|
__all__ = [
|
|
"ActionProcessor",
|
|
"AddTeleopActionAsComplimentaryData",
|
|
"AddTeleopEventsAsInfo",
|
|
"batch_to_transition",
|
|
"create_transition",
|
|
"DeviceProcessor",
|
|
"DoneProcessor",
|
|
"EnvTransition",
|
|
"GripperPenaltyProcessor",
|
|
"hotswap_stats",
|
|
"IdentityProcessor",
|
|
"ImageCropResizeProcessor",
|
|
"InfoProcessor",
|
|
"InterventionActionProcessor",
|
|
"JointVelocityProcessor",
|
|
"MapDeltaActionToRobotAction",
|
|
"MapTensorToDeltaActionDict",
|
|
"merge_transitions",
|
|
"MotorCurrentProcessor",
|
|
"NormalizerProcessor",
|
|
"Numpy2TorchActionProcessor",
|
|
"ObservationProcessor",
|
|
"ProcessorKwargs",
|
|
"ProcessorStep",
|
|
"ProcessorStepRegistry",
|
|
"RenameProcessor",
|
|
"RewardClassifierProcessor",
|
|
"RewardProcessor",
|
|
"RobotProcessor",
|
|
"TimeLimitProcessor",
|
|
"ToBatchProcessor",
|
|
"TokenizerProcessor",
|
|
"Torch2NumpyActionProcessor",
|
|
"transition_to_batch",
|
|
"transition_to_dataset_frame",
|
|
"TransitionKey",
|
|
"TruncatedProcessor",
|
|
"UnnormalizerProcessor",
|
|
"VanillaObservationProcessor",
|
|
]
|