mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-31 05:29:40 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0d788abd85 | |||
| 7b78e751a6 |
+6
-10
@@ -61,20 +61,16 @@ Full details in [`docs/source/so101.mdx`](./docs/source/so101.mdx) and [`docs/so
|
|||||||
**4.1 Install**
|
**4.1 Install**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# uv (recommended — see AGENTS.md and CLAUDE.md)
|
pip install 'lerobot[feetech]' # SO-100/SO-101 motor stack
|
||||||
uv sync --locked --extra feetech # SO-100/SO-101 motor stack
|
# pip install 'lerobot[all]' # everything
|
||||||
# uv sync --locked --extra all # everything
|
# pip install 'lerobot[aloha,pusht]' # specific features
|
||||||
# uv sync --locked --extra smolvla # add SmolVLA deps
|
# pip install 'lerobot[smolvla]' # add SmolVLA deps
|
||||||
|
|
||||||
# pip (alternative, e.g. when not working from source)
|
|
||||||
# pip install 'lerobot[feetech]'
|
|
||||||
# pip install 'lerobot[all]'
|
|
||||||
# pip install 'lerobot[smolvla]'
|
|
||||||
|
|
||||||
git lfs install && git lfs pull
|
git lfs install && git lfs pull
|
||||||
hf auth login # required to push datasets/policies
|
hf auth login # required to push datasets/policies
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Contributors can alternatively use `uv sync --locked --extra feetech` (see `AGENTS.md`).
|
||||||
|
|
||||||
**4.2 Find USB ports** — run once per arm, unplug when prompted.
|
**4.2 Find USB ports** — run once per arm, unplug when prompted.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -88,6 +88,20 @@ policy_preprocessor = NormalizerProcessorStep(stats=dataset_stats)
|
|||||||
|
|
||||||
The same policy can work with different environment processors, and the same environment processor can work with different policies:
|
The same policy can work with different environment processors, and the same environment processor can work with different policies:
|
||||||
|
|
||||||
|
````python
|
||||||
|
# Use SmolVLA policy with LIBERO environment
|
||||||
|
# Use SmolVLA policy with LIBERO environment
|
||||||
|
libero_preprocessor, libero_postprocessor = make_env_pre_post_processors(
|
||||||
|
env_cfg=libero_cfg,
|
||||||
|
policy_cfg=smolvla_cfg,
|
||||||
|
)
|
||||||
|
smolvla_preprocessor, smolvla_postprocessor = make_pre_post_processors(smolvla_cfg)
|
||||||
|
# Or use ACT policy with the same LIBERO environment
|
||||||
|
libero_preprocessor, libero_postprocessor = make_env_pre_post_processors(
|
||||||
|
env_cfg=libero_cfg,
|
||||||
|
policy_cfg=act_cfg,
|
||||||
|
)
|
||||||
|
act_preprocessor, act_postprocessor = make_pre_post_processors(act_cfg)
|
||||||
```python
|
```python
|
||||||
# Use SmolVLA policy with LIBERO environment
|
# Use SmolVLA policy with LIBERO environment
|
||||||
libero_preprocessor, libero_postprocessor = make_env_pre_post_processors(
|
libero_preprocessor, libero_postprocessor = make_env_pre_post_processors(
|
||||||
@@ -102,7 +116,6 @@ libero_preprocessor, libero_postprocessor = make_env_pre_post_processors(
|
|||||||
policy_cfg=act_cfg,
|
policy_cfg=act_cfg,
|
||||||
)
|
)
|
||||||
act_preprocessor, act_postprocessor = make_pre_post_processors(act_cfg)
|
act_preprocessor, act_postprocessor = make_pre_post_processors(act_cfg)
|
||||||
```
|
|
||||||
|
|
||||||
### 3. **Easier Experimentation**
|
### 3. **Easier Experimentation**
|
||||||
|
|
||||||
@@ -132,7 +145,7 @@ class LiberoVelocityProcessorStep(ObservationProcessorStep):
|
|||||||
state = torch.cat([eef_pos, eef_axisangle, eef_vel,
|
state = torch.cat([eef_pos, eef_axisangle, eef_vel,
|
||||||
gripper_pos, gripper_vel], dim=-1) # 14D
|
gripper_pos, gripper_vel], dim=-1) # 14D
|
||||||
return state
|
return state
|
||||||
```
|
````
|
||||||
|
|
||||||
### 4. **Cleaner Environment Code**
|
### 4. **Cleaner Environment Code**
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ The `lerobot-rollout --strategy.type=dagger` mode requires **teleoperators with
|
|||||||
|
|
||||||
- `bi_openarm_mini` - Bimanual OpenArm Mini
|
- `bi_openarm_mini` - Bimanual OpenArm Mini
|
||||||
- `so_leader` - SO100 / SO101 leader arm
|
- `so_leader` - SO100 / SO101 leader arm
|
||||||
- `bi_so_leader` - Bimanual SO100 / SO101 leader arms
|
|
||||||
|
|
||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
> The provided commands default to `bi_openarm_follower` + `bi_openarm_mini`.
|
> The provided commands default to `bi_openarm_follower` + `bi_openarm_mini`.
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ Record, Replay and Train with Hope-JR is still experimental.
|
|||||||
|
|
||||||
### Record
|
### Record
|
||||||
|
|
||||||
This step records the dataset, which can be seen as an example [here](https://huggingface.co/datasets/nepyope/hand_record_test_with_video_data).
|
This step records the dataset, which can be seen as an example [here](https://huggingface.co/datasets/nepyope/hand_record_test_with_video_data/settings).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
lerobot-record \
|
lerobot-record \
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ If you're using Feetech or Dynamixel motors, LeRobot provides built-in bus inter
|
|||||||
- [`DynamixelMotorsBus`](https://github.com/huggingface/lerobot/blob/main/src/lerobot/motors/dynamixel/dynamixel.py) – for controlling Dynamixel servos
|
- [`DynamixelMotorsBus`](https://github.com/huggingface/lerobot/blob/main/src/lerobot/motors/dynamixel/dynamixel.py) – for controlling Dynamixel servos
|
||||||
|
|
||||||
Please refer to the [`MotorsBus`](https://github.com/huggingface/lerobot/blob/main/src/lerobot/motors/motors_bus.py) abstract class to learn about its API.
|
Please refer to the [`MotorsBus`](https://github.com/huggingface/lerobot/blob/main/src/lerobot/motors/motors_bus.py) abstract class to learn about its API.
|
||||||
For a good example of how it can be used, you can have a look at our own [SO101 follower implementation](https://github.com/huggingface/lerobot/blob/main/src/lerobot/robots/so_follower/so_follower.py)
|
For a good example of how it can be used, you can have a look at our own [SO101 follower implementation](https://github.com/huggingface/lerobot/blob/main/src/lerobot/robots/so_follower/so101_follower/so101_follower.py)
|
||||||
|
|
||||||
Use these if compatible. Otherwise, you'll need to find or write a Python interface (not covered in this tutorial):
|
Use these if compatible. Otherwise, you'll need to find or write a Python interface (not covered in this tutorial):
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ In addition to these instructions, you need to install the Feetech SDK & ZeroMQ
|
|||||||
pip install -e ".[lekiwi]"
|
pip install -e ".[lekiwi]"
|
||||||
```
|
```
|
||||||
|
|
||||||
Great 🤗! You are now done installing LeRobot, and we can begin assembling the SO100/SO101 arms and the mobile base 🤖.
|
Great :hugs:! You are now done installing LeRobot, and we can begin assembling the SO100/SO101 arms and the mobile base :robot:.
|
||||||
Every time you now want to use LeRobot, you can go to the `~/lerobot` folder where we installed LeRobot and run one of the commands.
|
Every time you now want to use LeRobot, you can go to the `~/lerobot` folder where we installed LeRobot and run one of the commands.
|
||||||
|
|
||||||
# Step-by-Step Assembly Instructions
|
# Step-by-Step Assembly Instructions
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ The model takes images, text instructions, and robot state as input, and outputs
|
|||||||
|
|
||||||
## Reproducing π₀Fast results
|
## Reproducing π₀Fast results
|
||||||
|
|
||||||
We reproduce the results of π₀Fast on the LIBERO benchmark using the LeRobot implementation. We take the LeRobot PiFast base model [lerobot/pi0fast-base](https://huggingface.co/lerobot/pi0fast-base) and finetune for an additional 40k steps in bfloat16, with batch size of 256 on 8 H100 GPUs using the [HuggingFace LIBERO dataset](https://huggingface.co/datasets/HuggingFaceVLA/libero).
|
We reproduce the results of π₀Fast on the LIBERO benchmark using the LeRobot implementation. We take the LeRobot PiFast base model [lerobot/pi0fast-base](https://huggingface.co/lerobot/pi0fast-base) and finetune for an additional 40kk steps in bfloat16, with batch size of 256 on 8 H100 GPUs using the [HuggingFace LIBERO dataset](https://huggingface.co/datasets/HuggingFaceVLA/libero).
|
||||||
|
|
||||||
The finetuned model can be found here:
|
The finetuned model can be found here:
|
||||||
|
|
||||||
|
|||||||
@@ -82,8 +82,6 @@ By default the env samples objects only from the `lightwheel` registry (what `--
|
|||||||
|
|
||||||
All eval snippets below mirror the CI command (see `.github/workflows/benchmark_tests.yml`). The `--rename_map` argument maps RoboCasa's native camera keys (`robot0_agentview_left` / `robot0_eye_in_hand` / `robot0_agentview_right`) onto the three-camera (`camera1` / `camera2` / `camera3`) input layout the released `smolvla_robocasa` policy was trained on.
|
All eval snippets below mirror the CI command (see `.github/workflows/benchmark_tests.yml`). The `--rename_map` argument maps RoboCasa's native camera keys (`robot0_agentview_left` / `robot0_eye_in_hand` / `robot0_agentview_right`) onto the three-camera (`camera1` / `camera2` / `camera3`) input layout the released `smolvla_robocasa` policy was trained on.
|
||||||
|
|
||||||
By default, each task uses the rollout horizon registered by RoboCasa. Set `--env.episode_length=<steps>` to apply the same explicit horizon to every selected task.
|
|
||||||
|
|
||||||
### Single-task evaluation (recommended for quick iteration)
|
### Single-task evaluation (recommended for quick iteration)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ lerobot-train --help
|
|||||||
|
|
||||||
## Evaluate the finetuned model and run it in real-time
|
## Evaluate the finetuned model and run it in real-time
|
||||||
|
|
||||||
Similarly for when recording an episode, it is recommended that you are logged in to the HuggingFace Hub. You can follow the corresponding steps: [Record a dataset](./il_robots#record-a-dataset).
|
Similarly for when recording an episode, it is recommended that you are logged in to the HuggingFace Hub. You can follow the corresponding steps: [Record a dataset](./il_robots).
|
||||||
Once you are logged in, you can run inference in your setup by doing:
|
Once you are logged in, you can run inference in your setup by doing:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -338,7 +338,7 @@ It is advisable to install one 3-pin cable in the motor after placing them befor
|
|||||||
<hfoption id="Leader">
|
<hfoption id="Leader">
|
||||||
|
|
||||||
- Mount the leader holder onto the wrist and secure it with 4 M3x6mm screws.
|
- Mount the leader holder onto the wrist and secure it with 4 M3x6mm screws.
|
||||||
- Attach the handle to the leader holder using 1 M2x6mm screw.
|
- Attach the handle to motor 5 using 1 M2x6mm screw.
|
||||||
- Insert the gripper motor, secure it with 2 M2x6mm screws on each side, attach a motor horn using a M3x6mm horn screw.
|
- Insert the gripper motor, secure it with 2 M2x6mm screws on each side, attach a motor horn using a M3x6mm horn screw.
|
||||||
- Attach the follower trigger with 4 M3x6mm screws.
|
- Attach the follower trigger with 4 M3x6mm screws.
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ from typing import Protocol
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
|
||||||
from lerobot.model.kinematics import RobotKinematics
|
from lerobot.model.kinematics import RobotKinematics
|
||||||
from lerobot.processor import (
|
from lerobot.processor import (
|
||||||
RobotProcessorPipeline,
|
RobotProcessorPipeline,
|
||||||
@@ -57,6 +56,7 @@ from lerobot.robots.so_follower.robot_kinematic_processor import (
|
|||||||
EEBoundsAndSafety,
|
EEBoundsAndSafety,
|
||||||
InverseKinematicsEEToJoints,
|
InverseKinematicsEEToJoints,
|
||||||
)
|
)
|
||||||
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.constants import HF_LEROBOT_CALIBRATION, HF_LEROBOT_HOME, TELEOPERATORS
|
from lerobot.utils.constants import HF_LEROBOT_CALIBRATION, HF_LEROBOT_HOME, TELEOPERATORS
|
||||||
from lerobot.utils.robot_utils import precise_sleep
|
from lerobot.utils.robot_utils import precise_sleep
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from lerobot.lerobot_types import RobotAction
|
from lerobot.types import RobotAction
|
||||||
|
|
||||||
from .base import _GRIPPER_MOTOR_SCALE, IsaacTeleopTeleoperator, _isaacteleop_available
|
from .base import _GRIPPER_MOTOR_SCALE, IsaacTeleopTeleoperator, _isaacteleop_available
|
||||||
from .config_isaac_teleop import SO101LeaderArmConfig
|
from .config_isaac_teleop import SO101LeaderArmConfig
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ from typing import TYPE_CHECKING, Any
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from lerobot.lerobot_types import RobotAction
|
from lerobot.types import RobotAction
|
||||||
|
|
||||||
from .base import IsaacTeleopTeleoperator, _isaacteleop_available
|
from .base import IsaacTeleopTeleoperator, _isaacteleop_available
|
||||||
from .config_isaac_teleop import XRControllerConfig
|
from .config_isaac_teleop import XRControllerConfig
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ from __future__ import annotations
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from lerobot.configs.types import FeatureType, PipelineFeatureType, PolicyFeature
|
from lerobot.configs.types import FeatureType, PipelineFeatureType, PolicyFeature
|
||||||
from lerobot.lerobot_types import RobotAction
|
|
||||||
from lerobot.processor import ProcessorStepRegistry, RobotActionProcessorStep
|
from lerobot.processor import ProcessorStepRegistry, RobotActionProcessorStep
|
||||||
|
from lerobot.types import RobotAction
|
||||||
from lerobot.utils.rotation import Rotation
|
from lerobot.utils.rotation import Rotation
|
||||||
|
|
||||||
from .base import _GRIPPER_MOTOR_SCALE
|
from .base import _GRIPPER_MOTOR_SCALE
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ from lerobot.cameras.opencv import OpenCVCameraConfig
|
|||||||
from lerobot.common.control_utils import predict_action
|
from lerobot.common.control_utils import predict_action
|
||||||
from lerobot.configs import FeatureType, PolicyFeature
|
from lerobot.configs import FeatureType, PolicyFeature
|
||||||
from lerobot.datasets import LeRobotDataset, aggregate_pipeline_dataset_features, create_initial_features
|
from lerobot.datasets import LeRobotDataset, aggregate_pipeline_dataset_features, create_initial_features
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
|
||||||
from lerobot.model.kinematics import RobotKinematics
|
from lerobot.model.kinematics import RobotKinematics
|
||||||
from lerobot.policies import make_pre_post_processors
|
from lerobot.policies import make_pre_post_processors
|
||||||
from lerobot.policies.act import ACTPolicy
|
from lerobot.policies.act import ACTPolicy
|
||||||
@@ -39,6 +38,7 @@ from lerobot.robots.so_follower.robot_kinematic_processor import (
|
|||||||
ForwardKinematicsJointsToEE,
|
ForwardKinematicsJointsToEE,
|
||||||
InverseKinematicsEEToJoints,
|
InverseKinematicsEEToJoints,
|
||||||
)
|
)
|
||||||
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.constants import ACTION, OBS_STR
|
from lerobot.utils.constants import ACTION, OBS_STR
|
||||||
from lerobot.utils.feature_utils import build_dataset_frame, combine_feature_dicts
|
from lerobot.utils.feature_utils import build_dataset_frame, combine_feature_dicts
|
||||||
from lerobot.utils.keyboard_input import init_keyboard_listener
|
from lerobot.utils.keyboard_input import init_keyboard_listener
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
from lerobot.cameras.opencv import OpenCVCameraConfig
|
from lerobot.cameras.opencv import OpenCVCameraConfig
|
||||||
from lerobot.datasets import LeRobotDataset, aggregate_pipeline_dataset_features, create_initial_features
|
from lerobot.datasets import LeRobotDataset, aggregate_pipeline_dataset_features, create_initial_features
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
|
||||||
from lerobot.model.kinematics import RobotKinematics
|
from lerobot.model.kinematics import RobotKinematics
|
||||||
from lerobot.processor import (
|
from lerobot.processor import (
|
||||||
RobotProcessorPipeline,
|
RobotProcessorPipeline,
|
||||||
@@ -37,6 +36,7 @@ from lerobot.scripts.lerobot_record import record_loop
|
|||||||
from lerobot.teleoperators.phone import Phone, PhoneConfig
|
from lerobot.teleoperators.phone import Phone, PhoneConfig
|
||||||
from lerobot.teleoperators.phone.config_phone import PhoneOS
|
from lerobot.teleoperators.phone.config_phone import PhoneOS
|
||||||
from lerobot.teleoperators.phone.phone_processor import MapPhoneActionToRobotAction
|
from lerobot.teleoperators.phone.phone_processor import MapPhoneActionToRobotAction
|
||||||
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.feature_utils import combine_feature_dicts
|
from lerobot.utils.feature_utils import combine_feature_dicts
|
||||||
from lerobot.utils.keyboard_input import init_keyboard_listener
|
from lerobot.utils.keyboard_input import init_keyboard_listener
|
||||||
from lerobot.utils.utils import log_say
|
from lerobot.utils.utils import log_say
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from lerobot.datasets import LeRobotDataset
|
from lerobot.datasets import LeRobotDataset
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
|
||||||
from lerobot.model.kinematics import RobotKinematics
|
from lerobot.model.kinematics import RobotKinematics
|
||||||
from lerobot.processor import (
|
from lerobot.processor import (
|
||||||
RobotProcessorPipeline,
|
RobotProcessorPipeline,
|
||||||
@@ -28,6 +27,7 @@ from lerobot.robots.so_follower import SO100Follower, SO100FollowerConfig
|
|||||||
from lerobot.robots.so_follower.robot_kinematic_processor import (
|
from lerobot.robots.so_follower.robot_kinematic_processor import (
|
||||||
InverseKinematicsEEToJoints,
|
InverseKinematicsEEToJoints,
|
||||||
)
|
)
|
||||||
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.constants import ACTION
|
from lerobot.utils.constants import ACTION
|
||||||
from lerobot.utils.robot_utils import precise_sleep
|
from lerobot.utils.robot_utils import precise_sleep
|
||||||
from lerobot.utils.utils import log_say
|
from lerobot.utils.utils import log_say
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ Highlight, or DAgger via ``lerobot-rollout --strategy.type=...``.
|
|||||||
|
|
||||||
from lerobot.cameras.opencv import OpenCVCameraConfig
|
from lerobot.cameras.opencv import OpenCVCameraConfig
|
||||||
from lerobot.configs import PreTrainedConfig
|
from lerobot.configs import PreTrainedConfig
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
|
||||||
from lerobot.model.kinematics import RobotKinematics
|
from lerobot.model.kinematics import RobotKinematics
|
||||||
from lerobot.processor import (
|
from lerobot.processor import (
|
||||||
RobotProcessorPipeline,
|
RobotProcessorPipeline,
|
||||||
@@ -44,6 +43,7 @@ from lerobot.robots.so_follower.robot_kinematic_processor import (
|
|||||||
from lerobot.rollout import BaseStrategyConfig, RolloutConfig, build_rollout_context
|
from lerobot.rollout import BaseStrategyConfig, RolloutConfig, build_rollout_context
|
||||||
from lerobot.rollout.inference import SyncInferenceConfig
|
from lerobot.rollout.inference import SyncInferenceConfig
|
||||||
from lerobot.rollout.strategies import BaseStrategy
|
from lerobot.rollout.strategies import BaseStrategy
|
||||||
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.process import ProcessSignalHandler
|
from lerobot.utils.process import ProcessSignalHandler
|
||||||
from lerobot.utils.utils import init_logging
|
from lerobot.utils.utils import init_logging
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
|
||||||
from lerobot.model.kinematics import RobotKinematics
|
from lerobot.model.kinematics import RobotKinematics
|
||||||
from lerobot.processor import (
|
from lerobot.processor import (
|
||||||
RobotProcessorPipeline,
|
RobotProcessorPipeline,
|
||||||
@@ -32,6 +31,7 @@ from lerobot.robots.so_follower.robot_kinematic_processor import (
|
|||||||
from lerobot.teleoperators.phone import Phone, PhoneConfig
|
from lerobot.teleoperators.phone import Phone, PhoneConfig
|
||||||
from lerobot.teleoperators.phone.config_phone import PhoneOS
|
from lerobot.teleoperators.phone.config_phone import PhoneOS
|
||||||
from lerobot.teleoperators.phone.phone_processor import MapPhoneActionToRobotAction
|
from lerobot.teleoperators.phone.phone_processor import MapPhoneActionToRobotAction
|
||||||
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.robot_utils import precise_sleep
|
from lerobot.utils.robot_utils import precise_sleep
|
||||||
from lerobot.utils.visualization_utils import init_rerun, log_rerun_data
|
from lerobot.utils.visualization_utils import init_rerun, log_rerun_data
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ from lerobot.cameras.opencv import OpenCVCameraConfig
|
|||||||
from lerobot.common.control_utils import predict_action
|
from lerobot.common.control_utils import predict_action
|
||||||
from lerobot.configs import FeatureType, PolicyFeature
|
from lerobot.configs import FeatureType, PolicyFeature
|
||||||
from lerobot.datasets import LeRobotDataset, aggregate_pipeline_dataset_features, create_initial_features
|
from lerobot.datasets import LeRobotDataset, aggregate_pipeline_dataset_features, create_initial_features
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
|
||||||
from lerobot.model.kinematics import RobotKinematics
|
from lerobot.model.kinematics import RobotKinematics
|
||||||
from lerobot.policies import make_pre_post_processors
|
from lerobot.policies import make_pre_post_processors
|
||||||
from lerobot.policies.act import ACTPolicy
|
from lerobot.policies.act import ACTPolicy
|
||||||
@@ -39,6 +38,7 @@ from lerobot.robots.so_follower.robot_kinematic_processor import (
|
|||||||
ForwardKinematicsJointsToEE,
|
ForwardKinematicsJointsToEE,
|
||||||
InverseKinematicsEEToJoints,
|
InverseKinematicsEEToJoints,
|
||||||
)
|
)
|
||||||
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.constants import ACTION, OBS_STR
|
from lerobot.utils.constants import ACTION, OBS_STR
|
||||||
from lerobot.utils.feature_utils import build_dataset_frame, combine_feature_dicts
|
from lerobot.utils.feature_utils import build_dataset_frame, combine_feature_dicts
|
||||||
from lerobot.utils.keyboard_input import init_keyboard_listener
|
from lerobot.utils.keyboard_input import init_keyboard_listener
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
from lerobot.cameras.opencv import OpenCVCameraConfig
|
from lerobot.cameras.opencv import OpenCVCameraConfig
|
||||||
from lerobot.datasets import LeRobotDataset, aggregate_pipeline_dataset_features, create_initial_features
|
from lerobot.datasets import LeRobotDataset, aggregate_pipeline_dataset_features, create_initial_features
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
|
||||||
from lerobot.model.kinematics import RobotKinematics
|
from lerobot.model.kinematics import RobotKinematics
|
||||||
from lerobot.processor import (
|
from lerobot.processor import (
|
||||||
RobotProcessorPipeline,
|
RobotProcessorPipeline,
|
||||||
@@ -34,6 +33,7 @@ from lerobot.robots.so_follower.robot_kinematic_processor import (
|
|||||||
)
|
)
|
||||||
from lerobot.scripts.lerobot_record import record_loop
|
from lerobot.scripts.lerobot_record import record_loop
|
||||||
from lerobot.teleoperators.so_leader import SO100Leader, SO100LeaderConfig
|
from lerobot.teleoperators.so_leader import SO100Leader, SO100LeaderConfig
|
||||||
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.feature_utils import combine_feature_dicts
|
from lerobot.utils.feature_utils import combine_feature_dicts
|
||||||
from lerobot.utils.keyboard_input import init_keyboard_listener
|
from lerobot.utils.keyboard_input import init_keyboard_listener
|
||||||
from lerobot.utils.utils import log_say
|
from lerobot.utils.utils import log_say
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from lerobot.datasets import LeRobotDataset
|
from lerobot.datasets import LeRobotDataset
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
|
||||||
from lerobot.model.kinematics import RobotKinematics
|
from lerobot.model.kinematics import RobotKinematics
|
||||||
from lerobot.processor import (
|
from lerobot.processor import (
|
||||||
RobotProcessorPipeline,
|
RobotProcessorPipeline,
|
||||||
@@ -29,6 +28,7 @@ from lerobot.robots.so_follower import SO100Follower, SO100FollowerConfig
|
|||||||
from lerobot.robots.so_follower.robot_kinematic_processor import (
|
from lerobot.robots.so_follower.robot_kinematic_processor import (
|
||||||
InverseKinematicsEEToJoints,
|
InverseKinematicsEEToJoints,
|
||||||
)
|
)
|
||||||
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.constants import ACTION
|
from lerobot.utils.constants import ACTION
|
||||||
from lerobot.utils.robot_utils import precise_sleep
|
from lerobot.utils.robot_utils import precise_sleep
|
||||||
from lerobot.utils.utils import log_say
|
from lerobot.utils.utils import log_say
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ forward/inverse kinematics.
|
|||||||
|
|
||||||
from lerobot.cameras.opencv import OpenCVCameraConfig
|
from lerobot.cameras.opencv import OpenCVCameraConfig
|
||||||
from lerobot.configs import PreTrainedConfig
|
from lerobot.configs import PreTrainedConfig
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
|
||||||
from lerobot.model.kinematics import RobotKinematics
|
from lerobot.model.kinematics import RobotKinematics
|
||||||
from lerobot.processor import (
|
from lerobot.processor import (
|
||||||
RobotProcessorPipeline,
|
RobotProcessorPipeline,
|
||||||
@@ -42,6 +41,7 @@ from lerobot.robots.so_follower.robot_kinematic_processor import (
|
|||||||
from lerobot.rollout import BaseStrategyConfig, RolloutConfig, build_rollout_context
|
from lerobot.rollout import BaseStrategyConfig, RolloutConfig, build_rollout_context
|
||||||
from lerobot.rollout.inference import SyncInferenceConfig
|
from lerobot.rollout.inference import SyncInferenceConfig
|
||||||
from lerobot.rollout.strategies import BaseStrategy
|
from lerobot.rollout.strategies import BaseStrategy
|
||||||
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.process import ProcessSignalHandler
|
from lerobot.utils.process import ProcessSignalHandler
|
||||||
from lerobot.utils.utils import init_logging
|
from lerobot.utils.utils import init_logging
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
|
||||||
from lerobot.model.kinematics import RobotKinematics
|
from lerobot.model.kinematics import RobotKinematics
|
||||||
from lerobot.processor import (
|
from lerobot.processor import (
|
||||||
RobotProcessorPipeline,
|
RobotProcessorPipeline,
|
||||||
@@ -31,6 +30,7 @@ from lerobot.robots.so_follower.robot_kinematic_processor import (
|
|||||||
InverseKinematicsEEToJoints,
|
InverseKinematicsEEToJoints,
|
||||||
)
|
)
|
||||||
from lerobot.teleoperators.so_leader import SO100Leader, SO100LeaderConfig
|
from lerobot.teleoperators.so_leader import SO100Leader, SO100LeaderConfig
|
||||||
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.robot_utils import precise_sleep
|
from lerobot.utils.robot_utils import precise_sleep
|
||||||
from lerobot.utils.visualization_utils import init_rerun, log_rerun_data
|
from lerobot.utils.visualization_utils import init_rerun, log_rerun_data
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -67,7 +67,7 @@ dependencies = [
|
|||||||
"einops>=0.8.0,<0.9.0",
|
"einops>=0.8.0,<0.9.0",
|
||||||
|
|
||||||
# Config & Hub
|
# Config & Hub
|
||||||
"draccus>=0.11.6,<0.12.0",
|
"draccus==0.10.0", # TODO: Relax version constraint
|
||||||
"huggingface-hub>=1.0.0,<2.0.0",
|
"huggingface-hub>=1.0.0,<2.0.0",
|
||||||
"requests>=2.32.0,<3.0.0",
|
"requests>=2.32.0,<3.0.0",
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import draccus
|
|||||||
import grpc
|
import grpc
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
from lerobot.lerobot_types import PolicyAction
|
|
||||||
from lerobot.policies import get_policy_class, make_pre_post_processors
|
from lerobot.policies import get_policy_class, make_pre_post_processors
|
||||||
from lerobot.processor import PolicyProcessorPipeline
|
from lerobot.processor import PolicyProcessorPipeline
|
||||||
from lerobot.transport import (
|
from lerobot.transport import (
|
||||||
@@ -46,6 +45,7 @@ from lerobot.transport import (
|
|||||||
services_pb2_grpc, # type: ignore
|
services_pb2_grpc, # type: ignore
|
||||||
)
|
)
|
||||||
from lerobot.transport.utils import receive_bytes_in_chunks
|
from lerobot.transport.utils import receive_bytes_in_chunks
|
||||||
|
from lerobot.types import PolicyAction
|
||||||
|
|
||||||
from .configs import PolicyServerConfig
|
from .configs import PolicyServerConfig
|
||||||
from .constants import SUPPORTED_POLICIES
|
from .constants import SUPPORTED_POLICIES
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ else:
|
|||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from lerobot.datasets import LeRobotDataset
|
from lerobot.datasets import LeRobotDataset
|
||||||
from lerobot.lerobot_types import PolicyAction
|
|
||||||
from lerobot.processor import PolicyProcessorPipeline
|
from lerobot.processor import PolicyProcessorPipeline
|
||||||
from lerobot.robots import Robot
|
from lerobot.robots import Robot
|
||||||
|
from lerobot.types import PolicyAction
|
||||||
|
|
||||||
|
|
||||||
def predict_action(
|
def predict_action(
|
||||||
|
|||||||
@@ -163,10 +163,8 @@ class PreTrainedConfig(draccus.ChoiceRegistry, HubMixin, abc.ABC): # type: igno
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def _save_pretrained(self, save_directory: Path) -> None:
|
def _save_pretrained(self, save_directory: Path) -> None:
|
||||||
# Encode against the base class so draccus includes the choice "type" key,
|
with open(save_directory / CONFIG_NAME, "w") as f, draccus.config_type("json"):
|
||||||
# which `from_pretrained` needs to resolve the concrete subclass.
|
draccus.dump(self, f, indent=4)
|
||||||
with open(save_directory / CONFIG_NAME, "w") as f:
|
|
||||||
json.dump(draccus.encode(self, PreTrainedConfig), f, indent=4)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_pretrained(
|
def from_pretrained(
|
||||||
|
|||||||
@@ -103,10 +103,8 @@ class RewardModelConfig(draccus.ChoiceRegistry, HubMixin, abc.ABC):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def _save_pretrained(self, save_directory: Path) -> None:
|
def _save_pretrained(self, save_directory: Path) -> None:
|
||||||
# Encode against the base class so draccus includes the choice "type" key,
|
with open(save_directory / CONFIG_NAME, "w") as f, draccus.config_type("json"):
|
||||||
# which `from_pretrained` needs to resolve the concrete subclass.
|
draccus.dump(self, f, indent=4)
|
||||||
with open(save_directory / CONFIG_NAME, "w") as f:
|
|
||||||
json.dump(draccus.encode(self, RewardModelConfig), f, indent=4)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_pretrained(
|
def from_pretrained(
|
||||||
|
|||||||
@@ -194,11 +194,7 @@ class TrainPipelineConfig(HubMixin):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if Path(config_path).resolve().exists():
|
if Path(config_path).resolve().exists():
|
||||||
# `config_path` may point at the checkpoint's train_config.json or at its
|
policy_dir = Path(config_path).parent
|
||||||
# pretrained_model/ directory (both documented above) — resolve either to
|
|
||||||
# the pretrained_model/ directory.
|
|
||||||
config_path_obj = Path(config_path)
|
|
||||||
policy_dir = config_path_obj.parent if config_path_obj.is_file() else config_path_obj
|
|
||||||
self.checkpoint_path = policy_dir.parent
|
self.checkpoint_path = policy_dir.parent
|
||||||
elif self.job.is_remote:
|
elif self.job.is_remote:
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ from collections.abc import Sequence
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from lerobot.configs import PipelineFeatureType
|
from lerobot.configs import PipelineFeatureType
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
|
||||||
from lerobot.processor import DataProcessorPipeline
|
from lerobot.processor import DataProcessorPipeline
|
||||||
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.constants import ACTION, OBS_IMAGES, OBS_STATE, OBS_STR
|
from lerobot.utils.constants import ACTION, OBS_IMAGES, OBS_STATE, OBS_STR
|
||||||
from lerobot.utils.feature_utils import hw_to_dataset_features
|
from lerobot.utils.feature_utils import hw_to_dataset_features
|
||||||
|
|
||||||
|
|||||||
@@ -58,10 +58,6 @@ class LookAheadError(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class _ShardExhaustedError(Exception):
|
|
||||||
"""Raised when a streaming dataset shard has no more items."""
|
|
||||||
|
|
||||||
|
|
||||||
class Backtrackable[T]:
|
class Backtrackable[T]:
|
||||||
"""
|
"""
|
||||||
Wrap any iterator/iterable so you can step back up to `history` items
|
Wrap any iterator/iterable so you can step back up to `history` items
|
||||||
@@ -182,7 +178,7 @@ class Backtrackable[T]:
|
|||||||
"""
|
"""
|
||||||
Check if we can go back `steps` items without raising an IndexError.
|
Check if we can go back `steps` items without raising an IndexError.
|
||||||
"""
|
"""
|
||||||
return steps < len(self._back_buf) + self._cursor
|
return steps <= len(self._back_buf) + self._cursor
|
||||||
|
|
||||||
def can_peek_ahead(self, steps: int = 1) -> bool:
|
def can_peek_ahead(self, steps: int = 1) -> bool:
|
||||||
"""
|
"""
|
||||||
@@ -426,7 +422,10 @@ class StreamingLeRobotDataset(torch.utils.data.IterableDataset):
|
|||||||
else:
|
else:
|
||||||
frames_buffer.append(frame)
|
frames_buffer.append(frame)
|
||||||
break # random shard sampled, switch shard
|
break # random shard sampled, switch shard
|
||||||
except _ShardExhaustedError:
|
except (
|
||||||
|
RuntimeError,
|
||||||
|
StopIteration,
|
||||||
|
): # NOTE: StopIteration inside a generator throws a RuntimeError since python 3.7
|
||||||
del idx_to_backtrack_dataset[shard_key] # Remove exhausted shard, onto another shard
|
del idx_to_backtrack_dataset[shard_key] # Remove exhausted shard, onto another shard
|
||||||
|
|
||||||
# Once shards are all exhausted, shuffle the buffer and yield the remaining frames
|
# Once shards are all exhausted, shuffle the buffer and yield the remaining frames
|
||||||
@@ -504,11 +503,7 @@ class StreamingLeRobotDataset(torch.utils.data.IterableDataset):
|
|||||||
|
|
||||||
def make_frame(self, dataset_iterator: Backtrackable) -> Generator:
|
def make_frame(self, dataset_iterator: Backtrackable) -> Generator:
|
||||||
"""Makes a frame starting from a dataset iterator"""
|
"""Makes a frame starting from a dataset iterator"""
|
||||||
try:
|
|
||||||
item = next(dataset_iterator)
|
item = next(dataset_iterator)
|
||||||
except StopIteration as e:
|
|
||||||
# Translate exhaustion here, before PEP 479 turns it into an indistinguishable RuntimeError.
|
|
||||||
raise _ShardExhaustedError from e
|
|
||||||
item = item_to_torch(item)
|
item = item_to_torch(item)
|
||||||
|
|
||||||
updates = [] # list of "updates" to apply to the item retrieved from hf_dataset (w/o camera features)
|
updates = [] # list of "updates" to apply to the item retrieved from hf_dataset (w/o camera features)
|
||||||
|
|||||||
@@ -507,7 +507,7 @@ class MetaworldEnv(EnvConfig):
|
|||||||
class RoboCasaEnv(EnvConfig):
|
class RoboCasaEnv(EnvConfig):
|
||||||
task: str = "CloseFridge"
|
task: str = "CloseFridge"
|
||||||
fps: int = 20
|
fps: int = 20
|
||||||
episode_length: int | None = None
|
episode_length: int = 1000
|
||||||
obs_type: str = "pixels_agent_pos"
|
obs_type: str = "pixels_agent_pos"
|
||||||
render_mode: str = "rgb_array"
|
render_mode: str = "rgb_array"
|
||||||
camera_name: str = "robot0_agentview_left,robot0_eye_in_hand,robot0_agentview_right"
|
camera_name: str = "robot0_agentview_left,robot0_eye_in_hand,robot0_agentview_right"
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ from gymnasium import spaces
|
|||||||
from libero.libero import benchmark, get_libero_path
|
from libero.libero import benchmark, get_libero_path
|
||||||
from libero.libero.envs import OffScreenRenderEnv
|
from libero.libero.envs import OffScreenRenderEnv
|
||||||
|
|
||||||
from lerobot.lerobot_types import RobotObservation
|
from lerobot.types import RobotObservation
|
||||||
|
|
||||||
from .utils import _LazyAsyncVectorEnv, parse_camera_names
|
from .utils import _LazyAsyncVectorEnv, parse_camera_names
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import metaworld.policies as policies
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from gymnasium import spaces
|
from gymnasium import spaces
|
||||||
|
|
||||||
from lerobot.lerobot_types import RobotObservation
|
from lerobot.types import RobotObservation
|
||||||
|
|
||||||
from .utils import _LazyAsyncVectorEnv
|
from .utils import _LazyAsyncVectorEnv
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import gymnasium as gym
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from gymnasium import spaces
|
from gymnasium import spaces
|
||||||
|
|
||||||
from lerobot.lerobot_types import RobotObservation
|
from lerobot.types import RobotObservation
|
||||||
|
|
||||||
from .utils import _LazyAsyncVectorEnv, parse_camera_names
|
from .utils import _LazyAsyncVectorEnv, parse_camera_names
|
||||||
|
|
||||||
@@ -98,19 +98,6 @@ def _resolve_tasks(task: str) -> tuple[list[str], str | None]:
|
|||||||
return names, None
|
return names, None
|
||||||
|
|
||||||
|
|
||||||
def _get_task_horizon(task: str) -> int:
|
|
||||||
"""Return the rollout horizon registered by RoboCasa for a task."""
|
|
||||||
from robocasa.utils.dataset_registry_utils import get_task_horizon
|
|
||||||
|
|
||||||
try:
|
|
||||||
return int(get_task_horizon(task))
|
|
||||||
except ValueError as exc:
|
|
||||||
raise ValueError(
|
|
||||||
f"No RoboCasa horizon is registered for task '{task}'. "
|
|
||||||
"Set `--env.episode_length=<steps>` explicitly."
|
|
||||||
) from exc
|
|
||||||
|
|
||||||
|
|
||||||
def convert_action(flat_action: np.ndarray) -> dict[str, Any]:
|
def convert_action(flat_action: np.ndarray) -> dict[str, Any]:
|
||||||
"""Split a flat (12,) action vector into a RoboCasa action dict.
|
"""Split a flat (12,) action vector into a RoboCasa action dict.
|
||||||
|
|
||||||
@@ -167,7 +154,7 @@ class RoboCasaEnv(gym.Env):
|
|||||||
|
|
||||||
self.camera_name = parse_camera_names(camera_name)
|
self.camera_name = parse_camera_names(camera_name)
|
||||||
|
|
||||||
self._max_episode_steps = episode_length if episode_length is not None else _get_task_horizon(task)
|
self._max_episode_steps = episode_length if episode_length is not None else 1000
|
||||||
|
|
||||||
# Deferred — created on first reset() inside the worker subprocess
|
# Deferred — created on first reset() inside the worker subprocess
|
||||||
# to avoid inheriting stale GPU/EGL contexts across fork().
|
# to avoid inheriting stale GPU/EGL contexts across fork().
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import numpy as np
|
|||||||
import torch
|
import torch
|
||||||
from gymnasium import spaces
|
from gymnasium import spaces
|
||||||
|
|
||||||
from lerobot.lerobot_types import RobotObservation
|
from lerobot.types import RobotObservation
|
||||||
from lerobot.utils.import_utils import _scipy_available
|
from lerobot.utils.import_utils import _scipy_available
|
||||||
|
|
||||||
from .utils import _LazyAsyncVectorEnv
|
from .utils import _LazyAsyncVectorEnv
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import numpy as np
|
|||||||
from gymnasium import spaces
|
from gymnasium import spaces
|
||||||
from scipy.spatial.transform import Rotation
|
from scipy.spatial.transform import Rotation
|
||||||
|
|
||||||
from lerobot.lerobot_types import RobotObservation
|
from lerobot.types import RobotObservation
|
||||||
|
|
||||||
from .utils import _LazyAsyncVectorEnv
|
from .utils import _LazyAsyncVectorEnv
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ from typing import TYPE_CHECKING, Any
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from lerobot.configs.types import FeatureType, PipelineFeatureType, PolicyFeature
|
from lerobot.configs.types import FeatureType, PipelineFeatureType, PolicyFeature
|
||||||
from lerobot.lerobot_types import TransitionKey
|
|
||||||
from lerobot.processor import (
|
from lerobot.processor import (
|
||||||
ComplementaryDataProcessorStep,
|
ComplementaryDataProcessorStep,
|
||||||
PolicyAction,
|
PolicyAction,
|
||||||
@@ -32,6 +31,7 @@ from lerobot.processor import (
|
|||||||
make_default_policy_processor_steps,
|
make_default_policy_processor_steps,
|
||||||
make_policy_processor_pipelines,
|
make_policy_processor_pipelines,
|
||||||
)
|
)
|
||||||
|
from lerobot.types import TransitionKey
|
||||||
from lerobot.utils.constants import OBS_STATE
|
from lerobot.utils.constants import OBS_STATE
|
||||||
from lerobot.utils.import_utils import _transformers_available, require_package
|
from lerobot.utils.import_utils import _transformers_available, require_package
|
||||||
|
|
||||||
|
|||||||
@@ -42,9 +42,6 @@ class Evo1Policy(PreTrainedPolicy):
|
|||||||
config_class = Evo1Config
|
config_class = Evo1Config
|
||||||
name = "evo1"
|
name = "evo1"
|
||||||
|
|
||||||
def supports_rtc(self) -> bool:
|
|
||||||
return True
|
|
||||||
|
|
||||||
def __init__(self, config: Evo1Config, *, vlm_hub_kwargs: dict | None = None, **kwargs):
|
def __init__(self, config: Evo1Config, *, vlm_hub_kwargs: dict | None = None, **kwargs):
|
||||||
super().__init__(config)
|
super().__init__(config)
|
||||||
config.validate_features()
|
config.validate_features()
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ from typing import Any
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from lerobot.configs import FeatureType, PipelineFeatureType, PolicyFeature
|
from lerobot.configs import FeatureType, PipelineFeatureType, PolicyFeature
|
||||||
from lerobot.lerobot_types import EnvTransition, TransitionKey
|
|
||||||
from lerobot.processor import (
|
from lerobot.processor import (
|
||||||
AddBatchDimensionProcessorStep,
|
AddBatchDimensionProcessorStep,
|
||||||
DeviceProcessorStep,
|
DeviceProcessorStep,
|
||||||
@@ -41,6 +40,7 @@ from lerobot.processor.converters import (
|
|||||||
policy_action_to_transition,
|
policy_action_to_transition,
|
||||||
transition_to_policy_action,
|
transition_to_policy_action,
|
||||||
)
|
)
|
||||||
|
from lerobot.types import EnvTransition, TransitionKey
|
||||||
from lerobot.utils.constants import (
|
from lerobot.utils.constants import (
|
||||||
ACTION,
|
ACTION,
|
||||||
DONE,
|
DONE,
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
from lerobot.configs import FeatureType, PreTrainedConfig
|
from lerobot.configs import FeatureType, PreTrainedConfig
|
||||||
from lerobot.envs import EnvConfig, env_to_policy_features
|
from lerobot.envs import EnvConfig, env_to_policy_features
|
||||||
from lerobot.lerobot_types import PolicyAction
|
|
||||||
from lerobot.processor import (
|
from lerobot.processor import (
|
||||||
AbsoluteActionsProcessorStep,
|
AbsoluteActionsProcessorStep,
|
||||||
PolicyProcessorPipeline,
|
PolicyProcessorPipeline,
|
||||||
@@ -38,6 +37,7 @@ from lerobot.processor import (
|
|||||||
transition_to_batch,
|
transition_to_batch,
|
||||||
transition_to_policy_action,
|
transition_to_policy_action,
|
||||||
)
|
)
|
||||||
|
from lerobot.types import PolicyAction
|
||||||
from lerobot.utils.constants import (
|
from lerobot.utils.constants import (
|
||||||
ACTION,
|
ACTION,
|
||||||
POLICY_POSTPROCESSOR_DEFAULT_NAME,
|
POLICY_POSTPROCESSOR_DEFAULT_NAME,
|
||||||
|
|||||||
@@ -68,9 +68,6 @@ class GrootPolicy(PreTrainedPolicy):
|
|||||||
name = "groot"
|
name = "groot"
|
||||||
config_class = GrootConfig
|
config_class = GrootConfig
|
||||||
|
|
||||||
def supports_rtc(self) -> bool:
|
|
||||||
return True
|
|
||||||
|
|
||||||
def __init__(self, config: GrootConfig, **kwargs):
|
def __init__(self, config: GrootConfig, **kwargs):
|
||||||
"""Initialize Groot policy wrapper."""
|
"""Initialize Groot policy wrapper."""
|
||||||
require_package("transformers", extra="groot")
|
require_package("transformers", extra="groot")
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ if TYPE_CHECKING or _datasets_available:
|
|||||||
else:
|
else:
|
||||||
LeRobotDataset = None
|
LeRobotDataset = None
|
||||||
|
|
||||||
from lerobot.lerobot_types import EnvTransition, TransitionKey
|
|
||||||
from lerobot.processor import (
|
from lerobot.processor import (
|
||||||
AbsoluteActionsProcessorStep,
|
AbsoluteActionsProcessorStep,
|
||||||
AddBatchDimensionProcessorStep,
|
AddBatchDimensionProcessorStep,
|
||||||
@@ -67,6 +66,7 @@ from lerobot.processor import (
|
|||||||
transition_to_batch,
|
transition_to_batch,
|
||||||
transition_to_policy_action,
|
transition_to_policy_action,
|
||||||
)
|
)
|
||||||
|
from lerobot.types import EnvTransition, TransitionKey
|
||||||
from lerobot.utils.constants import (
|
from lerobot.utils.constants import (
|
||||||
ACTION,
|
ACTION,
|
||||||
OBS_IMAGE,
|
OBS_IMAGE,
|
||||||
|
|||||||
@@ -520,9 +520,6 @@ class MolmoAct2Policy(PreTrainedPolicy):
|
|||||||
config_class = MolmoAct2Config
|
config_class = MolmoAct2Config
|
||||||
name = "molmoact2"
|
name = "molmoact2"
|
||||||
|
|
||||||
def supports_rtc(self) -> bool:
|
|
||||||
return self.config.inference_action_mode == "continuous"
|
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
config: MolmoAct2Config,
|
config: MolmoAct2Config,
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ import torch
|
|||||||
from torch import Tensor
|
from torch import Tensor
|
||||||
|
|
||||||
from lerobot.configs import FeatureType, PipelineFeatureType, PolicyFeature
|
from lerobot.configs import FeatureType, PipelineFeatureType, PolicyFeature
|
||||||
from lerobot.lerobot_types import EnvTransition, TransitionKey
|
|
||||||
from lerobot.processor import (
|
from lerobot.processor import (
|
||||||
AddBatchDimensionProcessorStep,
|
AddBatchDimensionProcessorStep,
|
||||||
DeviceProcessorStep,
|
DeviceProcessorStep,
|
||||||
@@ -50,6 +49,7 @@ from lerobot.processor import (
|
|||||||
policy_action_to_transition,
|
policy_action_to_transition,
|
||||||
transition_to_policy_action,
|
transition_to_policy_action,
|
||||||
)
|
)
|
||||||
|
from lerobot.types import EnvTransition, TransitionKey
|
||||||
from lerobot.utils.constants import (
|
from lerobot.utils.constants import (
|
||||||
ACTION,
|
ACTION,
|
||||||
OBS_IMAGES,
|
OBS_IMAGES,
|
||||||
|
|||||||
@@ -749,9 +749,6 @@ class PI0Policy(PreTrainedPolicy):
|
|||||||
config_class = PI0Config
|
config_class = PI0Config
|
||||||
name = "pi0"
|
name = "pi0"
|
||||||
|
|
||||||
def supports_rtc(self) -> bool:
|
|
||||||
return True
|
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
config: PI0Config,
|
config: PI0Config,
|
||||||
|
|||||||
@@ -714,9 +714,6 @@ class PI05Policy(PreTrainedPolicy):
|
|||||||
config_class = PI05Config
|
config_class = PI05Config
|
||||||
name = "pi05"
|
name = "pi05"
|
||||||
|
|
||||||
def supports_rtc(self) -> bool:
|
|
||||||
return True
|
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
config: PI05Config,
|
config: PI05Config,
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import numpy as np
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from lerobot.configs import PipelineFeatureType, PolicyFeature
|
from lerobot.configs import PipelineFeatureType, PolicyFeature
|
||||||
from lerobot.lerobot_types import EnvTransition, TransitionKey
|
|
||||||
from lerobot.processor import (
|
from lerobot.processor import (
|
||||||
AbsoluteActionsProcessorStep,
|
AbsoluteActionsProcessorStep,
|
||||||
PolicyAction,
|
PolicyAction,
|
||||||
@@ -34,6 +33,7 @@ from lerobot.processor import (
|
|||||||
make_default_policy_processor_steps,
|
make_default_policy_processor_steps,
|
||||||
make_policy_processor_pipelines,
|
make_policy_processor_pipelines,
|
||||||
)
|
)
|
||||||
|
from lerobot.types import EnvTransition, TransitionKey
|
||||||
from lerobot.utils.constants import OBS_STATE
|
from lerobot.utils.constants import OBS_STATE
|
||||||
|
|
||||||
from .configuration_pi05 import PI05Config
|
from .configuration_pi05 import PI05Config
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import numpy as np
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from lerobot.configs import PipelineFeatureType, PolicyFeature
|
from lerobot.configs import PipelineFeatureType, PolicyFeature
|
||||||
from lerobot.lerobot_types import EnvTransition, TransitionKey
|
|
||||||
from lerobot.processor import (
|
from lerobot.processor import (
|
||||||
AbsoluteActionsProcessorStep,
|
AbsoluteActionsProcessorStep,
|
||||||
ActionTokenizerProcessorStep,
|
ActionTokenizerProcessorStep,
|
||||||
@@ -35,6 +34,7 @@ from lerobot.processor import (
|
|||||||
make_default_policy_processor_steps,
|
make_default_policy_processor_steps,
|
||||||
make_policy_processor_pipelines,
|
make_policy_processor_pipelines,
|
||||||
)
|
)
|
||||||
|
from lerobot.types import EnvTransition, TransitionKey
|
||||||
from lerobot.utils.constants import OBS_STATE
|
from lerobot.utils.constants import OBS_STATE
|
||||||
|
|
||||||
from .configuration_pi0_fast import PI0FastConfig
|
from .configuration_pi0_fast import PI0FastConfig
|
||||||
|
|||||||
@@ -249,10 +249,6 @@ class PreTrainedPolicy(nn.Module, HubMixin, abc.ABC):
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def supports_rtc(self) -> bool:
|
|
||||||
"""Whether this policy implements Real-Time Chunking inference semantics."""
|
|
||||||
return False
|
|
||||||
|
|
||||||
# TODO(aliberts, rcadene): split into 'forward' and 'compute_loss'?
|
# TODO(aliberts, rcadene): split into 'forward' and 'compute_loss'?
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def forward(self, batch: dict[str, Tensor]) -> tuple[Tensor, dict | None]:
|
def forward(self, batch: dict[str, Tensor]) -> tuple[Tensor, dict | None]:
|
||||||
|
|||||||
@@ -145,9 +145,6 @@ class SmolVLAPolicy(PreTrainedPolicy):
|
|||||||
config_class = SmolVLAConfig
|
config_class = SmolVLAConfig
|
||||||
name = "smolvla"
|
name = "smolvla"
|
||||||
|
|
||||||
def supports_rtc(self) -> bool:
|
|
||||||
return True
|
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
config: SmolVLAConfig,
|
config: SmolVLAConfig,
|
||||||
|
|||||||
@@ -168,23 +168,14 @@ class SmolVLMWithExpertModel(nn.Module):
|
|||||||
last_layers.append(self.num_vlm_layers - 2)
|
last_layers.append(self.num_vlm_layers - 2)
|
||||||
frozen_layers = [
|
frozen_layers = [
|
||||||
"lm_head",
|
"lm_head",
|
||||||
"text_model.norm.weight",
|
"text_model.model.norm.weight",
|
||||||
]
|
]
|
||||||
for layer in last_layers:
|
for layer in last_layers:
|
||||||
frozen_layers.append(f"text_model.layers.{layer}.")
|
frozen_layers.append(f"text_model.model.layers.{layer}.")
|
||||||
|
|
||||||
unmatched_patterns = set(frozen_layers)
|
|
||||||
for name, params in self.vlm.named_parameters():
|
for name, params in self.vlm.named_parameters():
|
||||||
matched_patterns = [k for k in frozen_layers if k in name]
|
if any(k in name for k in frozen_layers):
|
||||||
if matched_patterns:
|
|
||||||
params.requires_grad = False
|
params.requires_grad = False
|
||||||
unmatched_patterns.difference_update(matched_patterns)
|
|
||||||
if unmatched_patterns:
|
|
||||||
raise RuntimeError(
|
|
||||||
"Some frozen layer patterns matched no VLM parameters, so the corresponding layers "
|
|
||||||
"would silently remain trainable (parameter naming may have changed in transformers): "
|
|
||||||
f"{sorted(unmatched_patterns)}"
|
|
||||||
)
|
|
||||||
# To avoid unused params issue with distributed training
|
# To avoid unused params issue with distributed training
|
||||||
for name, params in self.lm_expert.named_parameters():
|
for name, params in self.lm_expert.named_parameters():
|
||||||
if "lm_head" in name:
|
if "lm_head" in name:
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import torch
|
|||||||
from torch import nn
|
from torch import nn
|
||||||
|
|
||||||
from lerobot.configs import FeatureType, PolicyFeature, PreTrainedConfig
|
from lerobot.configs import FeatureType, PolicyFeature, PreTrainedConfig
|
||||||
from lerobot.lerobot_types import PolicyAction, RobotAction, RobotObservation
|
from lerobot.types import PolicyAction, RobotAction, RobotObservation
|
||||||
from lerobot.utils.constants import ACTION, OBS_STR
|
from lerobot.utils.constants import ACTION, OBS_STR
|
||||||
from lerobot.utils.feature_utils import build_dataset_frame
|
from lerobot.utils.feature_utils import build_dataset_frame
|
||||||
|
|
||||||
|
|||||||
@@ -15,13 +15,11 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
from lerobot.configs.policies import PreTrainedConfig
|
from lerobot.configs.policies import PreTrainedConfig
|
||||||
from lerobot.configs.types import FeatureType, NormalizationMode, PolicyFeature
|
from lerobot.configs.types import NormalizationMode
|
||||||
from lerobot.optim.optimizers import AdamWConfig
|
from lerobot.optim.optimizers import AdamWConfig
|
||||||
from lerobot.optim.schedulers import CosineDecayWithWarmupSchedulerConfig
|
from lerobot.optim.schedulers import CosineDecayWithWarmupSchedulerConfig
|
||||||
from lerobot.utils.constants import OBS_STATE
|
|
||||||
|
|
||||||
|
|
||||||
@PreTrainedConfig.register_subclass("vla_jepa")
|
@PreTrainedConfig.register_subclass("vla_jepa")
|
||||||
@@ -124,13 +122,6 @@ class VLAJEPAConfig(PreTrainedConfig):
|
|||||||
if self.robot_state_feature is not None:
|
if self.robot_state_feature is not None:
|
||||||
self.state_dim = self.robot_state_feature.shape[0]
|
self.state_dim = self.robot_state_feature.shape[0]
|
||||||
|
|
||||||
def set_dataset_feature_metadata(self, dataset_features: dict[str, Any]) -> None:
|
|
||||||
"""Add `observation.state` to `input_features` if missing, so it gets normalized."""
|
|
||||||
if OBS_STATE in self.input_features or OBS_STATE not in dataset_features:
|
|
||||||
return
|
|
||||||
shape = tuple(dataset_features[OBS_STATE]["shape"])
|
|
||||||
self.input_features[OBS_STATE] = PolicyFeature(type=FeatureType.STATE, shape=shape)
|
|
||||||
|
|
||||||
def get_optimizer_preset(self) -> AdamWConfig:
|
def get_optimizer_preset(self) -> AdamWConfig:
|
||||||
return AdamWConfig(
|
return AdamWConfig(
|
||||||
lr=self.optimizer_lr,
|
lr=self.optimizer_lr,
|
||||||
|
|||||||
@@ -399,8 +399,7 @@ class VLAJEPAPolicy(PreTrainedPolicy):
|
|||||||
state = batch.get(OBS_STATE)
|
state = batch.get(OBS_STATE)
|
||||||
if state is not None:
|
if state is not None:
|
||||||
if state.ndim > 2:
|
if state.ndim > 2:
|
||||||
# deltas are forward-looking here, so index 0 is the current observation, not -1.
|
state = state[:, -1, :]
|
||||||
state = state[:, 0, :]
|
|
||||||
inputs["state"] = (state.unsqueeze(1) if state.ndim == 2 else state).float() # [B, 1, dim]
|
inputs["state"] = (state.unsqueeze(1) if state.ndim == 2 else state).float() # [B, 1, dim]
|
||||||
|
|
||||||
return inputs
|
return inputs
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ class XVLAModel(nn.Module):
|
|||||||
# Freeze or unfreeze policy transformer
|
# Freeze or unfreeze policy transformer
|
||||||
if not self.config.train_policy_transformer:
|
if not self.config.train_policy_transformer:
|
||||||
for name, param in self.transformer.named_parameters():
|
for name, param in self.transformer.named_parameters():
|
||||||
if "soft_prompt" not in name:
|
if "soft_prompts" not in name:
|
||||||
param.requires_grad = False
|
param.requires_grad = False
|
||||||
|
|
||||||
# Freeze or unfreeze soft prompts
|
# Freeze or unfreeze soft prompts
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import numpy as np
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from lerobot.configs import PipelineFeatureType, PolicyFeature
|
from lerobot.configs import PipelineFeatureType, PolicyFeature
|
||||||
from lerobot.lerobot_types import EnvTransition, TransitionKey
|
|
||||||
from lerobot.processor import (
|
from lerobot.processor import (
|
||||||
ObservationProcessorStep,
|
ObservationProcessorStep,
|
||||||
PolicyAction,
|
PolicyAction,
|
||||||
@@ -32,6 +31,7 @@ from lerobot.processor import (
|
|||||||
make_default_policy_processor_steps,
|
make_default_policy_processor_steps,
|
||||||
make_policy_processor_pipelines,
|
make_policy_processor_pipelines,
|
||||||
)
|
)
|
||||||
|
from lerobot.types import EnvTransition, TransitionKey
|
||||||
from lerobot.utils.constants import (
|
from lerobot.utils.constants import (
|
||||||
IMAGENET_STATS,
|
IMAGENET_STATS,
|
||||||
OBS_IMAGES,
|
OBS_IMAGES,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from lerobot.lerobot_types import (
|
from lerobot.types import (
|
||||||
EnvAction,
|
EnvAction,
|
||||||
EnvTransition,
|
EnvTransition,
|
||||||
PolicyAction,
|
PolicyAction,
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ from dataclasses import dataclass, field
|
|||||||
from torch import Tensor
|
from torch import Tensor
|
||||||
|
|
||||||
from lerobot.configs import PipelineFeatureType, PolicyFeature
|
from lerobot.configs import PipelineFeatureType, PolicyFeature
|
||||||
from lerobot.lerobot_types import EnvTransition, PolicyAction
|
from lerobot.types import EnvTransition, PolicyAction
|
||||||
from lerobot.utils.constants import OBS_ENV_STATE, OBS_IMAGE, OBS_IMAGES, OBS_STATE
|
from lerobot.utils.constants import OBS_ENV_STATE, OBS_IMAGE, OBS_IMAGES, OBS_STATE
|
||||||
|
|
||||||
from .pipeline import (
|
from .pipeline import (
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ from typing import Any
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
from lerobot.lerobot_types import EnvTransition, PolicyAction, RobotAction, RobotObservation, TransitionKey
|
from lerobot.types import EnvTransition, PolicyAction, RobotAction, RobotObservation, TransitionKey
|
||||||
from lerobot.utils.constants import ACTION, DONE, INFO, OBS_PREFIX, REWARD, TRUNCATED
|
from lerobot.utils.constants import ACTION, DONE, INFO, OBS_PREFIX, REWARD, TRUNCATED
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from lerobot.configs import FeatureType, PipelineFeatureType, PolicyFeature
|
from lerobot.configs import FeatureType, PipelineFeatureType, PolicyFeature
|
||||||
from lerobot.lerobot_types import PolicyAction, RobotAction
|
from lerobot.types import PolicyAction, RobotAction
|
||||||
|
|
||||||
from .pipeline import ActionProcessorStep, ProcessorStepRegistry, RobotActionProcessorStep
|
from .pipeline import ActionProcessorStep, ProcessorStepRegistry, RobotActionProcessorStep
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ from typing import Any
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from lerobot.configs import PipelineFeatureType, PolicyFeature
|
from lerobot.configs import PipelineFeatureType, PolicyFeature
|
||||||
from lerobot.lerobot_types import EnvTransition, PolicyAction, TransitionKey
|
from lerobot.types import EnvTransition, PolicyAction, TransitionKey
|
||||||
from lerobot.utils.device_utils import get_safe_torch_device
|
from lerobot.utils.device_utils import get_safe_torch_device
|
||||||
|
|
||||||
from .pipeline import ProcessorStep, ProcessorStepRegistry
|
from .pipeline import ProcessorStep, ProcessorStepRegistry
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ from typing import Any
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from lerobot.configs.policies import PreTrainedConfig
|
from lerobot.configs.policies import PreTrainedConfig
|
||||||
from lerobot.lerobot_types import PolicyAction, RobotAction, RobotObservation
|
from lerobot.types import PolicyAction, RobotAction, RobotObservation
|
||||||
from lerobot.utils.constants import POLICY_POSTPROCESSOR_DEFAULT_NAME, POLICY_PREPROCESSOR_DEFAULT_NAME
|
from lerobot.utils.constants import POLICY_POSTPROCESSOR_DEFAULT_NAME, POLICY_PREPROCESSOR_DEFAULT_NAME
|
||||||
|
|
||||||
from .batch_processor import AddBatchDimensionProcessorStep
|
from .batch_processor import AddBatchDimensionProcessorStep
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from lerobot.configs import PipelineFeatureType, PolicyFeature
|
from lerobot.configs import PipelineFeatureType, PolicyFeature
|
||||||
from lerobot.lerobot_types import EnvAction, EnvTransition, PolicyAction, TransitionKey
|
from lerobot.types import EnvAction, EnvTransition, PolicyAction, TransitionKey
|
||||||
|
|
||||||
from .converters import to_tensor
|
from .converters import to_tensor
|
||||||
from .hil_processor import TELEOP_ACTION_KEY
|
from .hil_processor import TELEOP_ACTION_KEY
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ from lerobot.teleoperators.utils import TeleopEvents
|
|||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from lerobot.teleoperators.teleoperator import Teleoperator
|
from lerobot.teleoperators.teleoperator import Teleoperator
|
||||||
|
|
||||||
from lerobot.lerobot_types import EnvTransition, PolicyAction, TransitionKey
|
from lerobot.types import EnvTransition, PolicyAction, TransitionKey
|
||||||
|
|
||||||
from .pipeline import (
|
from .pipeline import (
|
||||||
ComplementaryDataProcessorStep,
|
ComplementaryDataProcessorStep,
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import torch
|
|||||||
from torch import Tensor
|
from torch import Tensor
|
||||||
|
|
||||||
from lerobot.configs import FeatureType, NormalizationMode, PipelineFeatureType, PolicyFeature
|
from lerobot.configs import FeatureType, NormalizationMode, PipelineFeatureType, PolicyFeature
|
||||||
from lerobot.lerobot_types import EnvTransition, PolicyAction, TransitionKey
|
from lerobot.types import EnvTransition, PolicyAction, TransitionKey
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from lerobot.datasets import LeRobotDataset
|
from lerobot.datasets import LeRobotDataset
|
||||||
|
|||||||
@@ -45,14 +45,7 @@ from huggingface_hub import hf_hub_download
|
|||||||
from safetensors.torch import load_file, save_file
|
from safetensors.torch import load_file, save_file
|
||||||
|
|
||||||
from lerobot.configs import PipelineFeatureType, PolicyFeature
|
from lerobot.configs import PipelineFeatureType, PolicyFeature
|
||||||
from lerobot.lerobot_types import (
|
from lerobot.types import EnvAction, EnvTransition, PolicyAction, RobotAction, RobotObservation, TransitionKey
|
||||||
EnvAction,
|
|
||||||
EnvTransition,
|
|
||||||
PolicyAction,
|
|
||||||
RobotAction,
|
|
||||||
RobotObservation,
|
|
||||||
TransitionKey,
|
|
||||||
)
|
|
||||||
from lerobot.utils.constants import HF_LEROBOT_HOME
|
from lerobot.utils.constants import HF_LEROBOT_HOME
|
||||||
from lerobot.utils.hub import HubMixin
|
from lerobot.utils.hub import HubMixin
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ from typing import Any
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from lerobot.configs import FeatureType, PipelineFeatureType, PolicyFeature
|
from lerobot.configs import FeatureType, PipelineFeatureType, PolicyFeature
|
||||||
from lerobot.lerobot_types import PolicyAction, RobotAction
|
from lerobot.types import PolicyAction, RobotAction
|
||||||
from lerobot.utils.constants import ACTION
|
from lerobot.utils.constants import ACTION
|
||||||
|
|
||||||
from .pipeline import ActionProcessorStep, ProcessorStepRegistry
|
from .pipeline import ActionProcessorStep, ProcessorStepRegistry
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import torch
|
|||||||
from torch import Tensor
|
from torch import Tensor
|
||||||
|
|
||||||
from lerobot.configs import PipelineFeatureType, PolicyFeature
|
from lerobot.configs import PipelineFeatureType, PolicyFeature
|
||||||
from lerobot.lerobot_types import EnvTransition, TransitionKey
|
from lerobot.types import EnvTransition, TransitionKey
|
||||||
from lerobot.utils.constants import OBS_STATE
|
from lerobot.utils.constants import OBS_STATE
|
||||||
|
|
||||||
from .delta_action_processor import MapDeltaActionToRobotActionStep, MapTensorToDeltaActionDictStep
|
from .delta_action_processor import MapDeltaActionToRobotActionStep, MapTensorToDeltaActionDictStep
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ from lerobot.configs import PipelineFeatureType, PolicyFeature
|
|||||||
from lerobot.configs.recipe import TrainingRecipe
|
from lerobot.configs.recipe import TrainingRecipe
|
||||||
from lerobot.datasets.language import LANGUAGE_EVENTS, LANGUAGE_PERSISTENT
|
from lerobot.datasets.language import LANGUAGE_EVENTS, LANGUAGE_PERSISTENT
|
||||||
from lerobot.datasets.language_render import render_sample
|
from lerobot.datasets.language_render import render_sample
|
||||||
from lerobot.lerobot_types import EnvTransition, TransitionKey
|
from lerobot.types import EnvTransition, TransitionKey
|
||||||
from lerobot.utils.utils import unwrap_scalar
|
from lerobot.utils.utils import unwrap_scalar
|
||||||
|
|
||||||
from .pipeline import ProcessorStep, ProcessorStepRegistry
|
from .pipeline import ProcessorStep, ProcessorStepRegistry
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ from typing import TYPE_CHECKING, Any
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from lerobot.configs import FeatureType, PipelineFeatureType, PolicyFeature
|
from lerobot.configs import FeatureType, PipelineFeatureType, PolicyFeature
|
||||||
from lerobot.lerobot_types import EnvTransition, RobotObservation, TransitionKey
|
from lerobot.types import EnvTransition, RobotObservation, TransitionKey
|
||||||
from lerobot.utils.constants import (
|
from lerobot.utils.constants import (
|
||||||
ACTION_TOKEN_MASK,
|
ACTION_TOKEN_MASK,
|
||||||
ACTION_TOKENS,
|
ACTION_TOKENS,
|
||||||
|
|||||||
@@ -57,10 +57,10 @@ import torch
|
|||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
from lerobot.datasets import LeRobotDataset
|
from lerobot.datasets import LeRobotDataset
|
||||||
from lerobot.lerobot_types import TransitionKey
|
|
||||||
from lerobot.rewards.robometer.configuration_robometer import RobometerConfig
|
from lerobot.rewards.robometer.configuration_robometer import RobometerConfig
|
||||||
from lerobot.rewards.robometer.modeling_robometer import RobometerRewardModel
|
from lerobot.rewards.robometer.modeling_robometer import RobometerRewardModel
|
||||||
from lerobot.rewards.robometer.processor_robometer import RobometerEncoderProcessorStep
|
from lerobot.rewards.robometer.processor_robometer import RobometerEncoderProcessorStep
|
||||||
|
from lerobot.types import TransitionKey
|
||||||
|
|
||||||
DEFAULT_OUTPUT_FILENAME = "robometer_progress.parquet"
|
DEFAULT_OUTPUT_FILENAME = "robometer_progress.parquet"
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ from PIL import Image
|
|||||||
from torch import Tensor
|
from torch import Tensor
|
||||||
|
|
||||||
from lerobot.configs import PipelineFeatureType, PolicyFeature
|
from lerobot.configs import PipelineFeatureType, PolicyFeature
|
||||||
from lerobot.lerobot_types import EnvTransition, TransitionKey
|
|
||||||
from lerobot.processor import (
|
from lerobot.processor import (
|
||||||
AddBatchDimensionProcessorStep,
|
AddBatchDimensionProcessorStep,
|
||||||
DeviceProcessorStep,
|
DeviceProcessorStep,
|
||||||
@@ -40,6 +39,7 @@ from lerobot.rewards.robometer.configuration_robometer import (
|
|||||||
RobometerConfig,
|
RobometerConfig,
|
||||||
)
|
)
|
||||||
from lerobot.rewards.robometer.modeling_robometer import ROBOMETER_FEATURE_PREFIX
|
from lerobot.rewards.robometer.modeling_robometer import ROBOMETER_FEATURE_PREFIX
|
||||||
|
from lerobot.types import EnvTransition, TransitionKey
|
||||||
from lerobot.utils.constants import (
|
from lerobot.utils.constants import (
|
||||||
OBS_IMAGES,
|
OBS_IMAGES,
|
||||||
POLICY_POSTPROCESSOR_DEFAULT_NAME,
|
POLICY_POSTPROCESSOR_DEFAULT_NAME,
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ else:
|
|||||||
Faker = None # type: ignore[assignment, misc]
|
Faker = None # type: ignore[assignment, misc]
|
||||||
|
|
||||||
from lerobot.configs import FeatureType, PipelineFeatureType, PolicyFeature
|
from lerobot.configs import FeatureType, PipelineFeatureType, PolicyFeature
|
||||||
from lerobot.lerobot_types import EnvTransition, PolicyAction, TransitionKey
|
|
||||||
from lerobot.processor import (
|
from lerobot.processor import (
|
||||||
AddBatchDimensionProcessorStep,
|
AddBatchDimensionProcessorStep,
|
||||||
DeviceProcessorStep,
|
DeviceProcessorStep,
|
||||||
@@ -59,6 +58,7 @@ from lerobot.processor import (
|
|||||||
policy_action_to_transition,
|
policy_action_to_transition,
|
||||||
transition_to_policy_action,
|
transition_to_policy_action,
|
||||||
)
|
)
|
||||||
|
from lerobot.types import EnvTransition, PolicyAction, TransitionKey
|
||||||
from lerobot.utils.constants import POLICY_POSTPROCESSOR_DEFAULT_NAME, POLICY_PREPROCESSOR_DEFAULT_NAME
|
from lerobot.utils.constants import POLICY_POSTPROCESSOR_DEFAULT_NAME, POLICY_PREPROCESSOR_DEFAULT_NAME
|
||||||
|
|
||||||
from .configuration_sarm import SARMConfig
|
from .configuration_sarm import SARMConfig
|
||||||
|
|||||||
@@ -48,10 +48,10 @@ import torch
|
|||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
from lerobot.datasets import LeRobotDataset
|
from lerobot.datasets import LeRobotDataset
|
||||||
from lerobot.lerobot_types import TransitionKey
|
|
||||||
from lerobot.rewards.topreward.configuration_topreward import TOPRewardConfig
|
from lerobot.rewards.topreward.configuration_topreward import TOPRewardConfig
|
||||||
from lerobot.rewards.topreward.modeling_topreward import TOPRewardModel
|
from lerobot.rewards.topreward.modeling_topreward import TOPRewardModel
|
||||||
from lerobot.rewards.topreward.processor_topreward import TOPRewardEncoderProcessorStep
|
from lerobot.rewards.topreward.processor_topreward import TOPRewardEncoderProcessorStep
|
||||||
|
from lerobot.types import TransitionKey
|
||||||
|
|
||||||
DEFAULT_OUTPUT_FILENAME = "topreward_progress.parquet"
|
DEFAULT_OUTPUT_FILENAME = "topreward_progress.parquet"
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import torch
|
|||||||
from torch import Tensor
|
from torch import Tensor
|
||||||
|
|
||||||
from lerobot.configs import PipelineFeatureType, PolicyFeature
|
from lerobot.configs import PipelineFeatureType, PolicyFeature
|
||||||
from lerobot.lerobot_types import EnvTransition, TransitionKey
|
|
||||||
from lerobot.processor import (
|
from lerobot.processor import (
|
||||||
AddBatchDimensionProcessorStep,
|
AddBatchDimensionProcessorStep,
|
||||||
DeviceProcessorStep,
|
DeviceProcessorStep,
|
||||||
@@ -38,6 +37,7 @@ from lerobot.rewards.topreward.configuration_topreward import (
|
|||||||
DEFAULT_PROMPT_SUFFIX_TEMPLATE,
|
DEFAULT_PROMPT_SUFFIX_TEMPLATE,
|
||||||
TOPRewardConfig,
|
TOPRewardConfig,
|
||||||
)
|
)
|
||||||
|
from lerobot.types import EnvTransition, TransitionKey
|
||||||
from lerobot.utils.constants import (
|
from lerobot.utils.constants import (
|
||||||
OBS_IMAGES,
|
OBS_IMAGES,
|
||||||
OBS_PREFIX,
|
OBS_PREFIX,
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ from huggingface_hub.errors import HfHubHTTPError
|
|||||||
from safetensors.torch import load_file as load_safetensors, save_file as save_safetensors
|
from safetensors.torch import load_file as load_safetensors, save_file as save_safetensors
|
||||||
from torch.optim import Optimizer
|
from torch.optim import Optimizer
|
||||||
|
|
||||||
from lerobot.lerobot_types import BatchType
|
from lerobot.types import BatchType
|
||||||
from lerobot.utils.hub import HubMixin
|
from lerobot.utils.hub import HubMixin
|
||||||
|
|
||||||
from .configs import RLAlgorithmConfig, TrainingStats
|
from .configs import RLAlgorithmConfig, TrainingStats
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import abc
|
import abc
|
||||||
import builtins
|
import builtins
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
@@ -79,10 +78,8 @@ class RLAlgorithmConfig(draccus.ChoiceRegistry, HubMixin, abc.ABC):
|
|||||||
|
|
||||||
def _save_pretrained(self, save_directory: Path) -> None:
|
def _save_pretrained(self, save_directory: Path) -> None:
|
||||||
"""Serialize this config as ``config.json`` inside ``save_directory``."""
|
"""Serialize this config as ``config.json`` inside ``save_directory``."""
|
||||||
# Encode against the base class so draccus includes the choice "type" key,
|
with open(save_directory / CONFIG_NAME, "w") as f, draccus.config_type("json"):
|
||||||
# which `from_pretrained` needs to resolve the concrete subclass.
|
draccus.dump(self, f, indent=4)
|
||||||
with open(save_directory / CONFIG_NAME, "w") as f:
|
|
||||||
json.dump(draccus.encode(self, RLAlgorithmConfig), f, indent=4)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_pretrained(
|
def from_pretrained(
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import torch.nn.functional as F # noqa: N812
|
|||||||
from torch import Tensor
|
from torch import Tensor
|
||||||
from torch.optim import Optimizer
|
from torch.optim import Optimizer
|
||||||
|
|
||||||
from lerobot.lerobot_types import BatchType
|
|
||||||
from lerobot.policies.gaussian_actor.modeling_gaussian_actor import (
|
from lerobot.policies.gaussian_actor.modeling_gaussian_actor import (
|
||||||
DISCRETE_DIMENSION_INDEX,
|
DISCRETE_DIMENSION_INDEX,
|
||||||
MLP,
|
MLP,
|
||||||
@@ -36,6 +35,7 @@ from lerobot.policies.gaussian_actor.modeling_gaussian_actor import (
|
|||||||
orthogonal_init,
|
orthogonal_init,
|
||||||
)
|
)
|
||||||
from lerobot.policies.utils import get_device_from_parameters
|
from lerobot.policies.utils import get_device_from_parameters
|
||||||
|
from lerobot.types import BatchType
|
||||||
from lerobot.utils.constants import ACTION
|
from lerobot.utils.constants import ACTION
|
||||||
from lerobot.utils.transition import move_state_dict_to_device
|
from lerobot.utils.transition import move_state_dict_to_device
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import functools
|
|||||||
import threading
|
import threading
|
||||||
from collections.abc import Callable, Sequence
|
from collections.abc import Callable, Sequence
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
from typing import NotRequired, TypedDict
|
from typing import TypedDict
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
import torch.nn.functional as F # noqa: N812
|
import torch.nn.functional as F # noqa: N812
|
||||||
@@ -36,7 +36,7 @@ class BatchTransition(TypedDict):
|
|||||||
next_state: dict[str, torch.Tensor]
|
next_state: dict[str, torch.Tensor]
|
||||||
done: torch.Tensor
|
done: torch.Tensor
|
||||||
truncated: torch.Tensor
|
truncated: torch.Tensor
|
||||||
complementary_info: NotRequired[dict[str, torch.Tensor | float | int] | None]
|
complementary_info: dict[str, torch.Tensor | float | int] | None = None
|
||||||
|
|
||||||
|
|
||||||
def random_crop_vectorized(images: torch.Tensor, output_size: tuple) -> torch.Tensor:
|
def random_crop_vectorized(images: torch.Tensor, output_size: tuple) -> torch.Tensor:
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from lerobot.lerobot_types import BatchType
|
from lerobot.types import BatchType
|
||||||
|
|
||||||
from .data_mixer import DataMixer, OnlineOfflineMixer
|
from .data_mixer import DataMixer, OnlineOfflineMixer
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
from lerobot.lerobot_types import BatchType
|
from lerobot.types import BatchType
|
||||||
|
|
||||||
from ..buffer import ReplayBuffer, concatenate_batch_transitions
|
from ..buffer import ReplayBuffer, concatenate_batch_transitions
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ from __future__ import annotations
|
|||||||
from collections.abc import Iterator
|
from collections.abc import Iterator
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from lerobot.lerobot_types import BatchType
|
from lerobot.types import BatchType
|
||||||
|
|
||||||
from .algorithms.base import RLAlgorithm
|
from .algorithms.base import RLAlgorithm
|
||||||
from .algorithms.configs import TrainingStats
|
from .algorithms.configs import TrainingStats
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
import logging
|
import logging
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
|
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.bimanual import BimanualMixin
|
from lerobot.utils.bimanual import BimanualMixin
|
||||||
from lerobot.utils.decorators import check_if_not_connected
|
from lerobot.utils.decorators import check_if_not_connected
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
import logging
|
import logging
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
|
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.bimanual import BimanualMixin
|
from lerobot.utils.bimanual import BimanualMixin
|
||||||
from lerobot.utils.decorators import check_if_not_connected
|
from lerobot.utils.decorators import check_if_not_connected
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
import logging
|
import logging
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
|
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.bimanual import BimanualMixin
|
from lerobot.utils.bimanual import BimanualMixin
|
||||||
from lerobot.utils.decorators import check_if_not_connected
|
from lerobot.utils.decorators import check_if_not_connected
|
||||||
|
|
||||||
@@ -62,7 +62,6 @@ class BiSOFollower(BimanualMixin, Robot):
|
|||||||
position_i_coefficient=config.left_arm_config.position_i_coefficient,
|
position_i_coefficient=config.left_arm_config.position_i_coefficient,
|
||||||
position_d_coefficient=config.left_arm_config.position_d_coefficient,
|
position_d_coefficient=config.left_arm_config.position_d_coefficient,
|
||||||
use_degrees=config.left_arm_config.use_degrees,
|
use_degrees=config.left_arm_config.use_degrees,
|
||||||
num_read_retries=config.left_arm_config.num_read_retries,
|
|
||||||
cameras=left_arm_cameras,
|
cameras=left_arm_cameras,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -76,7 +75,6 @@ class BiSOFollower(BimanualMixin, Robot):
|
|||||||
position_i_coefficient=config.right_arm_config.position_i_coefficient,
|
position_i_coefficient=config.right_arm_config.position_i_coefficient,
|
||||||
position_d_coefficient=config.right_arm_config.position_d_coefficient,
|
position_d_coefficient=config.right_arm_config.position_d_coefficient,
|
||||||
use_degrees=config.right_arm_config.use_degrees,
|
use_degrees=config.right_arm_config.use_degrees,
|
||||||
num_read_retries=config.right_arm_config.num_read_retries,
|
|
||||||
cameras=config.right_arm_config.cameras,
|
cameras=config.right_arm_config.cameras,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import cv2
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
||||||
from lerobot.utils.errors import DeviceNotConnectedError
|
from lerobot.utils.errors import DeviceNotConnectedError
|
||||||
|
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ import time
|
|||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
|
|
||||||
from lerobot.cameras import make_cameras_from_configs
|
from lerobot.cameras import make_cameras_from_configs
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
|
||||||
from lerobot.motors import Motor, MotorNormMode
|
from lerobot.motors import Motor, MotorNormMode
|
||||||
from lerobot.motors.calibration_gui import RangeFinderGUI
|
from lerobot.motors.calibration_gui import RangeFinderGUI
|
||||||
from lerobot.motors.feetech import (
|
from lerobot.motors.feetech import (
|
||||||
FeetechMotorsBus,
|
FeetechMotorsBus,
|
||||||
)
|
)
|
||||||
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
||||||
|
|
||||||
from ..robot import Robot
|
from ..robot import Robot
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ import time
|
|||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
|
|
||||||
from lerobot.cameras import make_cameras_from_configs
|
from lerobot.cameras import make_cameras_from_configs
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
|
||||||
from lerobot.motors import Motor, MotorNormMode
|
from lerobot.motors import Motor, MotorNormMode
|
||||||
from lerobot.motors.calibration_gui import RangeFinderGUI
|
from lerobot.motors.calibration_gui import RangeFinderGUI
|
||||||
from lerobot.motors.feetech import (
|
from lerobot.motors.feetech import (
|
||||||
FeetechMotorsBus,
|
FeetechMotorsBus,
|
||||||
)
|
)
|
||||||
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
||||||
|
|
||||||
from ..robot import Robot
|
from ..robot import Robot
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ import time
|
|||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
|
|
||||||
from lerobot.cameras import make_cameras_from_configs
|
from lerobot.cameras import make_cameras_from_configs
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
|
||||||
from lerobot.motors import Motor, MotorCalibration, MotorNormMode
|
from lerobot.motors import Motor, MotorCalibration, MotorNormMode
|
||||||
from lerobot.motors.dynamixel import (
|
from lerobot.motors.dynamixel import (
|
||||||
DynamixelMotorsBus,
|
DynamixelMotorsBus,
|
||||||
OperatingMode,
|
OperatingMode,
|
||||||
)
|
)
|
||||||
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
||||||
|
|
||||||
from ..robot import Robot
|
from ..robot import Robot
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ from typing import Any
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from lerobot.cameras import make_cameras_from_configs
|
from lerobot.cameras import make_cameras_from_configs
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
|
||||||
from lerobot.motors import Motor, MotorCalibration, MotorNormMode
|
from lerobot.motors import Motor, MotorCalibration, MotorNormMode
|
||||||
from lerobot.motors.feetech import (
|
from lerobot.motors.feetech import (
|
||||||
FeetechMotorsBus,
|
FeetechMotorsBus,
|
||||||
OperatingMode,
|
OperatingMode,
|
||||||
)
|
)
|
||||||
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
||||||
|
|
||||||
from ..robot import Robot
|
from ..robot import Robot
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ from functools import cached_property
|
|||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.constants import ACTION, OBS_STATE
|
from lerobot.utils.constants import ACTION, OBS_STATE
|
||||||
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
||||||
from lerobot.utils.errors import DeviceNotConnectedError
|
from lerobot.utils.errors import DeviceNotConnectedError
|
||||||
|
|||||||
@@ -19,13 +19,13 @@ import time
|
|||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
|
|
||||||
from lerobot.cameras import make_cameras_from_configs
|
from lerobot.cameras import make_cameras_from_configs
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
|
||||||
from lerobot.motors import Motor, MotorCalibration, MotorNormMode
|
from lerobot.motors import Motor, MotorCalibration, MotorNormMode
|
||||||
from lerobot.motors.dynamixel import (
|
from lerobot.motors.dynamixel import (
|
||||||
DriveMode,
|
DriveMode,
|
||||||
DynamixelMotorsBus,
|
DynamixelMotorsBus,
|
||||||
OperatingMode,
|
OperatingMode,
|
||||||
)
|
)
|
||||||
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
||||||
|
|
||||||
from ..robot import Robot
|
from ..robot import Robot
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ from functools import cached_property
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from lerobot.cameras import make_cameras_from_configs
|
from lerobot.cameras import make_cameras_from_configs
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
|
||||||
from lerobot.motors import Motor, MotorCalibration, MotorNormMode
|
from lerobot.motors import Motor, MotorCalibration, MotorNormMode
|
||||||
from lerobot.motors.damiao import DamiaoMotorsBus
|
from lerobot.motors.damiao import DamiaoMotorsBus
|
||||||
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
||||||
|
|
||||||
from ..robot import Robot
|
from ..robot import Robot
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import time
|
|||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
from lerobot.cameras import make_cameras_from_configs
|
from lerobot.cameras import make_cameras_from_configs
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.import_utils import _reachy2_sdk_available, require_package
|
from lerobot.utils.import_utils import _reachy2_sdk_available, require_package
|
||||||
|
|
||||||
from ..robot import Robot
|
from ..robot import Robot
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ from functools import cached_property
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from lerobot.cameras import make_cameras_from_configs
|
from lerobot.cameras import make_cameras_from_configs
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
|
||||||
from lerobot.motors import MotorCalibration
|
from lerobot.motors import MotorCalibration
|
||||||
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
||||||
from lerobot.utils.import_utils import _motorbridge_available, require_package
|
from lerobot.utils.import_utils import _motorbridge_available, require_package
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ from pathlib import Path
|
|||||||
|
|
||||||
import draccus
|
import draccus
|
||||||
|
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
|
||||||
from lerobot.motors import MotorCalibration
|
from lerobot.motors import MotorCalibration
|
||||||
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.constants import HF_LEROBOT_CALIBRATION, ROBOTS
|
from lerobot.utils.constants import HF_LEROBOT_CALIBRATION, ROBOTS
|
||||||
|
|
||||||
from .config import RobotConfig
|
from .config import RobotConfig
|
||||||
|
|||||||
@@ -510,10 +510,10 @@ class ForwardKinematicsJointsToEEAction(RobotActionProcessorStep):
|
|||||||
# We only use the ee pose in the dataset, so we don't need the joint positions
|
# We only use the ee pose in the dataset, so we don't need the joint positions
|
||||||
for n in self.motor_names:
|
for n in self.motor_names:
|
||||||
features[PipelineFeatureType.ACTION].pop(f"{n}.pos", None)
|
features[PipelineFeatureType.ACTION].pop(f"{n}.pos", None)
|
||||||
# Store end-effector features as actions in the dataset schema
|
# We specify the dataset features of this step that we want to be stored in the dataset
|
||||||
for k in ["x", "y", "z", "wx", "wy", "wz", "gripper_pos"]:
|
for k in ["x", "y", "z", "wx", "wy", "wz", "gripper_pos"]:
|
||||||
features[PipelineFeatureType.ACTION][f"ee.{k}"] = PolicyFeature(
|
features[PipelineFeatureType.ACTION][f"ee.{k}"] = PolicyFeature(
|
||||||
type=FeatureType.ACTION, shape=(1,)
|
type=FeatureType.STATE, shape=(1,)
|
||||||
)
|
)
|
||||||
return features
|
return features
|
||||||
|
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ import time
|
|||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
|
|
||||||
from lerobot.cameras import make_cameras_from_configs
|
from lerobot.cameras import make_cameras_from_configs
|
||||||
from lerobot.lerobot_types import RobotAction, RobotObservation
|
|
||||||
from lerobot.motors import Motor, MotorCalibration, MotorNormMode
|
from lerobot.motors import Motor, MotorCalibration, MotorNormMode
|
||||||
from lerobot.motors.feetech import (
|
from lerobot.motors.feetech import (
|
||||||
FeetechMotorsBus,
|
FeetechMotorsBus,
|
||||||
OperatingMode,
|
OperatingMode,
|
||||||
)
|
)
|
||||||
|
from lerobot.types import RobotAction, RobotObservation
|
||||||
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
||||||
|
|
||||||
from ..robot import Robot
|
from ..robot import Robot
|
||||||
@@ -142,11 +142,25 @@ class SOFollower(Robot):
|
|||||||
range_mins[full_turn_motor] = 0
|
range_mins[full_turn_motor] = 0
|
||||||
range_maxes[full_turn_motor] = 4095
|
range_maxes[full_turn_motor] = 4095
|
||||||
|
|
||||||
|
drive_modes = dict.fromkeys(self.bus.motors, 0)
|
||||||
|
input(f"Fully close the gripper of {self} and press ENTER....")
|
||||||
|
gripper_closed_pos = self.bus.read(
|
||||||
|
"Present_Position", "gripper", normalize=False, num_retry=self.config.num_read_retries
|
||||||
|
)
|
||||||
|
distance_to_min = abs(gripper_closed_pos - range_mins["gripper"])
|
||||||
|
distance_to_max = abs(gripper_closed_pos - range_maxes["gripper"])
|
||||||
|
if min(distance_to_min, distance_to_max) > (range_maxes["gripper"] - range_mins["gripper"]) * 0.2:
|
||||||
|
raise ValueError("Gripper is not fully closed. Run calibration again.")
|
||||||
|
|
||||||
|
drive_modes["gripper"] = int(distance_to_max < distance_to_min)
|
||||||
|
if drive_modes["gripper"]:
|
||||||
|
logger.info("Gripper motor is inverted, setting drive_mode=1 to compensate.")
|
||||||
|
|
||||||
self.calibration = {}
|
self.calibration = {}
|
||||||
for motor, m in self.bus.motors.items():
|
for motor, m in self.bus.motors.items():
|
||||||
self.calibration[motor] = MotorCalibration(
|
self.calibration[motor] = MotorCalibration(
|
||||||
id=m.id,
|
id=m.id,
|
||||||
drive_mode=0,
|
drive_mode=drive_modes[motor],
|
||||||
homing_offset=homing_offsets[motor],
|
homing_offset=homing_offsets[motor],
|
||||||
range_min=range_mins[motor],
|
range_min=range_mins[motor],
|
||||||
range_max=range_maxes[motor],
|
range_max=range_maxes[motor],
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user