robot-data-diff 0.1.0__tar.gz → 0.2.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.
Files changed (44) hide show
  1. robot_data_diff-0.2.0/LICENSE +201 -0
  2. robot_data_diff-0.2.0/PKG-INFO +351 -0
  3. robot_data_diff-0.2.0/README.md +317 -0
  4. robot_data_diff-0.2.0/pyproject.toml +74 -0
  5. robot_data_diff-0.2.0/src/robot_data_diff/__init__.py +30 -0
  6. robot_data_diff-0.2.0/src/robot_data_diff/cli.py +145 -0
  7. robot_data_diff-0.2.0/src/robot_data_diff/differ.py +302 -0
  8. robot_data_diff-0.2.0/src/robot_data_diff/filters.py +54 -0
  9. robot_data_diff-0.2.0/src/robot_data_diff/gate.py +114 -0
  10. robot_data_diff-0.2.0/src/robot_data_diff/html_report.py +320 -0
  11. robot_data_diff-0.2.0/src/robot_data_diff/loader.py +462 -0
  12. robot_data_diff-0.2.0/src/robot_data_diff/report.py +260 -0
  13. {robot_data_diff-0.1.0 → robot_data_diff-0.2.0/src}/robot_data_diff/stats.py +14 -8
  14. robot_data_diff-0.2.0/src/robot_data_diff.egg-info/PKG-INFO +351 -0
  15. robot_data_diff-0.2.0/src/robot_data_diff.egg-info/SOURCES.txt +32 -0
  16. {robot_data_diff-0.1.0 → robot_data_diff-0.2.0/src}/robot_data_diff.egg-info/requires.txt +4 -0
  17. robot_data_diff-0.2.0/tests/test_api.py +49 -0
  18. robot_data_diff-0.2.0/tests/test_cli.py +101 -0
  19. robot_data_diff-0.2.0/tests/test_dataset_level.py +33 -0
  20. robot_data_diff-0.2.0/tests/test_diff.py +106 -0
  21. robot_data_diff-0.2.0/tests/test_features.py +62 -0
  22. robot_data_diff-0.2.0/tests/test_filters.py +71 -0
  23. robot_data_diff-0.2.0/tests/test_gate.py +98 -0
  24. robot_data_diff-0.2.0/tests/test_loader.py +81 -0
  25. robot_data_diff-0.2.0/tests/test_match_by_content.py +68 -0
  26. robot_data_diff-0.2.0/tests/test_network.py +31 -0
  27. robot_data_diff-0.2.0/tests/test_report.py +117 -0
  28. robot_data_diff-0.2.0/tests/test_stats.py +30 -0
  29. robot_data_diff-0.2.0/tests/test_verify_stats.py +68 -0
  30. robot_data_diff-0.1.0/PKG-INFO +0 -127
  31. robot_data_diff-0.1.0/README.md +0 -115
  32. robot_data_diff-0.1.0/pyproject.toml +0 -24
  33. robot_data_diff-0.1.0/robot_data_diff/__init__.py +0 -6
  34. robot_data_diff-0.1.0/robot_data_diff/cli.py +0 -62
  35. robot_data_diff-0.1.0/robot_data_diff/differ.py +0 -124
  36. robot_data_diff-0.1.0/robot_data_diff/loader.py +0 -258
  37. robot_data_diff-0.1.0/robot_data_diff/report.py +0 -154
  38. robot_data_diff-0.1.0/robot_data_diff.egg-info/PKG-INFO +0 -127
  39. robot_data_diff-0.1.0/robot_data_diff.egg-info/SOURCES.txt +0 -15
  40. {robot_data_diff-0.1.0 → robot_data_diff-0.2.0}/setup.cfg +0 -0
  41. {robot_data_diff-0.1.0 → robot_data_diff-0.2.0/src}/robot_data_diff/__main__.py +0 -0
  42. {robot_data_diff-0.1.0 → robot_data_diff-0.2.0/src}/robot_data_diff.egg-info/dependency_links.txt +0 -0
  43. {robot_data_diff-0.1.0 → robot_data_diff-0.2.0/src}/robot_data_diff.egg-info/entry_points.txt +0 -0
  44. {robot_data_diff-0.1.0 → robot_data_diff-0.2.0/src}/robot_data_diff.egg-info/top_level.txt +0 -0
