Skip to content

Conversation

@michel-aractingi
Copy link
Collaborator

What this does

Expand dataset_tools function for adding features:

  • add_feature -> add_features: takes a dict of features. First iteration of this function takes add one feature at a time. This was very inefficient as we had to create a new dataset and copy the files each time we wanted to add a feature.
  • introduce new function modify_features that combines add_features and remove_features. These two functions behave very similarly. so it makes sense to make one general function where we can add and remove features simultaneously in order to avoid multiple copies.

This PR will simplify the logic in #2138 and improve the performance.

Testing

  • Run the examples script: examples/datasets/use_datase_tools.py
  • Run the tests in tests/datasets/test_dataset_tools.py
  • Added 4 new tests for modify_features

…tures and add features.

 - This function is important for when we want to add a feature and remove another so we can do it in one time to avoid copying and creating the dataset multiple times
@Copilot Copilot AI review requested due to automatic review settings October 14, 2025 12:43
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

This PR refactors the dataset tools module to improve efficiency by consolidating feature modification operations. It replaces the single-feature add_feature function with a multi-feature add_features function and introduces a new modify_features function that can add and remove features simultaneously.

Key changes:

  • Replace add_feature with add_features for batch feature addition
  • Introduce modify_features function for simultaneous add/remove operations
  • Update all tests and examples to use the new API

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/lerobot/datasets/dataset_tools.py Implements new modify_features and add_features functions, refactors remove_feature to use modify_features
tests/datasets/test_dataset_tools.py Updates all tests to use new API, adds comprehensive tests for modify_features
examples/dataset/use_dataset_tools.py Updates example script to demonstrate new batch operations and modify_features

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@michel-aractingi michel-aractingi force-pushed the feat/expand_add_features branch from e4f2d5c to 2213fa7 Compare October 14, 2025 13:56
@michel-aractingi michel-aractingi merged commit 8e940bf into main Oct 14, 2025
10 checks passed
@michel-aractingi michel-aractingi deleted the feat/expand_add_features branch October 14, 2025 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants