🔬 lerobot-surgery
⚠️ IMPORTANT: LeRobotDataset v3.0 Only It may work with future v3.x versions, but the code has only been tested on v3.0 so far. For v2.1 datasets, migrate to v3.0 first.
Dataset surgery utils (e.g., merge, episode remove) for LeRobotDataset v3.
✨ Features
- 🔀 Merge multiple datasets seamlessly into a single dataset
- ✂️ Remove specific episodes with automatic re-indexing
- 🖥️ CLI & Python API for flexible usage
📋 Requirements
- Python: 3.8 or higher
- LeRobot: LeRobotDataset version 3.0
- Dependencies: Automatically installed with the package
🚀 Installation
From PyPI
pip install lerobot-surgery
From source
git clone https://github.com/spiglerg/lerobot-surgery.git
cd lerobot-surgery
pip install -e .
Development installation
git clone https://github.com/spiglerg/lerobot-surgery.git
cd lerobot-surgery
pip install -e ".[dev]"
Verify installation:
lerobot-surgery --version
# Output: lerobot-surgery, version 0.1.0
lerobot-surgery --help
# Shows CLI help
📖 Quick Start
Command Line Interface
# Merge multiple datasets
lerobot-surgery merge dataset_a/ dataset_b/ dataset_c/ -o merged_dataset/
# Remove specific episodes (by index)
lerobot-surgery remove my_dataset/ 0 5 10 -o filtered_dataset/
# Display dataset information
lerobot-surgery info my_dataset/
# Show help
lerobot-surgery --help
Python API
from lerobot_surgery import merge_datasets, remove_episodes
# Merge datasets
merged = merge_datasets(
source_paths=["dataset_a/", "dataset_b/", "dataset_c/"],
output_path="merged_dataset/",
)
print(f"Merged {merged.num_episodes} episodes, {merged.num_frames} frames")
# Remove episodes
filtered = remove_episodes(
dataset_path="my_dataset/",
episode_indices=[0, 5, 10], # Episodes to remove
output_path="filtered_dataset/",
)
print(f"Remaining: {filtered.num_episodes} episodes")
📚 Detailed Usage
Merging Datasets
Combine multiple LeRobot datasets with identical structures (features, fps) into a single consolidated dataset.
Requirements:
- All datasets must have the same FPS
- All datasets must have identical features
- Datasets must be in v3.0 format
Episode Re-indexing: Episodes are automatically re-indexed sequentially starting from 0 in the merged dataset.
Removing Episodes
Remove specific episodes from a dataset while maintaining data integrity and re-indexing remaining episodes.
Episode Re-indexing: Remaining episodes are automatically re-indexed sequentially starting from 0.
🧪 Testing
Run the test suite:
# Install development dependencies
pip install -e ".[dev]"
# Run all tests
pytest
# Run with coverage
pytest --cov=lerobot_surgery --cov-report=html
# Run specific test file
pytest tests/test_merge.py -v
🙏 Acknowledgments
Built for the LeRobot framework.
Metadata
Release files for lerobot-surgery 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lerobot_surgery-0.1.0.tar.gz | 11.1 kB | Without provenance | Details for lerobot_surgery-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lerobot_surgery-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for lerobot_surgery-0.1.0-py3-none-any.whl |
Total release size: 21.7 kB
Release files / lerobot_surgery-0.1.0.tar.gz
| Download URL | lerobot_surgery-0.1.0.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4937e9a57c57bf41bb3573f77902fd5cf09351a9da3b279a3525165e47d40701
|
|
BLAKE2b-256 checksum How to use checksums |
e5623a6e7789a2ab9822eb920b54374a59f0c1aa9c4a3935c2d89d4219a04f15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.13
|
Release files / lerobot_surgery-0.1.0-py3-none-any.whl
| Download URL | lerobot_surgery-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
15121eeee3d1f0a2abc84dc58e039893baf1e2a0b5e1482ddd439b7c05ef298b
|
|
BLAKE2b-256 checksum How to use checksums |
8d190e932a6e8491d1de51411724089261ad407719cf4654f27fa1a82b21ede0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.13
|
Security for lerobot-surgery 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.