Skip to content

fix: auto-migrate old Hub models missing processor configs#3001

Open
sattyamjjain wants to merge 1 commit intohuggingface:mainfrom
sattyamjjain:fix/backward-compat-old-hub-models
Open

fix: auto-migrate old Hub models missing processor configs#3001
sattyamjjain wants to merge 1 commit intohuggingface:mainfrom
sattyamjjain:fix/backward-compat-old-hub-models

Conversation

@sattyamjjain
Copy link
Copy Markdown

Summary

  • Old pre-trained Hub models (e.g., lerobot/diffusion_pusht) lack the policy_preprocessor.json and policy_postprocessor.json files required by the new processor pipeline system (0.4.4+), causing FileNotFoundError on lerobot-eval
  • Layer 1 — Detection: Adds _is_old_hub_model() to DataProcessorPipeline that detects repos with config.json but no processor configs, raising ProcessorMigrationError with an actionable migration command instead of a cryptic error
  • Layer 2 — Auto-migration: make_pre_post_processors() in factory.py catches ProcessorMigrationError, downloads model.safetensors, extracts normalization stats from the old built-in normalization layers, and auto-creates processor pipelines — with a warning suggesting the permanent migration script

Files Changed

File Description
src/lerobot/processor/pipeline.py _is_old_hub_model() classmethod + migration detection in _load_config() Hub path
src/lerobot/policies/factory.py ProcessorMigrationError catch + _auto_create_processors_from_pretrained() helper
tests/processor/test_pipeline_from_pretrained_helpers.py 3 test cases for old Hub model detection

Test plan

  • lerobot-eval --policy.path=lerobot/diffusion_pusht works end-to-end (33.3% success, avg_sum_reward 94.5)
  • Auto-migration warning is logged with actionable migration command
  • 19/19 tests pass in test_pipeline_from_pretrained_helpers.py
  • CI should pass (no new dependencies introduced — uses existing extract_normalization_stats from migration module)

🤖 Generated with Claude Code

Old pre-trained models on HuggingFace Hub (e.g., lerobot/diffusion_pusht)
lack the policy_preprocessor.json and policy_postprocessor.json files
required by the new processor pipeline system (0.4.4+). This causes a
FileNotFoundError when loading these models with `lerobot-eval`.

This commit adds two layers of backward compatibility:

Layer 1 - Detection (pipeline.py):
- Add `_is_old_hub_model()` to detect repos with config.json but no
  processor configs
- Raise `ProcessorMigrationError` with actionable migration command
  instead of a cryptic FileNotFoundError

Layer 2 - Auto-migration (factory.py):
- Catch `ProcessorMigrationError` in `make_pre_post_processors()`
- Download model.safetensors and extract normalization stats from the
  old built-in normalization layers
- Auto-create processor pipelines using the existing policy factory
- Log a warning suggesting the permanent migration script

Tested end-to-end: `lerobot-eval --policy.path=lerobot/diffusion_pusht`
now works directly on main without manual migration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added policies Items related to robot policies tests Problems with test coverage, failures, or improvements to testing processor Issue related to processor labels Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

policies Items related to robot policies processor Issue related to processor tests Problems with test coverage, failures, or improvements to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant