lerobot-lancedb 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,200 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Support. While redistributing the Work or
166
+ Derivative Works thereof, You may accept support, warranty,
167
+ indemnity, or other liability obligations and/or rights consistent
168
+ with this License. However, in accepting such obligations, You may
169
+ act only on Your own behalf and on Your sole responsibility, not on
170
+ behalf of any other Contributor, and only if You agree to indemnify,
171
+ defend, and hold each Contributor harmless for any liability
172
+ incurred by, or claims asserted against, such Contributor by reason
173
+ of your accepting any such warranty or support.
174
+
175
+ END OF TERMS AND CONDITIONS
176
+
177
+ APPENDIX: How to apply the Apache License to your work.
178
+
179
+ To apply the Apache License to your work, attach the following
180
+ boilerplate notice, with the fields enclosed by brackets "[]"
181
+ replaced with your own identifying information. (Don't include
182
+ the brackets!) The text should be enclosed in the appropriate
183
+ comment syntax for the file format. We also recommend that a
184
+ file or class name and description of purpose be included on the
185
+ same "printed page" as the copyright notice for easier
186
+ identification within third-party archives.
187
+
188
+ Copyright 2025 LanceDB and lerobot-lancedb contributors
189
+
190
+ Licensed under the Apache License, Version 2.0 (the "License");
191
+ you may not use this file except in compliance with the License.
192
+ You may obtain a copy of the License at
193
+
194
+ http://www.apache.org/licenses/LICENSE-2.0
195
+
196
+ Unless required by applicable law or agreed to in writing, software
197
+ distributed under the License is distributed on an "AS IS" BASIS,
198
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
199
+ See the License for the specific language governing permissions and
200
+ limitations under the License.
@@ -0,0 +1,127 @@
1
+ Metadata-Version: 2.4
2
+ Name: lerobot-lancedb
3
+ Version: 0.1.0
4
+ Summary: Lance-backed datasets for LeRobot — frame-level random access on local disk and cloud (S3 / GCS / HF Hub / HF Buckets).
5
+ Author-email: Ayush Chaurasia <ayush@lancedb.com>
6
+ License: Apache-2.0
7
+ Project-URL: homepage, https://github.com/lancedb/lerobot-lancedb
8
+ Project-URL: issues, https://github.com/lancedb/lerobot-lancedb/issues
9
+ Keywords: lerobot,lancedb,lance,robotics,datasets,dataloader
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
+ Requires-Python: >=3.12
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: lerobot>=0.5.0
21
+ Requires-Dist: datasets<5.0.0,>=4.0.0
22
+ Requires-Dist: pyarrow<30.0.0,>=21.0.0
23
+ Requires-Dist: lancedb<1.0.0,>=0.20.0
24
+ Requires-Dist: pylance<1.0.0,>=0.20.0
25
+ Requires-Dist: numpy<2.3.0,>=2.0.0
26
+ Requires-Dist: Pillow>=10.0.0
27
+ Requires-Dist: torch<2.11.0,>=2.7
28
+ Requires-Dist: torchvision>=0.22.0
29
+ Provides-Extra: test
30
+ Requires-Dist: pytest<9.0.0,>=8.1.0; extra == "test"
31
+ Requires-Dist: pytest-timeout<3.0.0,>=2.4.0; extra == "test"
32
+ Provides-Extra: dev
33
+ Requires-Dist: lerobot-lancedb[docs,test]; extra == "dev"
34
+ Requires-Dist: ruff>=0.14.1; extra == "dev"
35
+ Requires-Dist: build>=1.2; extra == "dev"
36
+ Requires-Dist: twine>=5.1; extra == "dev"
37
+ Provides-Extra: docs
38
+ Requires-Dist: mkdocs>=1.6; extra == "docs"
39
+ Requires-Dist: mkdocs-material>=9.5; extra == "docs"
40
+ Requires-Dist: pymdown-extensions>=10.0; extra == "docs"
41
+ Dynamic: license-file
42
+
43
+ # lerobot-lancedb
44
+
45
+ 📖 **Docs: <https://lancedb.github.io/lerobot-lancedb/>**
46
+
47
+ Lance-backed datasets for [LeRobot](https://github.com/huggingface/lerobot). Drop-in replacement for `LeRobotDataset` with two storage layouts:
48
+
49
+ - **`LeRobotLanceDataset`** — per-frame JPEG bytes (lossy, fastest at single-frame access, optional GPU NVJPEG decode).
50
+ - **`LeRobotLanceVideoDataset`** — per-file mp4 bytes stored via Lance blob v2, decoded on the fly with torchcodec. Bit-exact pixels, ~same disk size as upstream.
51
+
52
+ Both subclass `LeRobotDataset` so existing trainers / samplers / `isinstance` checks accept them transparently.
53
+
54
+ ## Install
55
+
56
+ ```bash
57
+ pip install lerobot-lancedb
58
+ ```
59
+
60
+ For local development:
61
+
62
+ ```bash
63
+ git clone https://github.com/lancedb/lerobot-lancedb.git
64
+ cd lerobot-lancedb
65
+ pip install -e '.[dev]'
66
+ ```
67
+
68
+ ## Quickstart
69
+
70
+ ```bash
71
+ # Convert (recommended path for dtype=video sources)
72
+ lerobot-convert-to-lance-video \
73
+ --repo-id=lerobot/aloha_static_cups_open \
74
+ --output=./aloha_cups_open_lance_video --overwrite
75
+ ```
76
+
77
+ ```python
78
+ from lerobot_lancedb import LeRobotLanceVideoDataset
79
+ ds = LeRobotLanceVideoDataset(root="./aloha_cups_open_lance_video")
80
+ ```
81
+
82
+ For the JPEG layout, use `lerobot-convert-to-lance` and `LeRobotLanceDataset` instead. See the [docs](https://lancedb.github.io/lerobot-lancedb/) for the full CLI / API reference.
83
+
84
+ ## Benchmark
85
+
86
+ Realistic training read pattern (`delta_timestamps`, 8 frames / sample, batch 32, num_workers 4, CPU decode, H100):
87
+
88
+ | dataset | format | size MB | delta_ts fps | **speedup** |
89
+ |---|---|---:|---:|---:|
90
+ | **pusht** (96×96, 1-cam) | upstream parquet+mp4 | 7.3 | 750 | 1.00× |
91
+ | | `convert_to_lance` (JPEG-95) | 60.0 | 3510 | **4.68×** |
92
+ | | `convert_to_lance --jpeg-quality=100 --jpeg-subsampling=0` | 105.6 | 2909 | 3.88× |
93
+ | | **`convert_to_lance_video`** | **8.0** | 2853 | **3.80×** |
94
+ | **ALOHA cups_open** (480×640, 4-cam) | upstream parquet+mp4 | 485.6 | 18.7 | 1.00× |
95
+ | | `convert_to_lance` (JPEG-95) | 3626.0 | 46.0 | **2.46×** |
96
+ | | `convert_to_lance --jpeg-quality=100 --jpeg-subsampling=0` | 8735.4 | 32.5 | 1.74× |
97
+ | | **`convert_to_lance_video`** | **487.4** | 45.6 | **2.44×** |
98
+ | **Koch lego** (480×640, 2-cam) | upstream parquet+mp4 | 2014.1 | 26.6 | 1.00× |
99
+ | | `convert_to_lance` (JPEG-95) | 8541.0 | 70.8 | **2.66×** |
100
+ | | `convert_to_lance --jpeg-quality=100 --jpeg-subsampling=0` | 17 335.3 | 49.0 | 1.84× |
101
+ | | **`convert_to_lance_video`** | **2015.9** | 53.8 | **2.02×** |
102
+
103
+ Reproducible via [`examples/benchmark_formats.py`](examples/benchmark_formats.py).
104
+
105
+ ## Training parity
106
+
107
+ `convert_to_lance_video` trains a `DiffusionPolicy` on pusht to **68.4 % gym-pusht success** (seed=42, 500 rollouts) — matches the head-to-head upstream parquet+mp4 result (68.0 %) and the published [`lerobot/diffusion_pusht`](https://huggingface.co/lerobot/diffusion_pusht) (65.4 %).
108
+
109
+ Full numbers (pusht env-eval + ALOHA cups_open held-out MSE across all storage modes) in [`docs/benchmarks.md`](https://lancedb.github.io/lerobot-lancedb/benchmarks/). Reproducers: [`examples/train_and_eval_lance.py`](examples/train_and_eval_lance.py) and [`examples/aloha_loader_parity.py`](examples/aloha_loader_parity.py).
110
+
111
+ ## Cloud / Hub
112
+
113
+ Both readers accept `s3://`, `gs://`, `hf://datasets/...`, `hf://buckets/...` URIs and pick up credentials from the usual env vars (`AWS_*`, `GOOGLE_APPLICATION_CREDENTIALS`, `HF_TOKEN`). Lance does byte-range fetches — no full-dataset download.
114
+
115
+ Pre-converted reference datasets you can paste directly:
116
+
117
+ ```python
118
+ from lerobot_lancedb import LeRobotLanceDataset, LeRobotLanceVideoDataset
119
+
120
+ LeRobotLanceDataset(repo_id="lance-format/pusht-lerobot-lancedb") # 60 MB JPEG layout
121
+ LeRobotLanceVideoDataset(repo_id="lance-format/pusht-lerobot-lancedb-video") # 8 MB video-blob layout
122
+ ```
123
+
124
+
125
+ ## License
126
+
127
+ Apache 2.0.
@@ -0,0 +1,85 @@
1
+ # lerobot-lancedb
2
+
3
+ 📖 **Docs: <https://lancedb.github.io/lerobot-lancedb/>**
4
+
5
+ Lance-backed datasets for [LeRobot](https://github.com/huggingface/lerobot). Drop-in replacement for `LeRobotDataset` with two storage layouts:
6
+
7
+ - **`LeRobotLanceDataset`** — per-frame JPEG bytes (lossy, fastest at single-frame access, optional GPU NVJPEG decode).
8
+ - **`LeRobotLanceVideoDataset`** — per-file mp4 bytes stored via Lance blob v2, decoded on the fly with torchcodec. Bit-exact pixels, ~same disk size as upstream.
9
+
10
+ Both subclass `LeRobotDataset` so existing trainers / samplers / `isinstance` checks accept them transparently.
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ pip install lerobot-lancedb
16
+ ```
17
+
18
+ For local development:
19
+
20
+ ```bash
21
+ git clone https://github.com/lancedb/lerobot-lancedb.git
22
+ cd lerobot-lancedb
23
+ pip install -e '.[dev]'
24
+ ```
25
+
26
+ ## Quickstart
27
+
28
+ ```bash
29
+ # Convert (recommended path for dtype=video sources)
30
+ lerobot-convert-to-lance-video \
31
+ --repo-id=lerobot/aloha_static_cups_open \
32
+ --output=./aloha_cups_open_lance_video --overwrite
33
+ ```
34
+
35
+ ```python
36
+ from lerobot_lancedb import LeRobotLanceVideoDataset
37
+ ds = LeRobotLanceVideoDataset(root="./aloha_cups_open_lance_video")
38
+ ```
39
+
40
+ For the JPEG layout, use `lerobot-convert-to-lance` and `LeRobotLanceDataset` instead. See the [docs](https://lancedb.github.io/lerobot-lancedb/) for the full CLI / API reference.
41
+
42
+ ## Benchmark
43
+
44
+ Realistic training read pattern (`delta_timestamps`, 8 frames / sample, batch 32, num_workers 4, CPU decode, H100):
45
+
46
+ | dataset | format | size MB | delta_ts fps | **speedup** |
47
+ |---|---|---:|---:|---:|
48
+ | **pusht** (96×96, 1-cam) | upstream parquet+mp4 | 7.3 | 750 | 1.00× |
49
+ | | `convert_to_lance` (JPEG-95) | 60.0 | 3510 | **4.68×** |
50
+ | | `convert_to_lance --jpeg-quality=100 --jpeg-subsampling=0` | 105.6 | 2909 | 3.88× |
51
+ | | **`convert_to_lance_video`** | **8.0** | 2853 | **3.80×** |
52
+ | **ALOHA cups_open** (480×640, 4-cam) | upstream parquet+mp4 | 485.6 | 18.7 | 1.00× |
53
+ | | `convert_to_lance` (JPEG-95) | 3626.0 | 46.0 | **2.46×** |
54
+ | | `convert_to_lance --jpeg-quality=100 --jpeg-subsampling=0` | 8735.4 | 32.5 | 1.74× |
55
+ | | **`convert_to_lance_video`** | **487.4** | 45.6 | **2.44×** |
56
+ | **Koch lego** (480×640, 2-cam) | upstream parquet+mp4 | 2014.1 | 26.6 | 1.00× |
57
+ | | `convert_to_lance` (JPEG-95) | 8541.0 | 70.8 | **2.66×** |
58
+ | | `convert_to_lance --jpeg-quality=100 --jpeg-subsampling=0` | 17 335.3 | 49.0 | 1.84× |
59
+ | | **`convert_to_lance_video`** | **2015.9** | 53.8 | **2.02×** |
60
+
61
+ Reproducible via [`examples/benchmark_formats.py`](examples/benchmark_formats.py).
62
+
63
+ ## Training parity
64
+
65
+ `convert_to_lance_video` trains a `DiffusionPolicy` on pusht to **68.4 % gym-pusht success** (seed=42, 500 rollouts) — matches the head-to-head upstream parquet+mp4 result (68.0 %) and the published [`lerobot/diffusion_pusht`](https://huggingface.co/lerobot/diffusion_pusht) (65.4 %).
66
+
67
+ Full numbers (pusht env-eval + ALOHA cups_open held-out MSE across all storage modes) in [`docs/benchmarks.md`](https://lancedb.github.io/lerobot-lancedb/benchmarks/). Reproducers: [`examples/train_and_eval_lance.py`](examples/train_and_eval_lance.py) and [`examples/aloha_loader_parity.py`](examples/aloha_loader_parity.py).
68
+
69
+ ## Cloud / Hub
70
+
71
+ Both readers accept `s3://`, `gs://`, `hf://datasets/...`, `hf://buckets/...` URIs and pick up credentials from the usual env vars (`AWS_*`, `GOOGLE_APPLICATION_CREDENTIALS`, `HF_TOKEN`). Lance does byte-range fetches — no full-dataset download.
72
+
73
+ Pre-converted reference datasets you can paste directly:
74
+
75
+ ```python
76
+ from lerobot_lancedb import LeRobotLanceDataset, LeRobotLanceVideoDataset
77
+
78
+ LeRobotLanceDataset(repo_id="lance-format/pusht-lerobot-lancedb") # 60 MB JPEG layout
79
+ LeRobotLanceVideoDataset(repo_id="lance-format/pusht-lerobot-lancedb-video") # 8 MB video-blob layout
80
+ ```
81
+
82
+
83
+ ## License
84
+
85
+ Apache 2.0.
@@ -0,0 +1,86 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "lerobot-lancedb"
7
+ version = "0.1.0"
8
+ description = "Lance-backed datasets for LeRobot — frame-level random access on local disk and cloud (S3 / GCS / HF Hub / HF Buckets)."
9
+ readme = "README.md"
10
+ license = { text = "Apache-2.0" }
11
+ requires-python = ">=3.12"
12
+ authors = [
13
+ { name = "Ayush Chaurasia", email = "ayush@lancedb.com" },
14
+ ]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Intended Audience :: Developers",
18
+ "Intended Audience :: Science/Research",
19
+ "License :: OSI Approved :: Apache Software License",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
23
+ ]
24
+ keywords = ["lerobot", "lancedb", "lance", "robotics", "datasets", "dataloader"]
25
+
26
+ dependencies = [
27
+ # We subclass lerobot.datasets.LeRobotDataset so isinstance checks pass
28
+ # for downstream training code (factories, samplers, etc.). We don't
29
+ # depend on the [dataset] extra explicitly because older lerobot versions
30
+ # bundled those deps into the base install. Users on lerobot>=0.6 should
31
+ # install with `lerobot-lancedb` + `lerobot[dataset]` together.
32
+ "lerobot>=0.5.0",
33
+ "datasets>=4.0.0,<5.0.0",
34
+ "pyarrow>=21.0.0,<30.0.0",
35
+ "lancedb>=0.20.0,<1.0.0",
36
+ "pylance>=0.20.0,<1.0.0",
37
+ "numpy>=2.0.0,<2.3.0",
38
+ "Pillow>=10.0.0",
39
+ "torch>=2.7,<2.11.0",
40
+ "torchvision>=0.22.0",
41
+ ]
42
+
43
+ [project.optional-dependencies]
44
+ test = [
45
+ "pytest>=8.1.0,<9.0.0",
46
+ "pytest-timeout>=2.4.0,<3.0.0",
47
+ ]
48
+ dev = [
49
+ "lerobot-lancedb[test,docs]",
50
+ "ruff>=0.14.1",
51
+ "build>=1.2",
52
+ "twine>=5.1",
53
+ ]
54
+ docs = [
55
+ "mkdocs>=1.6",
56
+ "mkdocs-material>=9.5",
57
+ "pymdown-extensions>=10.0",
58
+ ]
59
+
60
+ [project.scripts]
61
+ lerobot-convert-to-lance = "lerobot_lancedb.scripts.convert_to_lance:main"
62
+ lerobot-convert-to-lance-video = "lerobot_lancedb.scripts.convert_to_lance_video:main"
63
+
64
+ [project.urls]
65
+ homepage = "https://github.com/lancedb/lerobot-lancedb"
66
+ issues = "https://github.com/lancedb/lerobot-lancedb/issues"
67
+
68
+ [tool.setuptools.packages.find]
69
+ where = ["src"]
70
+
71
+ [tool.ruff]
72
+ target-version = "py312"
73
+ line-length = 110
74
+
75
+ [tool.ruff.lint]
76
+ select = ["E", "W", "F", "I", "UP", "B", "PLC0415"]
77
+ ignore = ["E501"]
78
+
79
+ [tool.ruff.lint.per-file-ignores]
80
+ # Tests legitimately gate imports behind ``pytest.importorskip`` for optional
81
+ # extras, so allowing local imports inside test functions is intentional.
82
+ "tests/*.py" = ["PLC0415"]
83
+
84
+ [tool.pytest.ini_options]
85
+ testpaths = ["tests"]
86
+ addopts = "-ra"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright 2025 lerobot-lancedb contributors.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ """Lance-backed datasets for LeRobot."""
11
+
12
+ from __future__ import annotations
13
+
14
+ from .auto import make_lerobot_dataset
15
+ from .benchmark import benchmark_throughput, print_throughput_table
16
+ from .dataset import LeRobotLanceDataset
17
+ from .lance_video_dataset import LeRobotLanceVideoDataset
18
+ from .writer import convert_to_lance, convert_to_lance_video
19
+
20
+ __version__ = "0.1.0.dev0"
21
+
22
+
23
+ __all__ = [
24
+ "LeRobotLanceDataset",
25
+ "LeRobotLanceVideoDataset",
26
+ "benchmark_throughput",
27
+ "convert_to_lance",
28
+ "convert_to_lance_video",
29
+ "make_lerobot_dataset",
30
+ "print_throughput_table",
31
+ "__version__",
32
+ ]
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright 2025 lerobot-lancedb contributors.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ """Multiprocessing-mode helpers used by the Lance backend.
11
+
12
+ LanceDB maintains an internal tokio runtime in the parent process. The runtime
13
+ does not survive ``fork()`` cleanly: a worker spawned via fork can hit a torn
14
+ heap inherited from a parent thread that was mid-allocation, producing glibc
15
+ heap-corruption crashes (``malloc(): invalid size``, ``free(): invalid
16
+ pointer``). The crashes are deterministic on cloud reads (S3, HF Buckets) at
17
+ ``num_workers >= 8`` and flaky at lower counts. Forcing ``spawn`` on Linux
18
+ avoids the issue at the cost of ~7s extra import time per worker, paid once.
19
+ """
20
+
21
+ from __future__ import annotations
22
+
23
+ import logging
24
+ import multiprocessing as mp
25
+ import sys
26
+
27
+ _SPAWN_FORCED = False
28
+
29
+
30
+ def force_spawn_for_lance() -> None:
31
+ """Idempotently switch multiprocessing to ``spawn`` on Linux.
32
+
33
+ Called from :class:`LeRobotLanceDataset.__init__`. No-op when:
34
+
35
+ * Running on macOS (already defaults to spawn).
36
+ * The current process has already chosen a non-fork start method.
37
+ """
38
+ global _SPAWN_FORCED
39
+ if _SPAWN_FORCED:
40
+ return
41
+ _SPAWN_FORCED = True
42
+
43
+ if sys.platform != "linux":
44
+ return
45
+
46
+ current = mp.get_start_method(allow_none=True)
47
+ if current not in (None, "fork"):
48
+ return
49
+
50
+ try:
51
+ mp.set_start_method("spawn", force=True)
52
+ logging.info(
53
+ "lerobot-lancedb: multiprocessing start method set to 'spawn' "
54
+ "(was %s) — workaround for lancedb fork-unsafety.",
55
+ current or "default (fork)",
56
+ )
57
+ except RuntimeError as exc:
58
+ logging.warning(
59
+ "lerobot-lancedb could not switch multiprocessing to 'spawn' "
60
+ "(%s); DataLoader workers may crash.",
61
+ exc,
62
+ )
63
+
64
+ try:
65
+ import torch # noqa: PLC0415 — optional: tolerate torch missing at install time
66
+
67
+ torch.multiprocessing.set_sharing_strategy("file_system")
68
+ except (ImportError, RuntimeError) as exc:
69
+ logging.warning(
70
+ "lerobot-lancedb could not switch torch sharing strategy to "
71
+ "'file_system' (%s); workers may misbehave on /dev/shm IPC.",
72
+ exc,
73
+ )
74
+
75
+
76
+ __all__ = ["force_spawn_for_lance"]