Migrate policy to PolicyProcessorPipeline system

#1
by AdilZtn - opened
Owner
β€’
edited Sep 20

πŸ€– Automated Policy Migration to PolicyProcessorPipeline

This PR migrates your model to the new LeRobot policy format using the modern PolicyProcessorPipeline architecture.

What Changed

✨ New Architecture - PolicyProcessorPipeline

Your model now uses external PolicyProcessorPipeline components for data processing instead of built-in normalization layers. This provides:

  • Modularity: Separate preprocessing and postprocessing pipelines
  • Flexibility: Easy to swap, configure, and debug processing steps
  • Compatibility: Works with the latest LeRobot ecosystem

πŸ”§ Normalization Extraction

We've extracted normalization statistics from your model's state_dict and removed the built-in normalization layers:

  • Extracted patterns: normalize_inputs.*, unnormalize_outputs.*, normalize.*, unnormalize.*, input_normalizer.*, output_normalizer.*
  • Statistics preserved: Mean, std, min, max values for all features
  • Clean model: State dict now contains only core model weights

πŸ“¦ Files Added

  • preprocessor_config.json: Configuration for input preprocessing pipeline
  • postprocessor_config.json: Configuration for output postprocessing pipeline
  • model.safetensors: Clean model weights without normalization layers
  • config.json: Updated model configuration
  • train_config.json: Training configuration
  • README.md: Updated model card with migration information

πŸš€ Benefits

  • Backward Compatible: Your model behavior remains identical
  • Future Ready: Compatible with latest LeRobot features and updates
  • Debuggable: Easy to inspect and modify processing steps
  • Portable: Processors can be shared and reused across models

πŸ’» Usage

# Load your migrated model
from lerobot.policies import get_policy_class
from lerobot.processor import PolicyProcessorPipeline

# The preprocessor and postprocessor are now external
preprocessor = PolicyProcessorPipeline.from_pretrained("your-model-repo", config_filename="preprocessor_config.json")
postprocessor = PolicyProcessorPipeline.from_pretrained("your-model-repo", config_filename="postprocessor_config.json")
policy = get_policy_class("your-policy-type").from_pretrained("your-model-repo")

# Process data through the pipeline
processed_batch = preprocessor(raw_batch)
action = policy(processed_batch)
final_action = postprocessor(action)

Generated automatically by the LeRobot policy migration script

AdilZtn changed pull request status to merged

Sign up or log in to comment