Fix: rename_map ignored when use_relative_actions=true#3511
Fix: rename_map ignored when use_relative_actions=true#3511wadeKeith wants to merge 1 commit intohuggingface:mainfrom
Conversation
When use_relative_actions=true with a pretrained model (pi05, pi0, pi0_fast, smolvla, xvla), the code sets processor_pretrained_path=None to force building processors from the current policy config rather than loading from the checkpoint. However, rename_map was only being passed via preprocessor_overrides which only applies when loading from pretrained. This meant rename_map was silently ignored when use_relative_actions=true. The fix: - Add rename_map to ProcessorConfigKwargs TypedDict - Always pass rename_map to make_pre_post_processors (when not reward model) - Update all affected processor factories to accept and use rename_map: - make_pi05_pre_post_processors - make_pi0_pre_post_processors - make_pi0_fast_pre_post_processors - make_smolvla_pre_post_processors - make_xvla_pre_post_processors This ensures the RenameObservationsProcessorStep uses the user-provided rename_map regardless of whether processors are loaded from pretrained or built from scratch. Fixes huggingface#3425
There was a problem hiding this comment.
Pull request overview
Fix intended to ensure --rename_map is applied even when use_relative_actions=true forces processor construction from the current policy config (instead of loading processors from the pretrained checkpoint), preventing image/state key mismatches between dataset batches and policy expectations.
Changes:
- Adds
rename_mapinto the training script’s processor kwargs so it can be used when building processors from scratch. - Extends PI0/PI05/PI0Fast/SmolVLA/XVLA processor factory functions to accept
rename_mapand wire it intoRenameObservationsProcessorStep. - Adds
rename_maptoProcessorConfigKwargsinpolicies/factory.py.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/lerobot/scripts/lerobot_train.py | Passes rename_map into processor construction kwargs for non-reward training. |
| src/lerobot/policies/factory.py | Extends ProcessorConfigKwargs with rename_map (but currently does not propagate it to per-policy builders when not loading from pretrained). |
| src/lerobot/policies/pi05/processor_pi05.py | Accepts rename_map and applies it in RenameObservationsProcessorStep. |
| src/lerobot/policies/pi0/processor_pi0.py | Accepts rename_map and applies it in RenameObservationsProcessorStep. |
| src/lerobot/policies/pi0_fast/processor_pi0_fast.py | Accepts rename_map and applies it in RenameObservationsProcessorStep. |
| src/lerobot/policies/smolvla/processor_smolvla.py | Accepts rename_map and applies it in RenameObservationsProcessorStep. |
| src/lerobot/policies/xvla/processor_xvla.py | Accepts rename_map and applies it in RenameObservationsProcessorStep. |
Comments suppressed due to low confidence (1)
src/lerobot/policies/factory.py:233
rename_mapis added toprocessor_kwargs, butmake_pre_post_processors()currently never forwardskwargs.get("rename_map")into the policy-specificmake_*_pre_post_processors(...)calls when building processors from scratch. As a result,rename_mapwill still be ignored in theprocessor_pretrained_path=Nonepath (the reporteduse_relative_actions=truecase). Forwardrename_mapfrommake_pre_post_processorsinto the PI0/PI05/PI0Fast/SmolVLA/XVLA processor factories (and/or apply it via a shared overrides mechanism) so theRenameObservationsProcessorStepgets the user mapping.
preprocessor_config_filename: str | None
postprocessor_config_filename: str | None
preprocessor_overrides: dict[str, Any] | None
postprocessor_overrides: dict[str, Any] | None
dataset_stats: dict[str, dict[str, torch.Tensor]] | None
rename_map: dict[str, str] | None
def make_pre_post_processors(
policy_cfg: PreTrainedConfig,
pretrained_path: str | None = None,
**kwargs: Unpack[ProcessorConfigKwargs],
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if not cfg.is_reward_model_training: | ||
| # Always pass rename_map so it gets applied in the processor even when building | ||
| # processors from scratch (e.g., when use_relative_actions=True bypasses pretrained_path) | ||
| processor_kwargs["rename_map"] = cfg.rename_map | ||
|
|
|
All Copilot review concerns are now addressed in PR #3514, which supersedes #3512:
|
Fix for Issue #3425
When training PI05 (or PI0, PI0Fast, SmolVLA, XVLA) with
use_relative_actions=true, therename_mapargument was silently ignored. This caused training to fail because image feature names from the dataset didn't match what the policy expected.Root Cause
When
use_relative_actions=truewith a pretrained model, the code setsprocessor_pretrained_path=Noneto force building processors from the current policy config rather than loading from the checkpoint. However,rename_mapwas only being passed viapreprocessor_overrideswhich only applies when loading from pretrained. This meantrename_mapwas silently ignored whenuse_relative_actions=true.Solution
rename_maptoProcessorConfigKwargsTypedDict infactory.pyrename_maptomake_pre_post_processors(when not reward model training)rename_map:make_pi05_pre_post_processorsmake_pi0_pre_post_processorsmake_pi0_fast_pre_post_processorsmake_smolvla_pre_post_processorsmake_xvla_pre_post_processorsThis ensures the
RenameObservationsProcessorStepuses the user-providedrename_mapregardless of whether processors are loaded from pretrained or built from scratch.