@@ -0,0 +1,201 @@
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 reasonable and customary use in describing the
141
+ origin of the Work and 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 Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,351 @@
1
+ Metadata-Version: 2.4
2
+ Name: robot-data-diff
3
+ Version: 0.2.0
4
+ Summary: Episode-aware diff for LeRobot robot-training datasets: what changed in the data since the last good run?
5
+ Author: Japheth790
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/Japheth790/robot-data-diff
8
+ Project-URL: Issues, https://github.com/Japheth790/robot-data-diff/issues
9
+ Keywords: lerobot,robotics,dataset,diff,imitation-learning,huggingface
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Classifier: Topic :: Utilities
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: pyarrow>=12
27
+ Requires-Dist: pandas>=2
28
+ Requires-Dist: numpy>=1.24
29
+ Requires-Dist: huggingface_hub>=0.20
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=7; extra == "dev"
32
+ Requires-Dist: ruff>=0.5; extra == "dev"
33
+ Dynamic: license-file
34
+
35
+ # robot-data-diff
36
+
37
+ [![CI](https://github.com/Japheth790/robot-data-diff/actions/workflows/ci.yml/badge.svg)](https://github.com/Japheth790/robot-data-diff/actions/workflows/ci.yml)
38
+ [![PyPI](https://img.shields.io/pypi/v/robot-data-diff)](https://pypi.org/project/robot-data-diff/)
39
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
40
+
41
+ **You retrained the policy and it got worse. `robot-data-diff` tells you what
42
+ changed in the LeRobot dataset since the last good run, episode by episode.**
43
+
44
+ CPU-only, pure Python, no GPU, no account, and it never downloads videos.
45
+
46
+ ```bash
47
+ pip install robot-data-diff
48
+ robot-data-diff diff lerobot/pusht@v2.1 lerobot/pusht@v3.0
49
+ ```
50
+
51
+ ```text
52
+ ========================================================================
53
+ robot-data-diff — episode-aware dataset diff
54
+ ========================================================================
55
+ A: lerobot/pusht@v2.1 (v2.1, 206 episodes, 10 fps)
56
+ B: lerobot/pusht@v3.0 (v3.0, 206 episodes, 10 fps)
57
+
58
+ Episodes: 206 -> 206 (+0 added, -0 removed, ~0 changed, =206 unchanged)
59
+
60
+ No changed episodes (same index + identical stats).
61
+
62
+ TASK INVENTORY (episodes per task: A -> B):
63
+ Push the T-shaped block onto the T-shaped target. 206 -> 206
64
+
65
+ DATASET-LEVEL CHANGES:
66
+ ! codebase_version: v2.1 -> v3.0
67
+
68
+ Schema: identical feature sets.
69
+
70
+ QUALITY SUMMARY (heuristic, CPU-only):
71
+ mean idle-frame ratio: 0.0309 -> 0.0309 (+0.0000)
72
+ total action spikes: 25 -> 25 (+0)
73
+ ========================================================================
74
+ ```
75
+
76
+ That's the real output: converting pusht from v2.1 to v3.0 changed the
77
+ format, not the data. When episodes *do* change, you get per-episode deltas
78
+ like this (from [`demo/diff-demo-output.txt`](demo/diff-demo-output.txt)):
79
+
80
+ ```text
81
+ Episodes: 206 -> 201 (+1 added, -6 removed, ~5 changed, =195 unchanged)
82
+ added: [206]
83
+ removed: [200, 201, 202, 203, 204, 205]
84
+
85
+ CHANGED EPISODES (5):
86
+ [ep 0] length 161 -> 161 (+0 frames)
87
+ d(action_min) [+46.5000, +35.5000]
88
+ d(action_max) [+187.5000, +224.5000]
89
+ d(action_mean) [+104.5031, +144.1553]
90
+ d(action_std) [+44.1925, +48.3483]
91
+ d(idle_ratio) +0.0000
92
+ d(spikes) +0
93
+ ```
94
+
95
+ ## Install
96
+
97
+ ```bash
98
+ pip install robot-data-diff
99
+ ```
100
+
101
+ Python 3.10+. Dependencies: `pyarrow`, `pandas`, `numpy`, `huggingface_hub`.
102
+
103
+ ## Usage
104
+
105
+ ```bash
106
+ # two local dataset directories
107
+ robot-data-diff diff ./my_dataset_v1 ./my_dataset_v2
108
+
109
+ # Hugging Face ids, optionally pinned to a revision (branch, tag or commit)
110
+ robot-data-diff diff lerobot/pusht ./my_local_copy
111
+ robot-data-diff diff lerobot/pusht@main lerobot/pusht@<commit-sha>
112
+
113
+ # link the diff to a policy checkpoint and write an HTML report
114
+ robot-data-diff diff v1 v2 --checkpoint ckpt-42 --html report.html
115
+
116
+ # metadata only: skips (and doesn't download) data/; fastest
117
+ robot-data-diff diff v1 v2 --no-quality
118
+ ```
119
+
120
+ Each side is a local path or a Hugging Face dataset id (`org/repo`,
121
+ `org/repo@revision`, or `hf://org/repo@revision`).
122
+
123
+ | Option | What it does |
124
+ |---|---|
125
+ | `--format text\|json\|markdown` | what to print on stdout (default `text`) |
126
+ | `--html OUT` / `--json OUT` | also write an HTML report / the JSON result to a file |
127
+ | `--checkpoint LABEL` | record which policy checkpoint this diff belongs to |
128
+ | `--no-quality` | skip the idle/spike heuristics and never read `data/` |
129
+ | `--verify-stats` | recompute per-episode length and min/max/mean/std from `data/` and flag stale metadata |
130
+ | `--match-by index\|content` | pair episodes by index (default) or by a hash of their frames, which reports reordered episodes as *moved* |
131
+ | `--episodes 0-50,99` | only diff these episode indices |
132
+ | `--task "pick cube"` | only diff episodes whose task (in A or B) contains the text; repeatable |
133
+ | `--max-show N` | truncate long episode lists with "... and K more" |
134
+ | `--fail-on RULES` | exit 1 when a rule hits (see [Use in CI](#use-in-ci)) |
135
+ | `--cache-dir DIR` | where to keep Hugging Face downloads |
136
+ | `--verbose` | show full tracebacks on errors |
137
+
138
+ ## What the report shows
139
+
140
+ - **Episode inventory:** counts, plus episodes added / removed / changed (and
141
+ moved, with `--match-by content`)
142
+ - **Per-episode deltas** for changed episodes: frame count, task strings,
143
+ and per-dimension min/max/mean/std deltas for *every* numeric feature
144
+ that changed (`action`, `observation.state`, rewards, ...), plus
145
+ idle-ratio and spike-count deltas
146
+ - **Task inventory:** episodes per task, old → new
147
+ - **Dataset-level changes:** `fps`, `robot_type`, `codebase_version`
148
+ - **Schema drift:** features added / removed / changed dtype or shape
149
+ - **Stale metadata** (with `--verify-stats`): metadata stats that disagree
150
+ with the frames in `data/`
151
+ - **Quality summary:** mean idle-frame ratio and total action spikes,
152
+ old → new (lightweight CPU heuristics, not a full validator)
153
+
154
+ The HTML report ([example](demo/diff-demo-report.html)) is one
155
+ self-contained file: summary cards, a sortable changed-episodes table,
156
+ colour-coded deltas, an episode-length histogram for A vs B, and dark mode.
157
+
158
+ ## How "changed" is detected
159
+
160
+ An episode is **changed** when the same episode exists on both sides but
161
+ its fingerprint differs. The fingerprint is:
162
+
163
+ - length (frame count) and the sorted task strings
164
+ - min / max / mean / std of every feature in the per-episode stats
165
+ (`meta/episodes/` in v3.0, `meta/episodes_stats.jsonl` in v2.1),
166
+ rounded to 6 decimals so float noise isn't reported
167
+ - idle ratio and spike count computed from `action` in `data/` (unless
168
+ `--no-quality`)
169
+
170
+ Some things are deliberately left out:
171
+
172
+ - LeRobot's bookkeeping columns (`index`, `frame_index`, `timestamp`,
173
+ `episode_index`, `task_index`). Their stats only describe where an
174
+ episode sits in the dataset; removing episode 3 shifts the global
175
+ `index` of every later episode without changing their data.
176
+ - Features that exist on only one side. A feature added to the whole
177
+ dataset is schema drift, not 2,000 changed episodes.
178
+
179
+ By default "the same episode" means the same `episode_index`. With
180
+ `--match-by content`, episodes are first paired by a SHA-1 of their raw
181
+ `action` + `observation.state` frames, so data that was only reindexed is
182
+ reported as `moved: 12 -> 40`. Episodes that weren't matched by content are
183
+ then paired by index (edited in place → changed), and anything left over
184
+ is added or removed.
185
+
186
+ Per-episode stats come from the dataset's metadata. If someone edited
187
+ `data/` without regenerating the metadata, run with `--verify-stats` to
188
+ catch it.
189
+
190
+ ## Use in CI
191
+
192
+ `--fail-on` turns the diff into a gate. Exit codes: **0** OK, **1** a rule
193
+ hit, **2** error (bad path, not a LeRobot dataset, bad rule, ...).
194
+
195
+ ```bash
196
+ robot-data-diff diff my-org/teleop-data@main my-org/teleop-data@candidate \
197
+ --fail-on "schema,fps,removed,changed>5%,idle-increase>0.05"
198
+ ```
199
+
200
+ | Rule | Fails when |
201
+ |---|---|
202
+ | `schema` | any feature added, removed, or changed dtype/shape |
203
+ | `fps`, `robot_type`, `codebase_version` | that field of `meta/info.json` changed |
204
+ | `dataset` | any of the three above changed |
205
+ | `tasks` | the number of episodes per task changed |
206
+ | `stale` | `--verify-stats` found metadata that disagrees with `data/` |
207
+ | `added`, `removed`, `changed`, `moved` | the count is > 0; or use `>N`, `>=N`, `>N%` (percent of A's episodes) |
208
+ | `idle-increase>X` | mean idle-frame ratio rose by more than X |
209
+ | `spikes-increase>N` | total action spikes rose by more than N |
210
+
211
+ Each hit is printed to stderr as `fail-on: changed>5%: 12 changed = 6.0% of
212
+ 200 episodes in A`, and recorded under `"fail_on"` in the JSON output.
213
+
214
+ A GitHub Actions job that gates a dataset revision and writes the diff to
215
+ the job summary:
216
+
217
+ ```yaml
218
+ name: dataset-diff
219
+ on: workflow_dispatch
220
+
221
+ jobs:
222
+ diff:
223
+ runs-on: ubuntu-latest
224
+ steps:
225
+ - uses: actions/setup-python@v5
226
+ with:
227
+ python-version: "3.12"
228
+ - run: pip install robot-data-diff
229
+ - name: Diff dataset revisions
230
+ env:
231
+ HF_TOKEN: ${{ secrets.HF_TOKEN }} # only needed for private datasets
232
+ run: |
233
+ robot-data-diff diff my-org/teleop-data@main my-org/teleop-data@candidate \
234
+ --format markdown --max-show 50 --json diff.json \
235
+ --fail-on "schema,fps,removed,changed>5%" >> "$GITHUB_STEP_SUMMARY"
236
+ - uses: actions/upload-artifact@v4
237
+ if: always()
238
+ with:
239
+ name: dataset-diff
240
+ path: diff.json
241
+ ```
242
+
243
+ `--format markdown` output can also be pasted straight into a PR comment or
244
+ a Hugging Face discussion.
245
+
246
+ ## Use from Python
247
+
248
+ ```python
249
+ import robot_data_diff as rdd
250
+
251
+ a = rdd.load_dataset("lerobot/pusht@v2.1")
252
+ b = rdd.load_dataset("lerobot/pusht@v3.0", verify_stats=True)
253
+ result = rdd.diff_datasets(a, b, checkpoint="ckpt-42")
254
+
255
+ print(rdd.render_text(result))
256
+ print(len(result.changed), "changed episodes")
257
+ for d in result.changed:
258
+ print(d.index, d.d_length, d.feature_deltas.get("action"))
259
+
260
+ data = result.to_dict() # JSON-ready, "schema_version": 1
261
+ html = rdd.render_html(result) # or rdd.render_markdown(result)
262
+ ```
263
+
264
+ `load_dataset(ref, cache_dir=None, with_quality=True, verify_stats=False,
265
+ content_hash=False)` returns a `DatasetView`. `diff_datasets(a, b,
266
+ checkpoint=None, match_by="index")` returns a `DiffResult`; pass
267
+ `match_by="content"` with both views loaded using `content_hash=True`.
268
+ Loader errors raise `DatasetError` (a `ValueError`). The JSON layout is
269
+ documented in [docs/json-schema.md](docs/json-schema.md).
270
+
271
+ ## Supported formats
272
+
273
+ - **LeRobot v3.0**: `meta/info.json`, `meta/episodes/chunk-*/file-*.parquet`,
274
+ `data/chunk-*/file-*.parquet`.
275
+ - **LeRobot v2.1** (and v2.0): `meta/info.json`, `meta/episodes.jsonl`,
276
+ `meta/episodes_stats.jsonl`, `data/chunk-*/episode_*.parquet`.
277
+
278
+ Both formats are tested with synthetic fixtures in CI, and against the real
279
+ `lerobot/pusht@v2.1` and `@v3.0` releases in the network tests
280
+ (`pytest -m network`). You can diff across formats, e.g. to check that a
281
+ v2.1 → v3.0 conversion didn't change any data.
282
+
283
+ RLDS, Zarr, HDF5 and rosbag are out of scope (LeRobot only).
284
+
285
+ ## FAQ
286
+
287
+ **Why aren't videos downloaded?** Every number in the report comes from
288
+ `meta/` and the parquet files in `data/`. Videos are usually most of a
289
+ dataset's size, and decoding them would need a GPU or a lot of CPU time.
290
+ Per-episode image/video stats (when LeRobot recorded them in the metadata)
291
+ are still compared.
292
+
293
+ **How does caching work?** Without `--cache-dir`, downloads go to the
294
+ standard Hugging Face cache (`~/.cache/huggingface/hub`) and are reused on
295
+ the next run. With `--cache-dir DIR`, each `repo@revision` gets its own
296
+ subfolder, so two revisions never mix files. `--no-quality` downloads only
297
+ `meta/**`; a later full run fetches `data/**` on top.
298
+
299
+ **Private or gated datasets?** Log in with `huggingface-cli login` or set
300
+ `HF_TOKEN`; `huggingface_hub` picks it up.
301
+
302
+ **How fast is it?** On a synthetic 5,000-episode × 100-frame dataset
303
+ (`benchmarks/bench_load.py`), loading one side takes about 0.4 s for v3.0
304
+ and 3.5 s for v2.1 (one file per episode), or about 0.25 s for either with
305
+ `--no-quality`.
306
+
307
+ **My proxy's `no_proxy` breaks Hugging Face downloads.** Some proxy setups
308
+ put IPv6 entries in `no_proxy` that `httpx` can't parse. Set
309
+ `RDD_STRIP_NO_PROXY=1` and the tool drops `no_proxy`/`NO_PROXY` for its own
310
+ process.
311
+
312
+ ## Honest limits
313
+
314
+ - This is a **diff**, not a validator: it tells you *what changed* between
315
+ revisions, not whether your data is good.
316
+ - Change detection uses per-episode summary stats. Two episodes with the
317
+ same length, tasks, and min/max/mean/std for every feature are
318
+ "unchanged" even if individual frames differ. `--match-by content` hashes
319
+ the raw `action` and `observation.state` frames, but only uses the hash
320
+ for pairing.
321
+ - The idle/spike heuristics are deliberately simple; treat them as a
322
+ prompt to look, not a verdict.
323
+
324
+ ## Reproduce the demo
325
+
326
+ ```bash
327
+ # a local copy of pusht v3.0 (meta + data only; `hf` ships with huggingface_hub >= 0.34)
328
+ hf download lerobot/pusht --repo-type dataset \
329
+ --include "meta/*" --include "data/*" --local-dir testdata/pusht
330
+ python demo/make_modified_fixture.py # builds testdata/pusht_v2
331
+ robot-data-diff diff testdata/pusht testdata/pusht_v2 \
332
+ --checkpoint ckpt-42 --html demo/diff-demo-report.html
333
+ ```
334
+
335
+ ## Related work
336
+
337
+ - [openbot-data](https://github.com/openbotai/openbot-data) (MIT) is a
338
+ broader robot-data toolkit whose `openbot-data diff` compares two
339
+ *snapshot files* (`snapshot` first, then `diff`, with `--fail-on breaking`
340
+ for CI). robot-data-diff is narrower on purpose: it diffs two dataset
341
+ revisions *directly* (local dirs or Hugging Face ids, no snapshot step),
342
+ episode by episode, with per-episode stat deltas.
343
+
344
+ ## Contributing
345
+
346
+ Bug reports and PRs are welcome; see [CONTRIBUTING.md](CONTRIBUTING.md) and
347
+ [CHANGELOG.md](CHANGELOG.md).
348
+
349
+ ## License
350
+
351
+ Apache-2.0