docs and examples imports update

This commit is contained in:
Steven Palma
2026-04-12 09:43:13 +02:00
parent 89b4652de0
commit b132e2b5d6
53 changed files with 212 additions and 215 deletions
+1 -1
View File
@@ -216,7 +216,7 @@ class MyBenchmarkEnvConfig(EnvConfig):
def get_env_processors(self): def get_env_processors(self):
"""Override if your benchmark needs observation/action transforms.""" """Override if your benchmark needs observation/action transforms."""
from lerobot.processor.pipeline import PolicyProcessorPipeline from lerobot.processor import PolicyProcessorPipeline
from lerobot.processor.env_processor import MyBenchmarkProcessorStep from lerobot.processor.env_processor import MyBenchmarkProcessorStep
return ( return (
PolicyProcessorPipeline(steps=[MyBenchmarkProcessorStep()]), PolicyProcessorPipeline(steps=[MyBenchmarkProcessorStep()]),
+1 -1
View File
@@ -170,7 +170,7 @@ python -m lerobot.async_inference.robot_client \
```python ```python
import threading import threading
from lerobot.robots.so_follower import SO100FollowerConfig from lerobot.robots.so_follower import SO100FollowerConfig
from lerobot.cameras.opencv.configuration_opencv import OpenCVCameraConfig from lerobot.cameras.opencv import OpenCVCameraConfig
from lerobot.async_inference.configs import RobotClientConfig from lerobot.async_inference.configs import RobotClientConfig
from lerobot.async_inference.robot_client import RobotClient from lerobot.async_inference.robot_client import RobotClient
from lerobot.async_inference.helpers import visualize_action_queue_size from lerobot.async_inference.helpers import visualize_action_queue_size
+1 -1
View File
@@ -41,7 +41,7 @@ The script:
```python ```python
# New usage pattern (after migration) # New usage pattern (after migration)
from lerobot.policies.factory import make_policy, make_pre_post_processors from lerobot.policies import make_policy, make_pre_post_processors
# Load model and processors separately # Load model and processors separately
policy = make_policy(config, ds_meta=dataset.meta) policy = make_policy(config, ds_meta=dataset.meta)
+4 -4
View File
@@ -47,9 +47,9 @@ Here is a template to get you started, customize the parameters and methods as n
```python ```python
# configuration_my_custom_policy.py # configuration_my_custom_policy.py
from dataclasses import dataclass, field from dataclasses import dataclass, field
from lerobot.configs.policies import PreTrainedConfig from lerobot.configs import PreTrainedConfig
from lerobot.optim.optimizers import AdamWConfig from lerobot.optim import AdamWConfig
from lerobot.optim.schedulers import CosineDecayWithWarmupSchedulerConfig from lerobot.optim import CosineDecayWithWarmupSchedulerConfig
@PreTrainedConfig.register_subclass("my_custom_policy") @PreTrainedConfig.register_subclass("my_custom_policy")
@dataclass @dataclass
@@ -120,7 +120,7 @@ import torch
import torch.nn as nn import torch.nn as nn
from typing import Any from typing import Any
from lerobot.policies.pretrained import PreTrainedPolicy from lerobot.policies import PreTrainedPolicy
from lerobot.utils.constants import ACTION from lerobot.utils.constants import ACTION
from .configuration_my_custom_policy import MyCustomPolicyConfig from .configuration_my_custom_policy import MyCustomPolicyConfig
+4 -6
View File
@@ -79,9 +79,8 @@ The following examples show how to use the camera API to configure and capture f
<!-- prettier-ignore-start --> <!-- prettier-ignore-start -->
```python ```python
from lerobot.cameras.opencv.configuration_opencv import OpenCVCameraConfig from lerobot.cameras.opencv import OpenCVCamera, OpenCVCameraConfig
from lerobot.cameras.opencv.camera_opencv import OpenCVCamera from lerobot.cameras import ColorMode, Cv2Rotation
from lerobot.cameras.configs import ColorMode, Cv2Rotation
# Construct an `OpenCVCameraConfig` with your desired FPS, resolution, color mode, and rotation. # Construct an `OpenCVCameraConfig` with your desired FPS, resolution, color mode, and rotation.
config = OpenCVCameraConfig( config = OpenCVCameraConfig(
@@ -126,9 +125,8 @@ with OpenCVCamera(config) as camera:
<!-- prettier-ignore-start --> <!-- prettier-ignore-start -->
```python ```python
from lerobot.cameras.realsense.configuration_realsense import RealSenseCameraConfig from lerobot.cameras.realsense import RealSenseCamera, RealSenseCameraConfig
from lerobot.cameras.realsense.camera_realsense import RealSenseCamera from lerobot.cameras import ColorMode, Cv2Rotation
from lerobot.cameras.configs import ColorMode, Cv2Rotation
# Create a `RealSenseCameraConfig` specifying your cameras serial number and enabling depth. # Create a `RealSenseCameraConfig` specifying your cameras serial number and enabling depth.
config = RealSenseCameraConfig( config = RealSenseCameraConfig(
+6 -7
View File
@@ -95,7 +95,7 @@ After completing your annotation:
When you load a dataset with subtask annotations, the subtask information is automatically available: When you load a dataset with subtask annotations, the subtask information is automatically available:
```python ```python
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset
# Load a dataset with subtask annotations # Load a dataset with subtask annotations
dataset = LeRobotDataset("jadechoghari/collect-fruit-annotated") dataset = LeRobotDataset("jadechoghari/collect-fruit-annotated")
@@ -133,11 +133,10 @@ if has_subtasks:
The `TokenizerProcessor` automatically handles subtask tokenization for Vision-Language Action (VLA) models: The `TokenizerProcessor` automatically handles subtask tokenization for Vision-Language Action (VLA) models:
```python ```python
from lerobot.processor.tokenizer_processor import TokenizerProcessor from lerobot.processor import TokenizerProcessorStep
from lerobot.processor.pipeline import ProcessorPipeline
# Create a tokenizer processor # Create a tokenizer processor step
tokenizer_processor = TokenizerProcessor( tokenizer_processor = TokenizerProcessorStep(
tokenizer_name_or_path="google/paligemma-3b-pt-224", tokenizer_name_or_path="google/paligemma-3b-pt-224",
padding="max_length", padding="max_length",
max_length=64, max_length=64,
@@ -158,7 +157,7 @@ When subtasks are available in the batch, the tokenizer processor adds:
```python ```python
import torch import torch
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset
dataset = LeRobotDataset("jadechoghari/collect-fruit-annotated") dataset = LeRobotDataset("jadechoghari/collect-fruit-annotated")
@@ -182,7 +181,7 @@ for batch in dataloader:
Try loading a dataset with subtask annotations: Try loading a dataset with subtask annotations:
```python ```python
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset
# Example dataset with subtask annotations # Example dataset with subtask annotations
dataset = LeRobotDataset("jadechoghari/collect-fruit-annotated") dataset = LeRobotDataset("jadechoghari/collect-fruit-annotated")
+2 -2
View File
@@ -66,10 +66,10 @@ The SDK gives you:
Follow our [Installation Guide](./installation) to install LeRobot. Follow our [Installation Guide](./installation) to install LeRobot.
In addition to the base installation, install the EarthRover Mini dependencies: In addition to the base installation, install the EarthRover Mini with hardware dependencies:
```bash ```bash
pip install -e . pip install -e ".[hardware]"
``` ```
## How It Works ## How It Works
+3 -3
View File
@@ -173,8 +173,8 @@ observation = {
The `make_env_pre_post_processors` function follows the same pattern as `make_pre_post_processors` for policies: The `make_env_pre_post_processors` function follows the same pattern as `make_pre_post_processors` for policies:
```python ```python
from lerobot.envs.factory import make_env_pre_post_processors from lerobot.envs import make_env_pre_post_processors, PushtEnv
from lerobot.envs.configs import LiberoEnv, PushtEnv from lerobot.envs.configs import LiberoEnv
# For LIBERO: Returns LiberoProcessorStep in preprocessor # For LIBERO: Returns LiberoProcessorStep in preprocessor
libero_cfg = LiberoEnv(task="libero_spatial", camera_name=["agentview"]) libero_cfg = LiberoEnv(task="libero_spatial", camera_name=["agentview"])
@@ -257,7 +257,7 @@ def eval_main(cfg: EvalPipelineConfig):
The `LiberoProcessorStep` demonstrates a real-world environment processor: The `LiberoProcessorStep` demonstrates a real-world environment processor:
```python ```python
from lerobot.processor.pipeline import ObservationProcessorStep from lerobot.processor import ObservationProcessorStep
@dataclass @dataclass
@ProcessorStepRegistry.register(name="libero_processor") @ProcessorStepRegistry.register(name="libero_processor")
+3 -3
View File
@@ -34,7 +34,7 @@ Finally, your environment must implement the standard `gym.vector.VectorEnv` int
Loading an environment from the Hub is as simple as: Loading an environment from the Hub is as simple as:
```python ```python
from lerobot.envs.factory import make_env from lerobot.envs import make_env
# Load a hub environment (requires explicit consent to run remote code) # Load a hub environment (requires explicit consent to run remote code)
env = make_env("lerobot/cartpole-env", trust_remote_code=True) env = make_env("lerobot/cartpole-env", trust_remote_code=True)
@@ -191,7 +191,7 @@ api.upload_folder(
### Basic Usage ### Basic Usage
```python ```python
from lerobot.envs.factory import make_env from lerobot.envs import make_env
# Load from the hub # Load from the hub
envs_dict = make_env( envs_dict = make_env(
@@ -314,7 +314,7 @@ env = make_env("trusted-org/verified-env@a1b2c3d4", trust_remote_code=True)
Here's a complete example using the reference CartPole environment: Here's a complete example using the reference CartPole environment:
```python ```python
from lerobot.envs.factory import make_env from lerobot.envs import make_env
import numpy as np import numpy as np
# Load the environment # Load the environment
+3 -3
View File
@@ -58,10 +58,10 @@ pip install -e .
cd .. cd ..
# 5. Install LeRobot # 5. Install LeRobot (evaluation extra for env/policy evaluation)
git clone https://github.com/huggingface/lerobot.git git clone https://github.com/huggingface/lerobot.git
cd lerobot cd lerobot
pip install -e . pip install -e ".[evaluation]"
cd .. cd ..
@@ -262,7 +262,7 @@ def main(cfg: EvalPipelineConfig):
"""Run random action rollout for IsaacLab Arena environment.""" """Run random action rollout for IsaacLab Arena environment."""
logging.info(pformat(asdict(cfg))) logging.info(pformat(asdict(cfg)))
from lerobot.envs.factory import make_env from lerobot.envs import make_env
env_dict = make_env( env_dict = make_env(
cfg.env, cfg.env,
+3 -3
View File
@@ -74,7 +74,7 @@ EnvHub exposes every LeIsaac-supported task in a uniform interface. The examples
# envhub_random_action.py # envhub_random_action.py
import torch import torch
from lerobot.envs.factory import make_env from lerobot.envs import make_env
# Load from the hub # Load from the hub
envs_dict = make_env("LightwheelAI/leisaac_env:envs/so101_pick_orange.py", n_envs=1, trust_remote_code=True) envs_dict = make_env("LightwheelAI/leisaac_env:envs/so101_pick_orange.py", n_envs=1, trust_remote_code=True)
@@ -142,7 +142,7 @@ from lerobot.teleoperators import ( # noqa: F401
) )
from lerobot.utils.robot_utils import precise_sleep from lerobot.utils.robot_utils import precise_sleep
from lerobot.utils.utils import init_logging from lerobot.utils.utils import init_logging
from lerobot.envs.factory import make_env from lerobot.envs import make_env
@dataclass @dataclass
@@ -282,7 +282,7 @@ Note: when working with `bi_so101_fold_cloth`, call `initialize()` immediately a
```python ```python
import torch import torch
from lerobot.envs.factory import make_env from lerobot.envs import make_env
# Load from the hub # Load from the hub
envs_dict = make_env("LightwheelAI/leisaac_env:envs/bi_so101_fold_cloth.py", n_envs=1, trust_remote_code=True) envs_dict = make_env("LightwheelAI/leisaac_env:envs/bi_so101_fold_cloth.py", n_envs=1, trust_remote_code=True)
+17 -20
View File
@@ -58,8 +58,8 @@ lerobot-teleoperate \
<!-- prettier-ignore-start --> <!-- prettier-ignore-start -->
```python ```python
from lerobot.teleoperators.so_leader import SO101LeaderConfig, SO101Leader from lerobot.teleoperators.so_leader import SO101Leader, SO101LeaderConfig
from lerobot.robots.so_follower import SO101FollowerConfig, SO101Follower from lerobot.robots.so_follower import SO101Follower, SO101FollowerConfig
robot_config = SO101FollowerConfig( robot_config = SO101FollowerConfig(
port="/dev/tty.usbmodem58760431541", port="/dev/tty.usbmodem58760431541",
@@ -116,9 +116,9 @@ lerobot-teleoperate \
<!-- prettier-ignore-start --> <!-- prettier-ignore-start -->
```python ```python
from lerobot.cameras.opencv.configuration_opencv import OpenCVCameraConfig from lerobot.cameras.opencv import OpenCVCameraConfig
from lerobot.teleoperators.koch_leader import KochLeaderConfig, KochLeader from lerobot.teleoperators.koch_leader import KochLeader, KochLeaderConfig
from lerobot.robots.koch_follower import KochFollowerConfig, KochFollower from lerobot.robots.koch_follower import KochFollower, KochFollowerConfig
camera_config = { camera_config = {
"front": OpenCVCameraConfig(index_or_path=0, width=1920, height=1080, fps=30) "front": OpenCVCameraConfig(index_or_path=0, width=1920, height=1080, fps=30)
@@ -195,12 +195,11 @@ lerobot-record \
<!-- prettier-ignore-start --> <!-- prettier-ignore-start -->
```python ```python
from lerobot.cameras.opencv.configuration_opencv import OpenCVCameraConfig from lerobot.cameras.opencv import OpenCVCameraConfig
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset
from lerobot.datasets.utils import hw_to_dataset_features from lerobot.utils.feature_utils import hw_to_dataset_features
from lerobot.robots.so_follower import SO100Follower, SO100FollowerConfig from lerobot.robots.so_follower import SO100Follower, SO100FollowerConfig
from lerobot.teleoperators.so_leader.config_so100_leader import SO100LeaderConfig from lerobot.teleoperators.so_leader import SO100Leader, SO100LeaderConfig
from lerobot.teleoperators.so_leader.so100_leader import SO100Leader
from lerobot.common.control_utils import init_keyboard_listener from lerobot.common.control_utils import init_keyboard_listener
from lerobot.utils.utils import log_say from lerobot.utils.utils import log_say
from lerobot.utils.visualization_utils import init_rerun from lerobot.utils.visualization_utils import init_rerun
@@ -410,9 +409,8 @@ lerobot-replay \
```python ```python
import time import time
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset
from lerobot.robots.so_follower.config_so100_follower import SO100FollowerConfig from lerobot.robots.so_follower import SO100Follower, SO100FollowerConfig
from lerobot.robots.so_follower.so100_follower import SO100Follower
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
@@ -532,13 +530,12 @@ lerobot-record \
<!-- prettier-ignore-start --> <!-- prettier-ignore-start -->
```python ```python
from lerobot.cameras.opencv.configuration_opencv import OpenCVCameraConfig from lerobot.cameras.opencv import OpenCVCameraConfig
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset
from lerobot.datasets.utils import hw_to_dataset_features from lerobot.utils.feature_utils import hw_to_dataset_features
from lerobot.policies.act.modeling_act import ACTPolicy from lerobot.policies.act import ACTPolicy
from lerobot.policies.factory import make_pre_post_processors from lerobot.policies import make_pre_post_processors
from lerobot.robots.so_follower.config_so100_follower import SO100FollowerConfig from lerobot.robots.so_follower import SO100Follower, SO100FollowerConfig
from lerobot.robots.so_follower.so100_follower import SO100Follower
from lerobot.scripts.lerobot_record import record_loop from lerobot.scripts.lerobot_record import record_loop
from lerobot.common.control_utils import init_keyboard_listener from lerobot.common.control_utils import init_keyboard_listener
from lerobot.utils.utils import log_say from lerobot.utils.utils import log_say
+45 -16
View File
@@ -116,6 +116,8 @@ brew install ffmpeg
## Step 3: Install LeRobot 🤗 ## Step 3: Install LeRobot 🤗
The base `lerobot` install is intentionally **lightweight** — it includes only core ML dependencies (PyTorch, torchvision, numpy, opencv, einops, draccus, huggingface-hub, gymnasium, safetensors). Heavier dependencies are gated behind optional extras so you only install what you need.
### From Source ### From Source
First, clone the repository and navigate into the directory: First, clone the repository and navigate into the directory:
@@ -131,12 +133,16 @@ Then, install the library in editable mode. This is useful if you plan to contri
<hfoptions id="install_lerobot_src"> <hfoptions id="install_lerobot_src">
<hfoption id="conda"> <hfoption id="conda">
```bash ```bash
pip install -e . pip install -e ".[robot]" # For real robot workflows (recording, replaying)
pip install -e ".[training]" # For training policies
pip install -e ".[all]" # Everything (all policies, envs, hardware, dev tools)
``` ```
</hfoption> </hfoption>
<hfoption id="uv"> <hfoption id="uv">
```bash ```bash
uv pip install -e . uv pip install -e ".[robot]" # For real robot workflows (recording, replaying)
uv pip install -e ".[training]" # For training policies
uv pip install -e ".[all]" # Everything (all policies, envs, hardware, dev tools)
``` ```
</hfoption> </hfoption>
</hfoptions> </hfoptions>
@@ -162,26 +168,49 @@ uv pip install lerobot
</hfoptions> </hfoptions>
<!-- prettier-ignore-end --> <!-- prettier-ignore-end -->
_This installs only the default dependencies._ _This installs only the core ML dependencies. You will need to add extras for most workflows._
**Extra Features:** **Feature Extras:**
To install additional functionality, use one of the following (If you are using `uv`, replace `pip install` with `uv pip install` in the commands below.): LeRobot provides **feature-scoped extras** that map to common workflows. If you are using `uv`, replace `pip install` with `uv pip install` in the commands below.
| Extra | What it adds | Typical use case |
| ---------- | ------------------------------------------- | ----------------------------------- |
| `dataset` | `datasets`, `av`, `torchcodec`, `jsonlines` | Loading & creating datasets |
| `training` | `dataset` + `accelerate`, `wandb` | Training policies |
| `hardware` | `pynput`, `pyserial`, `deepdiff` | Connecting to real robots |
| `viz` | `rerun-sdk` | Visualization during recording/eval |
| `build` | `cmake`, `setuptools` | Building native extensions |
**Composite Extras** combine feature extras for common CLI scripts:
| Extra | Includes | Typical use case |
| ------------- | ------------------------------ | ------------------------------------------------------- |
| `robot` | `dataset` + `hardware` + `viz` | `lerobot-record`, `lerobot-replay`, `lerobot-calibrate` |
| `evaluation` | `av` | `lerobot-eval` (add policy + env extras as needed) |
| `dataset_viz` | `dataset` + `viz` | `lerobot-dataset-viz`, `lerobot-imgtransform-viz` |
```bash ```bash
pip install 'lerobot[all]' # All available features pip install 'lerobot[robot]' # Record, replay, calibrate
pip install 'lerobot[aloha,pusht]' # Specific features (Aloha & Pusht) pip install 'lerobot[training]' # Train policies
pip install 'lerobot[feetech]' # Feetech motor support pip install 'lerobot[robot,training]' # Record + train
pip install 'lerobot[all]' # Everything
``` ```
_Replace `[...]` with your desired features._ **Policy, environment, and hardware extras** are still available for specific dependencies:
**Available Tags:** ```bash
For a full list of optional dependencies, see: pip install 'lerobot[pi]' # Pi0/Pi0.5/Pi0-FAST policy deps
https://pypi.org/project/lerobot/ pip install 'lerobot[smolvla]' # SmolVLA policy deps
pip install 'lerobot[diffusion]' # Diffusion policy deps (diffusers)
pip install 'lerobot[aloha,pusht]' # Simulation environments
pip install 'lerobot[feetech]' # Feetech motor support
```
_Multiple extras can be combined (e.g., `.[robot,pi,pusht]`). For a full list of available extras, refer to `pyproject.toml`._
### Troubleshooting ### Troubleshooting
If you encounter build errors, you may need to install additional dependencies: `cmake`, `build-essential`, and `ffmpeg libs`. If you encounter build errors, you may need to install additional system dependencies: `cmake`, `build-essential`, and `ffmpeg libs`.
To install these for Linux run: To install these for Linux run:
```bash ```bash
@@ -196,8 +225,8 @@ LeRobot provides optional extras for specific functionalities. Multiple extras c
### Simulations ### Simulations
Install environment packages: `aloha` ([gym-aloha](https://github.com/huggingface/gym-aloha)), or `pusht` ([gym-pusht](https://github.com/huggingface/gym-pusht)) Install environment packages: `aloha` ([gym-aloha](https://github.com/huggingface/gym-aloha)), or `pusht` ([gym-pusht](https://github.com/huggingface/gym-pusht)).
Example: These automatically include the `dataset` extra.
```bash ```bash
pip install -e ".[aloha]" # or "[pusht]" for example pip install -e ".[aloha]" # or "[pusht]" for example
@@ -213,7 +242,7 @@ pip install -e ".[feetech]" # or "[dynamixel]" for example
### Experiment Tracking ### Experiment Tracking
To use [Weights and Biases](https://docs.wandb.ai/quickstart) for experiment tracking, log in with Weights and Biases is included in the `training` extra. To use [Weights and Biases](https://docs.wandb.ai/quickstart) for experiment tracking, log in with:
```bash ```bash
wandb login wandb login
+4 -4
View File
@@ -19,10 +19,10 @@ This means that your favorite policy can be used like this:
```python ```python
import torch import torch
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset
from lerobot.policies.factory import make_pre_post_processors from lerobot.policies import make_pre_post_processors
from lerobot.policies.your_policy import YourPolicy from lerobot.policies.your_policy import YourPolicy
from lerobot.processor.pipeline import RobotProcessorPipeline, PolicyProcessorPipeline from lerobot.processor import RobotProcessorPipeline, PolicyProcessorPipeline
dataset = LeRobotDataset("hf_user/dataset", episodes=[0]) dataset = LeRobotDataset("hf_user/dataset", episodes=[0])
sample = dataset[10] sample = dataset[10]
@@ -260,7 +260,7 @@ Since processor pipelines can add new features (like velocity fields), change te
These functions work together by starting with robot hardware specifications (`create_initial_features()`) then simulating the entire pipeline transformation (`aggregate_pipeline_dataset_features()`) to compute the final feature dictionary that gets passed to `LeRobotDataset.create()`, ensuring perfect alignment between what processors output and what datasets expect to store. These functions work together by starting with robot hardware specifications (`create_initial_features()`) then simulating the entire pipeline transformation (`aggregate_pipeline_dataset_features()`) to compute the final feature dictionary that gets passed to `LeRobotDataset.create()`, ensuring perfect alignment between what processors output and what datasets expect to store.
```python ```python
from lerobot.datasets.pipeline_features import aggregate_pipeline_dataset_features from lerobot.datasets import aggregate_pipeline_dataset_features
# Start with robot's raw features # Start with robot's raw features
initial_features = create_initial_features( initial_features = create_initial_features(
+4 -4
View File
@@ -89,7 +89,7 @@ A core v3 principle is **decoupling storage from the user API**: data is stored
```python ```python
import torch import torch
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset
repo_id = "yaak-ai/L2D-v3" repo_id = "yaak-ai/L2D-v3"
@@ -135,7 +135,7 @@ for batch in data_loader:
Use `StreamingLeRobotDataset` to iterate directly from the Hub without local copies. This allows to stream large datasets without the need to downloading them onto disk or loading them onto memory, and is a key feature of the new dataset format. Use `StreamingLeRobotDataset` to iterate directly from the Hub without local copies. This allows to stream large datasets without the need to downloading them onto disk or loading them onto memory, and is a key feature of the new dataset format.
```python ```python
from lerobot.datasets.streaming_dataset import StreamingLeRobotDataset from lerobot.datasets import StreamingLeRobotDataset
repo_id = "yaak-ai/L2D-v3" repo_id = "yaak-ai/L2D-v3"
dataset = StreamingLeRobotDataset(repo_id) # streams directly from the Hub dataset = StreamingLeRobotDataset(repo_id) # streams directly from the Hub
@@ -167,7 +167,7 @@ Currently, transforms are applied during **training time only**, not during reco
Use the `image_transforms` parameter when loading a dataset for training: Use the `image_transforms` parameter when loading a dataset for training:
```python ```python
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset
from lerobot.transforms import ImageTransforms, ImageTransformsConfig, ImageTransformConfig from lerobot.transforms import ImageTransforms, ImageTransformsConfig, ImageTransformConfig
# Option 1: Use default transform configuration (disabled by default) # Option 1: Use default transform configuration (disabled by default)
@@ -290,7 +290,7 @@ python -m lerobot.datasets.v30.convert_dataset_v21_to_v30 --repo-id=<HF_USER/DAT
When creating or recording datasets, you **must** call `dataset.finalize()` to properly close parquet writers. See the [PR #1903](https://github.com/huggingface/lerobot/pull/1903) for more details. When creating or recording datasets, you **must** call `dataset.finalize()` to properly close parquet writers. See the [PR #1903](https://github.com/huggingface/lerobot/pull/1903) for more details.
```python ```python
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset
# Create dataset and record episodes # Create dataset and record episodes
dataset = LeRobotDataset.create(...) dataset = LeRobotDataset.create(...)
+2 -2
View File
@@ -4,10 +4,10 @@ This guide shows you how to train policies on multiple GPUs using [Hugging Face
## Installation ## Installation
First, ensure you have accelerate installed: `accelerate` is included in the `training` extra. Install it with:
```bash ```bash
pip install accelerate pip install 'lerobot[training]'
``` ```
## Training with Multiple GPUs ## Training with Multiple GPUs
+2 -1
View File
@@ -45,7 +45,8 @@ Modify the examples to use `PhoneOS.IOS` or `PhoneOS.ANDROID` in `PhoneConfig`.
Teleoperation example: Teleoperation example:
```python ```python
from lerobot.teleoperators.phone.config_phone import PhoneConfig, PhoneOS from lerobot.teleoperators.phone import Phone, PhoneConfig
from lerobot.teleoperators.phone.config_phone import PhoneOS
teleop_config = PhoneConfig(phone_os=PhoneOS.IOS) # or PhoneOS.ANDROID teleop_config = PhoneConfig(phone_os=PhoneOS.IOS) # or PhoneOS.ANDROID
teleop_device = Phone(teleop_config) teleop_device = Phone(teleop_config)
+1 -2
View File
@@ -110,8 +110,7 @@ lerobot-edit-dataset \
Or equivalently in Python: Or equivalently in Python:
```python ```python
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset, recompute_stats
from lerobot.datasets.dataset_tools import recompute_stats
dataset = LeRobotDataset("your_dataset") dataset = LeRobotDataset("your_dataset")
recompute_stats(dataset, relative_action=True, chunk_size=50, relative_exclude_joints=["gripper"]) recompute_stats(dataset, relative_action=True, chunk_size=50, relative_exclude_joints=["gripper"])
+1 -2
View File
@@ -116,8 +116,7 @@ lerobot-edit-dataset \
Or equivalently in Python: Or equivalently in Python:
```python ```python
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset, recompute_stats
from lerobot.datasets.dataset_tools import recompute_stats
dataset = LeRobotDataset("your_dataset") dataset = LeRobotDataset("your_dataset")
recompute_stats(dataset, relative_action=True, chunk_size=50, relative_exclude_joints=["gripper"]) recompute_stats(dataset, relative_action=True, chunk_size=50, relative_exclude_joints=["gripper"])
+2 -3
View File
@@ -60,11 +60,10 @@ When `use_relative_actions=true`, the training script automatically:
### Recomputing stats for an existing dataset ### Recomputing stats for an existing dataset
If you want to precompute relative action stats offline, use `recompute_stats` from If you want to precompute relative action stats offline, use `recompute_stats` from
`lerobot.datasets.dataset_tools`: `lerobot.datasets`:
```python ```python
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset, recompute_stats
from lerobot.datasets.dataset_tools import recompute_stats
dataset = LeRobotDataset("your_org/your_dataset") dataset = LeRobotDataset("your_org/your_dataset")
dataset = recompute_stats( dataset = recompute_stats(
+2 -3
View File
@@ -39,9 +39,8 @@ The snippet below provides a simplified pseudo-example of how RTC operates with
```python ```python
from lerobot.policies.pi0 import PI0Policy, PI0Config from lerobot.policies.pi0 import PI0Policy, PI0Config
from lerobot.configs.types import RTCAttentionSchedule from lerobot.configs import RTCAttentionSchedule
from lerobot.policies.rtc.configuration_rtc import RTCConfig from lerobot.policies.rtc import RTCConfig, ActionQueue
from lerobot.policies.rtc.action_queue import ActionQueue
# Load Pi0 with RTC enabled # Load Pi0 with RTC enabled
policy_cfg = PI0Config() policy_cfg = PI0Config()
+1 -1
View File
@@ -418,7 +418,7 @@ Create a custom preprocessing pipeline for your environment:
```python ```python
from lerobot.processor import PolicyProcessorPipeline from lerobot.processor import PolicyProcessorPipeline
from lerobot.policies.xvla.processor_xvla import ( from lerobot.policies.xvla import (
XVLAImageToFloatProcessorStep, XVLAImageToFloatProcessorStep,
XVLAImageNetNormalizeProcessorStep, XVLAImageNetNormalizeProcessorStep,
XVLAAddDomainIdProcessorStep, XVLAAddDomainIdProcessorStep,
+1 -1
View File
@@ -35,7 +35,7 @@ from pprint import pformat
import draccus import draccus
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset
from lerobot.robots import ( # noqa: F401 from lerobot.robots import ( # noqa: F401
Robot, Robot,
RobotConfig, RobotConfig,
+1 -2
View File
@@ -31,8 +31,7 @@ from pprint import pprint
import torch import torch
from huggingface_hub import HfApi from huggingface_hub import HfApi
from lerobot.datasets.dataset_metadata import LeRobotDatasetMetadata from lerobot.datasets import LeRobotDataset, LeRobotDatasetMetadata
from lerobot.datasets.lerobot_dataset import LeRobotDataset
def main(): def main():
+1 -1
View File
@@ -231,7 +231,7 @@ class AggregateProgress(PipelineStep):
import pyarrow as pa import pyarrow as pa
import pyarrow.parquet as pq import pyarrow.parquet as pq
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset
from lerobot.utils.utils import init_logging from lerobot.utils.utils import init_logging
init_logging() init_logging()
@@ -26,7 +26,7 @@ import torch
from torchvision.transforms import v2 from torchvision.transforms import v2
from torchvision.transforms.functional import to_pil_image from torchvision.transforms.functional import to_pil_image
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset
from lerobot.transforms import ImageTransformConfig, ImageTransforms, ImageTransformsConfig from lerobot.transforms import ImageTransformConfig, ImageTransforms, ImageTransformsConfig
+3 -4
View File
@@ -29,15 +29,14 @@ Usage:
import numpy as np import numpy as np
from lerobot.datasets.dataset_tools import ( from lerobot.datasets import (
add_features, LeRobotDataset,
delete_episodes, delete_episodes,
merge_datasets, merge_datasets,
modify_features,
remove_feature, remove_feature,
split_dataset, split_dataset,
) )
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets.dataset_tools import add_features, modify_features
def main(): def main():
+18 -17
View File
@@ -112,17 +112,18 @@ from hil_utils import (
teleop_smooth_move_to, teleop_smooth_move_to,
) )
from lerobot.cameras.opencv.configuration_opencv import OpenCVCameraConfig # noqa: F401 from lerobot.cameras.opencv import OpenCVCameraConfig # noqa: F401
from lerobot.cameras.realsense.configuration_realsense import RealSenseCameraConfig # noqa: F401 from lerobot.cameras.realsense import RealSenseCameraConfig # noqa: F401
from lerobot.common.control_utils import is_headless, predict_action from lerobot.common.control_utils import is_headless, predict_action
from lerobot.configs import parser from lerobot.configs import PreTrainedConfig, parser
from lerobot.configs.policies import PreTrainedConfig from lerobot.datasets import (
from lerobot.datasets.image_writer import safe_stop_image_writer LeRobotDataset,
from lerobot.datasets.lerobot_dataset import LeRobotDataset VideoEncodingManager,
from lerobot.datasets.pipeline_features import aggregate_pipeline_dataset_features, create_initial_features aggregate_pipeline_dataset_features,
from lerobot.datasets.video_utils import VideoEncodingManager create_initial_features,
from lerobot.policies.factory import get_policy_class, make_policy, make_pre_post_processors safe_stop_image_writer,
from lerobot.policies.pretrained import PreTrainedPolicy )
from lerobot.policies import PreTrainedPolicy, get_policy_class, make_policy, make_pre_post_processors
from lerobot.policies.rtc import ActionInterpolator, ActionQueue, LatencyTracker, RTCConfig from lerobot.policies.rtc import ActionInterpolator, ActionQueue, LatencyTracker, RTCConfig
from lerobot.policies.utils import make_robot_action from lerobot.policies.utils import make_robot_action
from lerobot.processor import ( from lerobot.processor import (
@@ -131,17 +132,17 @@ from lerobot.processor import (
RelativeActionsProcessorStep, RelativeActionsProcessorStep,
TransitionKey, TransitionKey,
create_transition, create_transition,
rename_stats,
to_relative_actions,
) )
from lerobot.processor.relative_action_processor import to_relative_actions
from lerobot.processor.rename_processor import rename_stats
from lerobot.robots import Robot, RobotConfig, make_robot_from_config from lerobot.robots import Robot, RobotConfig, make_robot_from_config
from lerobot.robots.bi_openarm_follower.config_bi_openarm_follower import BiOpenArmFollowerConfig from lerobot.robots.bi_openarm_follower import BiOpenArmFollowerConfig
from lerobot.robots.so_follower.config_so_follower import SOFollowerRobotConfig # noqa: F401 from lerobot.robots.so_follower import SOFollowerRobotConfig # noqa: F401
from lerobot.teleoperators import Teleoperator, TeleoperatorConfig, make_teleoperator_from_config from lerobot.teleoperators import Teleoperator, TeleoperatorConfig, make_teleoperator_from_config
from lerobot.teleoperators.openarm_mini.config_openarm_mini import OpenArmMiniConfig # noqa: F401 from lerobot.teleoperators.openarm_mini import OpenArmMiniConfig # noqa: F401
from lerobot.teleoperators.so_leader.config_so_leader import SOLeaderTeleopConfig # noqa: F401 from lerobot.teleoperators.so_leader import SOLeaderTeleopConfig # noqa: F401
from lerobot.utils import get_safe_torch_device
from lerobot.utils.constants import ACTION, OBS_STATE, OBS_STR from lerobot.utils.constants import ACTION, OBS_STATE, OBS_STR
from lerobot.utils.device_utils import get_safe_torch_device
from lerobot.utils.feature_utils import build_dataset_frame, combine_feature_dicts, hw_to_dataset_features from lerobot.utils.feature_utils import build_dataset_frame, combine_feature_dicts, hw_to_dataset_features
from lerobot.utils.robot_utils import precise_sleep from lerobot.utils.robot_utils import precise_sleep
from lerobot.utils.utils import init_logging, log_say from lerobot.utils.utils import init_logging, log_say
+3 -3
View File
@@ -15,9 +15,9 @@
# limitations under the License. # limitations under the License.
from lerobot.common.control_utils import init_keyboard_listener from lerobot.common.control_utils import init_keyboard_listener
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset
from lerobot.policies.act.modeling_act import ACTPolicy from lerobot.policies import make_pre_post_processors
from lerobot.policies.factory import make_pre_post_processors from lerobot.policies.act import ACTPolicy
from lerobot.processor import make_default_processors from lerobot.processor import make_default_processors
from lerobot.robots.lekiwi import LeKiwiClient, LeKiwiClientConfig from lerobot.robots.lekiwi import LeKiwiClient, LeKiwiClientConfig
from lerobot.scripts.lerobot_record import record_loop from lerobot.scripts.lerobot_record import record_loop
+2 -3
View File
@@ -15,10 +15,9 @@
# limitations under the License. # limitations under the License.
from lerobot.common.control_utils import init_keyboard_listener from lerobot.common.control_utils import init_keyboard_listener
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset
from lerobot.processor import make_default_processors from lerobot.processor import make_default_processors
from lerobot.robots.lekiwi.config_lekiwi import LeKiwiClientConfig from lerobot.robots.lekiwi import LeKiwiClient, LeKiwiClientConfig
from lerobot.robots.lekiwi.lekiwi_client import LeKiwiClient
from lerobot.scripts.lerobot_record import record_loop from lerobot.scripts.lerobot_record import record_loop
from lerobot.teleoperators.keyboard import KeyboardTeleop, KeyboardTeleopConfig from lerobot.teleoperators.keyboard import KeyboardTeleop, KeyboardTeleopConfig
from lerobot.teleoperators.so_leader import SO100Leader, SO100LeaderConfig from lerobot.teleoperators.so_leader import SO100Leader, SO100LeaderConfig
+2 -3
View File
@@ -16,9 +16,8 @@
import time import time
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset
from lerobot.robots.lekiwi.config_lekiwi import LeKiwiClientConfig from lerobot.robots.lekiwi import LeKiwiClient, LeKiwiClientConfig
from lerobot.robots.lekiwi.lekiwi_client import LeKiwiClient
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
+5 -6
View File
@@ -14,14 +14,13 @@
# 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.cameras.opencv.configuration_opencv import OpenCVCameraConfig from lerobot.cameras.opencv import OpenCVCameraConfig
from lerobot.common.control_utils import init_keyboard_listener from lerobot.common.control_utils import init_keyboard_listener
from lerobot.configs.types import FeatureType, PolicyFeature from lerobot.configs import FeatureType, PolicyFeature
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset, aggregate_pipeline_dataset_features, create_initial_features
from lerobot.datasets.pipeline_features import aggregate_pipeline_dataset_features, create_initial_features
from lerobot.model.kinematics import RobotKinematics from lerobot.model.kinematics import RobotKinematics
from lerobot.policies.act.modeling_act import ACTPolicy from lerobot.policies import make_pre_post_processors
from lerobot.policies.factory import make_pre_post_processors from lerobot.policies.act import ACTPolicy
from lerobot.processor import ( from lerobot.processor import (
RobotProcessorPipeline, RobotProcessorPipeline,
make_default_teleop_action_processor, make_default_teleop_action_processor,
+4 -5
View File
@@ -14,10 +14,9 @@
# 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.cameras.opencv.configuration_opencv import OpenCVCameraConfig from lerobot.cameras.opencv import OpenCVCameraConfig
from lerobot.common.control_utils import init_keyboard_listener from lerobot.common.control_utils import init_keyboard_listener
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset, aggregate_pipeline_dataset_features, create_initial_features
from lerobot.datasets.pipeline_features import aggregate_pipeline_dataset_features, create_initial_features
from lerobot.model.kinematics import RobotKinematics from lerobot.model.kinematics import RobotKinematics
from lerobot.processor import RobotProcessorPipeline from lerobot.processor import RobotProcessorPipeline
from lerobot.processor.converters import ( from lerobot.processor.converters import (
@@ -35,9 +34,9 @@ from lerobot.robots.so_follower.robot_kinematic_processor import (
InverseKinematicsEEToJoints, InverseKinematicsEEToJoints,
) )
from lerobot.scripts.lerobot_record import record_loop from lerobot.scripts.lerobot_record import record_loop
from lerobot.teleoperators.phone.config_phone import PhoneConfig, PhoneOS from lerobot.teleoperators.phone import Phone, PhoneConfig
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.teleoperators.phone.teleop_phone import Phone
from lerobot.types import RobotAction, RobotObservation 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.utils import log_say from lerobot.utils.utils import log_say
+1 -1
View File
@@ -16,7 +16,7 @@
import time import time
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset
from lerobot.model.kinematics import RobotKinematics from lerobot.model.kinematics import RobotKinematics
from lerobot.processor import RobotProcessorPipeline from lerobot.processor import RobotProcessorPipeline
from lerobot.processor.converters import ( from lerobot.processor.converters import (
+2 -2
View File
@@ -28,9 +28,9 @@ from lerobot.robots.so_follower.robot_kinematic_processor import (
GripperVelocityToJoint, GripperVelocityToJoint,
InverseKinematicsEEToJoints, InverseKinematicsEEToJoints,
) )
from lerobot.teleoperators.phone.config_phone import PhoneConfig, PhoneOS from lerobot.teleoperators.phone import Phone, PhoneConfig
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.teleoperators.phone.teleop_phone import Phone
from lerobot.types import RobotAction, RobotObservation 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 -2
View File
@@ -22,8 +22,7 @@ from pathlib import Path
import numpy as np import numpy as np
import tensorflow_datasets as tfds import tensorflow_datasets as tfds
from lerobot.datasets.dataset_metadata import LeRobotDatasetMetadata from lerobot.datasets import LeRobotDataset, LeRobotDatasetMetadata
from lerobot.datasets.lerobot_dataset import LeRobotDataset
from lerobot.utils.utils import get_elapsed_time_in_days_hours_minutes_seconds from lerobot.utils.utils import get_elapsed_time_in_days_hours_minutes_seconds
DROID_SHARDS = 2048 DROID_SHARDS = 2048
+2 -2
View File
@@ -26,7 +26,7 @@ from huggingface_hub import HfApi
from huggingface_hub.constants import REPOCARD_NAME from huggingface_hub.constants import REPOCARD_NAME
from port_droid import DROID_SHARDS from port_droid import DROID_SHARDS
from lerobot.datasets.dataset_metadata import CODEBASE_VERSION, LeRobotDatasetMetadata from lerobot.datasets import CODEBASE_VERSION, LeRobotDatasetMetadata
from lerobot.datasets.utils import create_lerobot_dataset_card from lerobot.datasets.utils import create_lerobot_dataset_card
from lerobot.utils.utils import init_logging from lerobot.utils.utils import init_logging
@@ -155,7 +155,7 @@ class UploadDataset(PipelineStep):
from datasets.utils.tqdm import disable_progress_bars from datasets.utils.tqdm import disable_progress_bars
from huggingface_hub import CommitOperationAdd, preupload_lfs_files from huggingface_hub import CommitOperationAdd, preupload_lfs_files
from lerobot.datasets.dataset_metadata import LeRobotDatasetMetadata from lerobot.datasets import LeRobotDatasetMetadata
from lerobot.utils.utils import init_logging from lerobot.utils.utils import init_logging
init_logging() init_logging()
+4 -8
View File
@@ -109,15 +109,11 @@ except ImportError:
MATPLOTLIB_AVAILABLE = False MATPLOTLIB_AVAILABLE = False
plt = None plt = None
from lerobot.configs import parser from lerobot.configs import DatasetConfig, PreTrainedConfig, RTCAttentionSchedule, parser
from lerobot.configs.default import DatasetConfig from lerobot.datasets import LeRobotDataset, LeRobotDatasetMetadata
from lerobot.configs.policies import PreTrainedConfig
from lerobot.configs.types import RTCAttentionSchedule
from lerobot.datasets.dataset_metadata import LeRobotDatasetMetadata
from lerobot.datasets.factory import resolve_delta_timestamps from lerobot.datasets.factory import resolve_delta_timestamps
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.policies import get_policy_class, make_pre_post_processors
from lerobot.policies.factory import get_policy_class, make_pre_post_processors from lerobot.policies.rtc import RTCConfig
from lerobot.policies.rtc.configuration_rtc import RTCConfig
from lerobot.policies.rtc.debug_visualizer import RTCDebugVisualizer from lerobot.policies.rtc.debug_visualizer import RTCDebugVisualizer
from lerobot.utils.hub import HubMixin from lerobot.utils.hub import HubMixin
from lerobot.utils.utils import init_logging from lerobot.utils.utils import init_logging
+5 -7
View File
@@ -101,25 +101,23 @@ from threading import Event, Lock, Thread
import torch import torch
from torch import Tensor from torch import Tensor
from lerobot.cameras.opencv.configuration_opencv import OpenCVCameraConfig # noqa: F401 from lerobot.cameras.opencv import OpenCVCameraConfig # noqa: F401
from lerobot.cameras.realsense.configuration_realsense import RealSenseCameraConfig # noqa: F401 from lerobot.cameras.realsense import RealSenseCameraConfig # noqa: F401
from lerobot.cameras.zmq.configuration_zmq import ZMQCameraConfig # noqa: F401 from lerobot.cameras.zmq.configuration_zmq import ZMQCameraConfig # noqa: F401
from lerobot.configs import parser from lerobot.configs import PreTrainedConfig, RTCAttentionSchedule, parser
from lerobot.configs.policies import PreTrainedConfig from lerobot.policies import get_policy_class, make_pre_post_processors
from lerobot.configs.types import RTCAttentionSchedule
from lerobot.policies.factory import get_policy_class, make_pre_post_processors
from lerobot.policies.rtc import ActionInterpolator, ActionQueue, LatencyTracker, RTCConfig from lerobot.policies.rtc import ActionInterpolator, ActionQueue, LatencyTracker, RTCConfig
from lerobot.processor import ( from lerobot.processor import (
NormalizerProcessorStep, NormalizerProcessorStep,
RelativeActionsProcessorStep, RelativeActionsProcessorStep,
TransitionKey, TransitionKey,
create_transition, create_transition,
to_relative_actions,
) )
from lerobot.processor.factory import ( from lerobot.processor.factory import (
make_default_robot_action_processor, make_default_robot_action_processor,
make_default_robot_observation_processor, make_default_robot_observation_processor,
) )
from lerobot.processor.relative_action_processor import to_relative_actions
from lerobot.rl.process import ProcessSignalHandler from lerobot.rl.process import ProcessSignalHandler
from lerobot.robots import ( # noqa: F401 from lerobot.robots import ( # noqa: F401
Robot, Robot,
+5 -6
View File
@@ -14,14 +14,13 @@
# 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.cameras.opencv.configuration_opencv import OpenCVCameraConfig from lerobot.cameras.opencv import OpenCVCameraConfig
from lerobot.common.control_utils import init_keyboard_listener from lerobot.common.control_utils import init_keyboard_listener
from lerobot.configs.types import FeatureType, PolicyFeature from lerobot.configs import FeatureType, PolicyFeature
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset, aggregate_pipeline_dataset_features, create_initial_features
from lerobot.datasets.pipeline_features import aggregate_pipeline_dataset_features, create_initial_features
from lerobot.model.kinematics import RobotKinematics from lerobot.model.kinematics import RobotKinematics
from lerobot.policies.act.modeling_act import ACTPolicy from lerobot.policies import make_pre_post_processors
from lerobot.policies.factory import make_pre_post_processors from lerobot.policies.act import ACTPolicy
from lerobot.processor import ( from lerobot.processor import (
RobotProcessorPipeline, RobotProcessorPipeline,
make_default_teleop_action_processor, make_default_teleop_action_processor,
+2 -3
View File
@@ -15,10 +15,9 @@
# limitations under the License. # limitations under the License.
from lerobot.cameras.opencv.configuration_opencv import OpenCVCameraConfig from lerobot.cameras.opencv import OpenCVCameraConfig
from lerobot.common.control_utils import init_keyboard_listener from lerobot.common.control_utils import init_keyboard_listener
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset, aggregate_pipeline_dataset_features, create_initial_features
from lerobot.datasets.pipeline_features import aggregate_pipeline_dataset_features, create_initial_features
from lerobot.model.kinematics import RobotKinematics from lerobot.model.kinematics import RobotKinematics
from lerobot.processor import RobotProcessorPipeline from lerobot.processor import RobotProcessorPipeline
from lerobot.processor.converters import ( from lerobot.processor.converters import (
+1 -1
View File
@@ -17,7 +17,7 @@
import time import time
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset
from lerobot.model.kinematics import RobotKinematics from lerobot.model.kinematics import RobotKinematics
from lerobot.processor import RobotProcessorPipeline from lerobot.processor import RobotProcessorPipeline
from lerobot.processor.converters import ( from lerobot.processor.converters import (
+4 -6
View File
@@ -18,12 +18,10 @@ from pathlib import Path
import torch import torch
from lerobot.configs.types import FeatureType from lerobot.configs import FeatureType
from lerobot.datasets.dataset_metadata import LeRobotDatasetMetadata from lerobot.datasets import LeRobotDataset, LeRobotDatasetMetadata
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.policies import make_pre_post_processors
from lerobot.policies.diffusion.configuration_diffusion import DiffusionConfig from lerobot.policies.diffusion import DiffusionConfig, DiffusionPolicy
from lerobot.policies.diffusion.modeling_diffusion import DiffusionPolicy
from lerobot.policies.factory import make_pre_post_processors
from lerobot.utils.feature_utils import dataset_to_policy_features from lerobot.utils.feature_utils import dataset_to_policy_features
+4 -6
View File
@@ -19,12 +19,10 @@ from pathlib import Path
import torch import torch
from lerobot.configs.types import FeatureType from lerobot.configs import FeatureType
from lerobot.datasets.dataset_metadata import LeRobotDatasetMetadata from lerobot.datasets import LeRobotDatasetMetadata, StreamingLeRobotDataset
from lerobot.datasets.streaming_dataset import StreamingLeRobotDataset from lerobot.policies import make_pre_post_processors
from lerobot.policies.act.configuration_act import ACTConfig from lerobot.policies.act import ACTConfig, ACTPolicy
from lerobot.policies.act.modeling_act import ACTPolicy
from lerobot.policies.factory import make_pre_post_processors
from lerobot.utils.constants import ACTION from lerobot.utils.constants import ACTION
from lerobot.utils.feature_utils import dataset_to_policy_features from lerobot.utils.feature_utils import dataset_to_policy_features
@@ -4,12 +4,10 @@ from pathlib import Path
import torch import torch
from lerobot.configs.types import FeatureType from lerobot.configs import FeatureType
from lerobot.datasets.dataset_metadata import LeRobotDatasetMetadata from lerobot.datasets import LeRobotDataset, LeRobotDatasetMetadata
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.policies import make_pre_post_processors
from lerobot.policies.act.configuration_act import ACTConfig from lerobot.policies.act import ACTConfig, ACTPolicy
from lerobot.policies.act.modeling_act import ACTPolicy
from lerobot.policies.factory import make_pre_post_processors
from lerobot.utils.feature_utils import dataset_to_policy_features from lerobot.utils.feature_utils import dataset_to_policy_features
+4 -4
View File
@@ -1,9 +1,9 @@
import torch import torch
from lerobot.cameras.opencv.configuration_opencv import OpenCVCameraConfig from lerobot.cameras.opencv import OpenCVCameraConfig
from lerobot.datasets.dataset_metadata import LeRobotDatasetMetadata from lerobot.datasets import LeRobotDatasetMetadata
from lerobot.policies.act.modeling_act import ACTPolicy from lerobot.policies import make_pre_post_processors
from lerobot.policies.factory import make_pre_post_processors from lerobot.policies.act import ACTPolicy
from lerobot.policies.utils import build_inference_frame, make_robot_action from lerobot.policies.utils import build_inference_frame, make_robot_action
from lerobot.robots.so_follower import SO100Follower, SO100FollowerConfig from lerobot.robots.so_follower import SO100Follower, SO100FollowerConfig
+1 -1
View File
@@ -3,7 +3,7 @@ import threading
from lerobot.async_inference.configs import RobotClientConfig from lerobot.async_inference.configs import RobotClientConfig
from lerobot.async_inference.helpers import visualize_action_queue_size from lerobot.async_inference.helpers import visualize_action_queue_size
from lerobot.async_inference.robot_client import RobotClient from lerobot.async_inference.robot_client import RobotClient
from lerobot.cameras.opencv.configuration_opencv import OpenCVCameraConfig from lerobot.cameras.opencv import OpenCVCameraConfig
from lerobot.robots.so_follower import SO100FollowerConfig from lerobot.robots.so_follower import SO100FollowerConfig
@@ -4,12 +4,10 @@ from pathlib import Path
import torch import torch
from lerobot.configs.types import FeatureType from lerobot.configs import FeatureType
from lerobot.datasets.dataset_metadata import LeRobotDatasetMetadata from lerobot.datasets import LeRobotDataset, LeRobotDatasetMetadata
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.policies import make_pre_post_processors
from lerobot.policies.diffusion.configuration_diffusion import DiffusionConfig from lerobot.policies.diffusion import DiffusionConfig, DiffusionPolicy
from lerobot.policies.diffusion.modeling_diffusion import DiffusionPolicy
from lerobot.policies.factory import make_pre_post_processors
from lerobot.utils.feature_utils import dataset_to_policy_features from lerobot.utils.feature_utils import dataset_to_policy_features
@@ -1,9 +1,9 @@
import torch import torch
from lerobot.cameras.opencv.configuration_opencv import OpenCVCameraConfig from lerobot.cameras.opencv import OpenCVCameraConfig
from lerobot.datasets.dataset_metadata import LeRobotDatasetMetadata from lerobot.datasets import LeRobotDatasetMetadata
from lerobot.policies.diffusion.modeling_diffusion import DiffusionPolicy from lerobot.policies import make_pre_post_processors
from lerobot.policies.factory import make_pre_post_processors from lerobot.policies.diffusion import DiffusionPolicy
from lerobot.policies.utils import build_inference_frame, make_robot_action from lerobot.policies.utils import build_inference_frame, make_robot_action
from lerobot.robots.so_follower import SO100Follower, SO100FollowerConfig from lerobot.robots.so_follower import SO100Follower, SO100FollowerConfig
+3 -3
View File
@@ -1,8 +1,8 @@
import torch import torch
from lerobot.cameras.opencv.configuration_opencv import OpenCVCameraConfig from lerobot.cameras.opencv import OpenCVCameraConfig
from lerobot.policies.factory import make_pre_post_processors from lerobot.policies import make_pre_post_processors
from lerobot.policies.pi0.modeling_pi0 import PI0Policy from lerobot.policies.pi0 import PI0Policy
from lerobot.policies.utils import build_inference_frame, make_robot_action from lerobot.policies.utils import build_inference_frame, make_robot_action
from lerobot.robots.so_follower import SO100Follower, SO100FollowerConfig from lerobot.robots.so_follower import SO100Follower, SO100FollowerConfig
from lerobot.utils.feature_utils import hw_to_dataset_features from lerobot.utils.feature_utils import hw_to_dataset_features
+3 -3
View File
@@ -6,16 +6,16 @@ from queue import Empty, Full
import torch import torch
import torch.optim as optim import torch.optim as optim
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset
from lerobot.envs.configs import HILSerlProcessorConfig, HILSerlRobotEnvConfig from lerobot.envs.configs import HILSerlProcessorConfig, HILSerlRobotEnvConfig
from lerobot.policies.sac.configuration_sac import SACConfig from lerobot.policies import SACConfig
from lerobot.policies.sac.modeling_sac import SACPolicy from lerobot.policies.sac.modeling_sac import SACPolicy
from lerobot.policies.sac.reward_model.modeling_classifier import Classifier from lerobot.policies.sac.reward_model.modeling_classifier import Classifier
from lerobot.rl.buffer import ReplayBuffer from lerobot.rl.buffer import ReplayBuffer
from lerobot.rl.gym_manipulator import make_robot_env from lerobot.rl.gym_manipulator import make_robot_env
from lerobot.robots.so_follower import SO100FollowerConfig from lerobot.robots.so_follower import SO100FollowerConfig
from lerobot.teleoperators import TeleopEvents
from lerobot.teleoperators.so_leader import SO100LeaderConfig from lerobot.teleoperators.so_leader import SO100LeaderConfig
from lerobot.teleoperators.utils import TeleopEvents
from lerobot.utils.feature_utils import hw_to_dataset_features from lerobot.utils.feature_utils import hw_to_dataset_features
LOG_EVERY = 10 LOG_EVERY = 10
@@ -1,8 +1,7 @@
import torch import torch
from lerobot.datasets.lerobot_dataset import LeRobotDataset from lerobot.datasets import LeRobotDataset
from lerobot.policies.factory import make_policy, make_pre_post_processors from lerobot.policies import RewardClassifierConfig, make_policy, make_pre_post_processors
from lerobot.policies.sac.reward_model.configuration_classifier import RewardClassifierConfig
def main(): def main():
@@ -1,8 +1,8 @@
import torch import torch
from lerobot.cameras.opencv.configuration_opencv import OpenCVCameraConfig from lerobot.cameras.opencv import OpenCVCameraConfig
from lerobot.policies.factory import make_pre_post_processors from lerobot.policies import make_pre_post_processors
from lerobot.policies.smolvla.modeling_smolvla import SmolVLAPolicy from lerobot.policies.smolvla import SmolVLAPolicy
from lerobot.policies.utils import build_inference_frame, make_robot_action from lerobot.policies.utils import build_inference_frame, make_robot_action
from lerobot.robots.so_follower import SO100Follower, SO100FollowerConfig from lerobot.robots.so_follower import SO100Follower, SO100FollowerConfig
from lerobot.utils.feature_utils import hw_to_dataset_features from lerobot.utils.feature_utils import hw_to_dataset_features