Skip to main content

Overview

Processors in LeRobot are modular data transformation pipelines that convert between different data representations. They handle:
  • Normalization: Scaling observations and actions to standard ranges
  • Device management: Moving data between CPU and GPU
  • Format conversion: Converting between robot, policy, and environment formats
  • Delta actions: Computing relative vs. absolute actions
  • Observation processing: Renaming, cropping, and transforming sensor data
Processors enable you to train policies on normalized data while deploying them on real robots with different units and ranges.

Core Concepts

Data Types

LeRobot defines several data types for different stages:
Source: src/lerobot/processor/core.py:39

EnvTransition

The standard format for data flowing through processors:
Source: src/lerobot/processor/core.py:45

ProcessorStep

The building block of processing pipelines:
Source: src/lerobot/processor/pipeline.py:143

ProcessorStep Registry

Steps are registered for serialization and sharing:
Source: src/lerobot/processor/pipeline.py:59

DataProcessorPipeline

Chain multiple steps together:
Source: src/lerobot/processor/pipeline.py:253

Built-in Processor Steps

NormalizerProcessorStep

Normalizes observations and actions using dataset statistics:
The normalizer supports different modes:
  • mean_std: (x - mean) / std
  • min_max: (x - min) / (max - min)
Source: src/lerobot/processor/normalize_processor.py

UnnormalizerProcessorStep

Reverses normalization:
Source: src/lerobot/processor/normalize_processor.py

DeviceProcessorStep

Moves tensors between devices:
Source: src/lerobot/processor/device_processor.py

VanillaObservationProcessorStep

Processes raw observations from robots:
Source: src/lerobot/processor/observation_processor.py

RenameObservationsProcessorStep

Renames observation keys:
Source: src/lerobot/processor/rename_processor.py

Delta Action Processors

Convert between absolute and relative actions:
Source: src/lerobot/processor/delta_action_processor.py

RobotProcessorPipeline

Specialized pipeline for robot control:
Source: src/lerobot/processor/pipeline.py:70

Factory Functions

Convenient functions to create default processors:
Source: src/lerobot/processor/factory.py:27

Example: Complete Pipeline

Here’s a full example of processing observations for a policy:

Example: Action Processing

Process policy outputs back to robot commands:

Stateful Processors

Some processors maintain internal state:
Source: src/lerobot/processor/pipeline.py:192

Saving and Loading Pipelines

Save to Disk

This saves:
  • config.json: Step configurations
  • state.safetensors: Step states (e.g., normalization statistics)

Load from Disk

Push to Hub

Load from Hub

Hooks

Add debugging or logging hooks:
Source: src/lerobot/processor/pipeline.py:281

Integration with Policies

Policies can include processing pipelines:

Best Practices

Save statistics: Always save normalization statistics with your policy so you can unnormalize outputs correctly during deployment.
Order matters: The order of processing steps is important. Typically: rename → normalize → device transfer.
Batch processing: Processors work on single transitions. Use DataLoader for batch processing during training.

Advanced: Custom Processor Steps

Create custom transformation steps:

Next Steps