feat(processor): implement migration detection and error handling for processor configurations #1968
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add intelligent migration detection to
DataProcessorPipeline.from_pretrained()to guide users when they try to load old LeRobot models that need migration to the new processor format. During implementation, we discovered opportunities to dramatically simplify the loading logic by requiring explicitconfig_filenameparameter.🎯 Main Purpose: Migration Detection
✨ Migration Detection Features
Migration Detection Logic
🔧 Secondary Improvements: Simplified Loading Logic
💥 Breaking Change: Explicit
config_filenameRequiredWhile implementing migration detection, we realized the auto-detection logic was unnecessarily complex and prone to bugs. We simplified it by requiring explicit
config_filename:🗑️ Massive Simplification Achieved
_resolve_config_source(65 lines),_looks_like_local_path(25 lines)_load_config(40 lines → 20 lines with cleaner logic)Super-Simplified 3-Way Loading
🔧 Refactoring for Better Maintainability
Modular Helper Methods
_load_config_validate_loaded_config_resolve_step_class_instantiate_step_load_step_state_build_steps_with_overrides_validate_overrides_used*Tested through integration tests
Before vs After Complexity
🚨 Breaking Change Details
Why Explicit
config_filenameis CriticalThe main driver was preventing dangerous silent bugs in migration detection implementation:
Migration Guide
Impact Analysis
config_filenameparameter🧪 Testing
Comprehensive Test Coverage
test_migration_detection.py)test_pipeline_from_pretrained_helpers.py)Test Structure Improvements
test_pipeline_from_pretrained_helpers.py(descriptive)💡 Migration Example (Main Feature)
🎯 Smart Migration Detection Algorithm
🚀 Benefits
For Users (Primary Goal)
KeyError: 'steps'For Developers (Secondary Benefits)