Skip to content

fix(record): pass rename_map to make_policy in lerobot-record#3183

Open
changer-changer wants to merge 1 commit intohuggingface:mainfrom
changer-changer:fix/rename-map-lerobot-record
Open

fix(record): pass rename_map to make_policy in lerobot-record#3183
changer-changer wants to merge 1 commit intohuggingface:mainfrom
changer-changer:fix/rename-map-lerobot-record

Conversation

@changer-changer
Copy link

Summary

Fixes a bug where cfg.dataset.rename_map was not forwarded to make_policy() in lerobot-record, causing feature mismatch errors when recording with renamed camera keys.

Motivation

When using lerobot-record with --dataset.rename_map to remap camera key names (e.g., mapping observation.images.front to observation.images.camera1), the rename mapping was not applied during policy instantiation. This caused a feature mismatch error because the policy expected keys with the original names but received renamed keys.

The make_policy() function already supports a rename_map parameter — it just was not being passed.

Fix

1-line change in src/lerobot/scripts/lerobot_record.py:507:

# Before:
make_policy(cfg.policy, ds_meta=dataset.meta)

# After:
make_policy(cfg.policy, ds_meta=dataset.meta, rename_map=cfg.dataset.rename_map)

Related

Checklist

  • ruff check passes
  • ruff format applied
  • Minimal change (1 file, 1 line)
  • No breaking changes

Copilot AI review requested due to automatic review settings March 19, 2026 00:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes lerobot-record policy instantiation when datasets use renamed observation keys by forwarding cfg.dataset.rename_map into make_policy(), aligning lerobot-record with other entrypoints (e.g., lerobot-eval) and preventing visual feature mismatch errors.

Changes:

  • Pass rename_map=cfg.dataset.rename_map to make_policy() during recording policy load.
  • Reformat the policy = ... assignment into a multiline conditional expression (no behavior change beyond the new argument).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@changer-changer
Copy link
Author

Follow-up update: I added a regression test (tests/test_control_robot.py::test_record_passes_rename_map_to_make_policy) to explicitly validate that cfg.dataset.rename_map is forwarded to make_policy() in lerobot-record.

This makes the fix behavior explicit and protects against regressions in future refactors.

@github-actions github-actions bot added the tests Problems with test coverage, failures, or improvements to testing label Mar 19, 2026
@changer-changer
Copy link
Author

Gentle follow-up: this branch now includes a regression test that asserts rename_map is forwarded into make_policy() from lerobot-record.

Since checks are green, I’d appreciate a quick review when you have a moment.

@changer-changer changer-changer force-pushed the fix/rename-map-lerobot-record branch from f04803c to 32ea203 Compare March 24, 2026 12:10
@changer-changer
Copy link
Author

Hi @maintainers, gentle ping on this PR. It's been a few days since the last update. The branch has been rebased to the latest main and all feedback has been addressed. Would appreciate a review when you have a moment. Thanks!

@changer-changer
Copy link
Author

Hi @maintainers, gentle follow-up on this PR. It's been a few days since the last update. All feedback has been addressed and the branch is ready for review. Would appreciate a look when you have a moment. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Problems with test coverage, failures, or improvements to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rename_map not passed to make_policy in lerobot-record

3 participants