gr00t-bonsai 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.
- gr00t_bonsai-0.1.0/LICENSE +201 -0
- gr00t_bonsai-0.1.0/NOTICE +35 -0
- gr00t_bonsai-0.1.0/PKG-INFO +219 -0
- gr00t_bonsai-0.1.0/README.md +169 -0
- gr00t_bonsai-0.1.0/pyproject.toml +96 -0
- gr00t_bonsai-0.1.0/setup.cfg +4 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/__init__.py +220 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/_gr00t_compat.py +160 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/_hub_compat.py +72 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/_isolated.py +108 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/bench/__init__.py +20 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/bench/cli.py +189 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/bench/fault_injector.py +234 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/ckpt_codec.py +211 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/convert.py +834 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/curate.py +714 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/episode_loader.py +1151 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/exact_resume.py +1166 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/gop_cache.py +544 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/lance_query.py +172 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/metadata.py +490 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/resumable_mixture.py +739 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/sharded_dataset.py +227 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/trainer_integration.py +437 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/turbo/__init__.py +32 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/turbo/_triton_adamw.py +233 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/turbo/ema.py +136 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/turbo/lowmem_adamw.py +470 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/turbo/online_turbo.py +628 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/vector_curate.py +1865 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/vl_cache/__init__.py +73 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/vl_cache/accel.py +584 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/vl_cache/codec.py +249 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai/vl_cache/store.py +427 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai.egg-info/PKG-INFO +219 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai.egg-info/SOURCES.txt +57 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai.egg-info/dependency_links.txt +1 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai.egg-info/entry_points.txt +6 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai.egg-info/requires.txt +31 -0
- gr00t_bonsai-0.1.0/src/gr00t_bonsai.egg-info/top_level.txt +2 -0
- gr00t_bonsai-0.1.0/src/gr00t_lancedb/__init__.py +64 -0
- gr00t_bonsai-0.1.0/tests/test_compat_shim.py +38 -0
- gr00t_bonsai-0.1.0/tests/test_convert_and_parity.py +209 -0
- gr00t_bonsai-0.1.0/tests/test_curation.py +493 -0
- gr00t_bonsai-0.1.0/tests/test_exact_resume.py +165 -0
- gr00t_bonsai-0.1.0/tests/test_online_turbo.py +570 -0
- gr00t_bonsai-0.1.0/tests/test_resumable_mixture.py +198 -0
- gr00t_bonsai-0.1.0/tests/test_s3_streaming.py +114 -0
- gr00t_bonsai-0.1.0/tests/test_spot_preemption.py +133 -0
- gr00t_bonsai-0.1.0/tests/test_train_perf_v1.py +798 -0
- gr00t_bonsai-0.1.0/tests/test_turbo_ema.py +163 -0
- gr00t_bonsai-0.1.0/tests/test_turbo_lowmem_adamw.py +377 -0
- gr00t_bonsai-0.1.0/tests/test_turbo_scripts.py +986 -0
- gr00t_bonsai-0.1.0/tests/test_v1_emergency_ckpt.py +245 -0
- gr00t_bonsai-0.1.0/tests/test_v1_io_cache.py +301 -0
- gr00t_bonsai-0.1.0/tests/test_v1_lance_mvcc.py +188 -0
- gr00t_bonsai-0.1.0/tests/test_v1_scripts.py +641 -0
- gr00t_bonsai-0.1.0/tests/test_vector_curation.py +499 -0
- gr00t_bonsai-0.1.0/tests/test_vl_cache.py +150 -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 2026 gr00t-bonsai contributors
|
|
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,35 @@
|
|
|
1
|
+
gr00t-bonsai
|
|
2
|
+
Copyright 2026 gr00t-bonsai contributors
|
|
3
|
+
|
|
4
|
+
This project is independent and is not affiliated with or endorsed by NVIDIA or LanceDB.
|
|
5
|
+
|
|
6
|
+
It depends at runtime on:
|
|
7
|
+
|
|
8
|
+
- NVIDIA Isaac-GR00T, licensed under Apache-2.0
|
|
9
|
+
(https://github.com/NVIDIA/Isaac-GR00T). Model weights such as
|
|
10
|
+
nvidia/GR00T-N1.7-3B are licensed separately under the NVIDIA Open Model
|
|
11
|
+
License (https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/).
|
|
12
|
+
That license is not granted by this repository's Apache-2.0 license.
|
|
13
|
+
|
|
14
|
+
- Hugging Face LeRobot (Apache-2.0) and lerobot-lancedb.
|
|
15
|
+
|
|
16
|
+
- LIBERO (https://github.com/Lifelong-Robot-Learning/LIBERO): the codebase is
|
|
17
|
+
MIT; the demonstration datasets are Creative Commons Attribution 4.0
|
|
18
|
+
International (CC BY 4.0).
|
|
19
|
+
|
|
20
|
+
It includes code adapted from NVIDIA Isaac-GR00T, Copyright (c) NVIDIA
|
|
21
|
+
CORPORATION & AFFILIATES, licensed under Apache-2.0:
|
|
22
|
+
|
|
23
|
+
- src/gr00t_bonsai/vl_cache/accel.py: the multi-noise training forward is
|
|
24
|
+
adapted from Gr00tN1d7ActionHead.forward
|
|
25
|
+
(gr00t/model/gr00t_n1d7/gr00t_n1d7.py), modified to draw K timesteps and
|
|
26
|
+
noise samples per frame.
|
|
27
|
+
- The data-layer modules that plug into Isaac-GR00T's trainer
|
|
28
|
+
(sharded_dataset.py, episode_loader.py, metadata.py, resumable_mixture.py,
|
|
29
|
+
exact_resume.py, _gr00t_compat.py) mirror the interfaces of the upstream
|
|
30
|
+
dataset and trainer classes and reuse short passages from them.
|
|
31
|
+
|
|
32
|
+
Isaac-GR00T itself is not redistributed; it is imported at run time from the
|
|
33
|
+
user's own checkout.
|
|
34
|
+
|
|
35
|
+
See LICENSE and the License section of README.md.
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gr00t-bonsai
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Fine-tune NVIDIA Isaac-GR00T N1.7 on a single 24 GB GPU — LowMemAdamW (about 7 bytes/param), online multi-noise flow matching, Lance streaming from S3/GCS, and Spot resume that restores the data order.
|
|
5
|
+
Author: gr00t-bonsai contributors
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/hly000/gr00t-bonsai
|
|
8
|
+
Project-URL: Repository, https://github.com/hly000/gr00t-bonsai
|
|
9
|
+
Project-URL: Issues, https://github.com/hly000/gr00t-bonsai/issues
|
|
10
|
+
Project-URL: Benchmarks, https://github.com/hly000/gr00t-bonsai/blob/main/docs/BENCHMARKS.md
|
|
11
|
+
Keywords: robotics,gr00t,vla,low-memory-optimizer,triton,24gb,flow-matching,lerobot,lancedb,spot-training,s3
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
License-File: NOTICE
|
|
25
|
+
Requires-Dist: numpy>=1.24
|
|
26
|
+
Requires-Dist: torch>=2.1
|
|
27
|
+
Provides-Extra: lance
|
|
28
|
+
Requires-Dist: lerobot-lancedb>=0.3.0; extra == "lance"
|
|
29
|
+
Requires-Dist: lancedb>=0.42.0b26; extra == "lance"
|
|
30
|
+
Requires-Dist: pandas>=2.0; extra == "lance"
|
|
31
|
+
Requires-Dist: pyarrow>=15.0; extra == "lance"
|
|
32
|
+
Provides-Extra: s3
|
|
33
|
+
Requires-Dist: gr00t-bonsai[lance]; extra == "s3"
|
|
34
|
+
Requires-Dist: boto3>=1.28; extra == "s3"
|
|
35
|
+
Provides-Extra: gcs
|
|
36
|
+
Requires-Dist: gr00t-bonsai[lance]; extra == "gcs"
|
|
37
|
+
Requires-Dist: gcsfs>=2024.2; extra == "gcs"
|
|
38
|
+
Provides-Extra: cloud
|
|
39
|
+
Requires-Dist: gr00t-bonsai[gcs,s3]; extra == "cloud"
|
|
40
|
+
Provides-Extra: vision
|
|
41
|
+
Requires-Dist: transformers>=4.40; extra == "vision"
|
|
42
|
+
Provides-Extra: plots
|
|
43
|
+
Requires-Dist: matplotlib>=3.7; extra == "plots"
|
|
44
|
+
Provides-Extra: dev
|
|
45
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
46
|
+
Requires-Dist: ruff>=0.8; extra == "dev"
|
|
47
|
+
Requires-Dist: moto[server]>=5.0; extra == "dev"
|
|
48
|
+
Requires-Dist: av>=12.0; extra == "dev"
|
|
49
|
+
Dynamic: license-file
|
|
50
|
+
|
|
51
|
+
<div align="center">
|
|
52
|
+
|
|
53
|
+
# gr00t-bonsai
|
|
54
|
+
|
|
55
|
+
### Fine-tune NVIDIA GR00T N1.7 on one 24 GB GPU
|
|
56
|
+
|
|
57
|
+
NVIDIA recommends 40 GB+ to fine-tune GR00T N1.7: the default recipe peaks at **37 GB**.<br>
|
|
58
|
+
This repo runs it in **18 GB** on an RTX 4090, at the same batch of 32.
|
|
59
|
+
|
|
60
|
+
<p>
|
|
61
|
+
<a href="https://github.com/hly000/gr00t-bonsai/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-Apache--2.0-blue.svg" alt="License: Apache-2.0"></a>
|
|
62
|
+
<img src="https://img.shields.io/badge/Python-3.10%2B-3776AB.svg" alt="Python 3.10+">
|
|
63
|
+
<img src="https://img.shields.io/badge/PyTorch-tested%20on%202.8%20%2F%202.9-EE4C2C.svg" alt="PyTorch: tested on 2.8 and 2.9">
|
|
64
|
+
<a href="https://github.com/hly000/gr00t-bonsai/actions/workflows/tests.yml"><img src="https://github.com/hly000/gr00t-bonsai/actions/workflows/tests.yml/badge.svg" alt="Tests"></a>
|
|
65
|
+
</p>
|
|
66
|
+
|
|
67
|
+
**English** · [简体中文](https://github.com/hly000/gr00t-bonsai/blob/main/README_ZH.md) · [Results](https://github.com/hly000/gr00t-bonsai/blob/main/docs/RESULTS.md) · [Benchmarks](https://github.com/hly000/gr00t-bonsai/blob/main/docs/BENCHMARKS.md) · [Limitations](https://github.com/hly000/gr00t-bonsai/blob/main/docs/LIMITATIONS.md) · [FAQ](https://github.com/hly000/gr00t-bonsai/blob/main/docs/FAQ.md)
|
|
68
|
+
|
|
69
|
+
<img src="https://raw.githubusercontent.com/hly000/gr00t-bonsai/main/docs/assets/fig1_hero_summary.png" width="860" alt="Peak GPU memory (stock 37.0 and 39.2 GiB, this repo 18.2 and 20.6 GiB) and LIBERO-10 success after 3,000 steps (72.3 vs 72.0 with one noise draw, 83.0 vs 83.7 with two), stock on an A100 and this repo on an RTX 4090">
|
|
70
|
+
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
| | Stock Isaac-GR00T | This repo |
|
|
74
|
+
|---|---|---|
|
|
75
|
+
| Peak GPU memory, batch 32 | 37.0 GB on an A100, out of memory on 24 GB | **18.2 GB** on an RTX 4090 |
|
|
76
|
+
| LIBERO-10, 3,000 steps, 3 seeds | 72.3 % | 72.0 % |
|
|
77
|
+
| Same, with this repo's two noise draws per frame (`K=2`) | 83 % with fp32 AdamW, 32 × 2 in one pass (1 seed, 39.2 GB) | 83.7 % with 16 × 2 accumulated twice (3 seeds, 20.6 GB) |
|
|
78
|
+
| Weights + gradients + optimizer state | 16 bytes/param | 7.07 bytes/param (`FlashAdamW-24`: 7.14) |
|
|
79
|
+
| Batches a preempted run sees after resuming | 0/50 match the uninterrupted run | 50/50 match |
|
|
80
|
+
|
|
81
|
+
**The claim is memory, not accuracy.** In these runs the 24 GB recipe scored the same as stock, not better. Each score is 100 episodes (10 per task, about ±9 points), stock was evaluated on an A100 and this repo on an RTX 4090, and three seeds cannot rule out a gap under about 10 points. "Stock" means upstream's trainer with fp32 AdamW, started through this repo's launcher on the same dataset. Memory is in GiB as `nvidia-smi` reports it. Every number comes from a file in [`results/`](https://github.com/hly000/gr00t-bonsai/tree/main/results): see the [results ledger](https://github.com/hly000/gr00t-bonsai/blob/main/docs/RESULTS.md) and the [limitations](https://github.com/hly000/gr00t-bonsai/blob/main/docs/LIMITATIONS.md).
|
|
82
|
+
|
|
83
|
+
## What is new here, and what is not
|
|
84
|
+
|
|
85
|
+
- **Fitting N1.7 in 24 GB is not new.** [gr00t-on-4090](https://github.com/VShirokun/gr00t-on-4090) does it in about 21 GiB with paged 8-bit Adam, a bf16 load and gradient checkpointing, and evaluates on its own SO-101 task. In our probes `bitsandbytes.AdamW8bit` on fp32 weights also fits: 20.1 GB at 16 frames per step and 22.5 GB at 16 × 2. We did not probe it at 32 frames, where it probably fits too. Against that route this repo offers more headroom and a faster optimizer step. It has not been shown to be more accurate.
|
|
86
|
+
- **The optimizer builds on [FlashOptim](https://arxiv.org/abs/2602.23349).** FlashOptim already takes AdamW from 16 to 7 bytes per parameter with 8-bit moments. The int8 weight compensation here is its weight splitting, and `FlashAdamW-24` fits this job just as well (18.3 GB, 481 ms/step against 18.2 GB, 469 ms). What differs is the encoding of the two moments. The only closed-loop comparison is one batch-16 run each, 38/100 for `FlashAdamW` and 46/100 for `LowMemAdamW`, which is within noise.
|
|
87
|
+
- **`K=2` is a known technique** (the `diffusion_batch_mul` of [MAR](https://github.com/LTH14/mar), [Mini Diffuser](https://arxiv.org/abs/2505.09430)). The gain does not come from the memory work: the one fp32 run with `K=2` also scored 83.
|
|
88
|
+
- **What this repo adds:** the 24 GB recipe measured over three seeds, a seeded LIBERO evaluator that runs one process per episode, a Lance data layer for GR00T, and resume that restores the data order. It also has optional per-block DiT activation checkpointing (upstream declares a `gradient_checkpointing` flag that its forward pass never reads); that is used in one memory probe and in none of the published runs.
|
|
89
|
+
|
|
90
|
+
## Quickstart
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
pip install gr00t-bonsai # torch and numpy only
|
|
94
|
+
|
|
95
|
+
# or from a clone:
|
|
96
|
+
git clone https://github.com/hly000/gr00t-bonsai && cd gr00t-bonsai
|
|
97
|
+
pip install -e . # torch and numpy only
|
|
98
|
+
python examples/standalone_lowmem_adamw.py # the optimizer on a toy model, CPU or GPU, under a minute
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Fine-tune GR00T on 24 GB
|
|
102
|
+
|
|
103
|
+
Needs one 24 GB NVIDIA GPU and [Isaac-GR00T](https://github.com/NVIDIA/Isaac-GR00T) checked out at `$GR00T_ROOT` ([full requirements](https://github.com/hly000/gr00t-bonsai/blob/main/docs/LIMITATIONS.md#requirements)). It trains what upstream trains by default: the projector and DiT action head (1.62B parameters), with the VLM frozen.
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
MODE=lowmem24_b32 EMA_DECAY=0 MAX_STEPS=3000 TRAIN_SEED=42 N_EPISODES=10 \
|
|
107
|
+
DATASET=/data/datasets/libero_10_lance bash scripts/run_online_turbo.sh
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
| `MODE` | Frames × noise draws | Peak memory (RTX 4090) | 3,000 steps take | LIBERO-10, 3 seeds |
|
|
111
|
+
|---|---|---:|---:|---:|
|
|
112
|
+
| `lowmem24_b32` | 32 × 1 | 18.2 GB | 28 min | 72.0 % |
|
|
113
|
+
| `lowmem24_mn2_ga2` | 16 × 2, accumulated twice | 20.6 GB | 32 min | 83.7 % |
|
|
114
|
+
|
|
115
|
+
The script checks the kernel, runs a 5-step smoke test, trains, then runs the seeded LIBERO-10 evaluation. The checkpoint loads in upstream `run_gr00t_server.py`. It reads a Lance dataset by default, which needs the install in [the data section](#stream-from-s3-or-gcs-resume-in-the-same-data-order). The Isaac-GR00T commit used for these runs was not recorded, and the launcher patches upstream at run time, so a newer upstream may need fixes.
|
|
116
|
+
|
|
117
|
+
One 20,000-step run reached 90/100. NVIDIA's released LIBERO checkpoint scored 85 on the same evaluator and 91 and 93 on an A100, so read this as in the same range, not as a win: it is one seed with no 20,000-step stock baseline.
|
|
118
|
+
|
|
119
|
+
## Use the optimizer anywhere
|
|
120
|
+
|
|
121
|
+
`LowMemAdamW` works with any PyTorch model that has `bfloat16` weights. It does not need GR00T or Lance.
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
import torch
|
|
125
|
+
from gr00t_bonsai import LowMemAdamW
|
|
126
|
+
|
|
127
|
+
for p in model.parameters():
|
|
128
|
+
if p.ndim >= 2:
|
|
129
|
+
p.data = p.data.to(torch.bfloat16) # this snippet keeps 1-D parameters in fp32
|
|
130
|
+
|
|
131
|
+
optimizer = LowMemAdamW(model.parameters(), lr=1e-4, weight_decay=1e-5, comp_dtype="int8")
|
|
132
|
+
|
|
133
|
+
with torch.autocast("cuda", dtype=torch.bfloat16):
|
|
134
|
+
loss = model(batch)
|
|
135
|
+
loss.backward()
|
|
136
|
+
_, scale = optimizer.clip_scale(max_norm=1.0) # global-norm clip without rewriting the grads
|
|
137
|
+
optimizer.step(grad_scale=scale)
|
|
138
|
+
optimizer.zero_grad(set_to_none=True)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
`comp_dtype="int8"` is what the 24 GB modes use; the default `"bf16"` takes one more byte per parameter. On the 1.62B-parameter action head (RTX 4090) it is level with `FlashAdamW-24`: 22.35 ms/step and 7.07 bytes/param against 23.18 ms and 7.14. `bitsandbytes.AdamW8bit` takes 47.90 ms at 10.05 bytes/param on fp32 weights. [Full table](https://github.com/hly000/gr00t-bonsai/blob/main/docs/RESULTS.md#optimizer-microbenchmark-537-action-head-tensors-162b-parameters) · [runnable example with EMA](https://github.com/hly000/gr00t-bonsai/blob/main/examples/standalone_lowmem_adamw.py)
|
|
142
|
+
|
|
143
|
+
## Stream from S3 or GCS, resume in the same data order
|
|
144
|
+
|
|
145
|
+
Train from object storage with no download first. After a Spot preemption, the resumed run reads the same batches the uninterrupted run would have (50/50 batch fingerprints matched in one 80-step test; stock reseeds its loader). This is a guarantee about data order, not about bit-identical weights.
|
|
146
|
+
|
|
147
|
+
The `[lance]` extra (and `[s3]`, `[gcs]`, `[cloud]`) depends on `lancedb>=0.42.0b26`, which is a prerelease — the latest stable version on PyPI is 0.41.0. Install with `--pre` (or uv's `--prerelease=allow`):
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
pip install --pre "gr00t-bonsai[lance]"
|
|
151
|
+
# or, for S3 and GCS as well:
|
|
152
|
+
pip install --pre "gr00t-bonsai[cloud]"
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
From a clone, the full stack used in the published runs is:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
uv pip install --prerelease=allow --extra-index-url https://pypi.fury.io/lancedb/ \
|
|
159
|
+
"git+https://github.com/lancedb/lerobot-lancedb.git#egg=lerobot-lancedb[s3]" \
|
|
160
|
+
"lerobot[dataset]>=0.7.0" "lancedb>=0.42.0b26" -e ".[cloud]"
|
|
161
|
+
|
|
162
|
+
# convert a GR00T v2.1 dataset (videos are referenced, not copied)
|
|
163
|
+
gr00t-lance-convert --src s3://my-bucket/my-v2-dataset --out s3://my-bucket/my-v2-lance --video-mode external
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
The training script above reads Lance through [`scripts/launch_finetune_lance.py`](https://github.com/hly000/gr00t-bonsai/blob/main/scripts/launch_finetune_lance.py). Measurements: [Benchmarks](https://github.com/hly000/gr00t-bonsai/blob/main/docs/BENCHMARKS.md#lance-data-layer-spot-resume-and-curation-a100).
|
|
167
|
+
|
|
168
|
+
## How it works
|
|
169
|
+
|
|
170
|
+
<div align="center">
|
|
171
|
+
<img src="https://raw.githubusercontent.com/hly000/gr00t-bonsai/main/docs/assets/architecture.png" width="820" alt="24 GB fine-tuning pipeline: Lance dataset, frozen bf16 VLM backbone, K noise draws per frame, the trainable action head, LowMemAdamW, and optional DiT activation checkpointing">
|
|
172
|
+
</div>
|
|
173
|
+
|
|
174
|
+
- **`LowMemAdamW`** stores weights in bf16 and carries the rounding error of each update in one int8 per weight (FlashOptim's scheme). The second moment is an 8-bit code with a 5-bit exponent and 3-bit mantissa, the first moment is stored as `m/√v` in int8, and both use stochastic rounding.
|
|
175
|
+
- **Multi-noise flow matching** runs the frozen VLM once per batch and trains the action head on `K` stratified timesteps and noise draws per frame.
|
|
176
|
+
- **DiT activation checkpointing** (5 in the figure) is optional and off in the published modes.
|
|
177
|
+
- **`CpuShadowEMA`** keeps an optional fp32 EMA in host RAM instead of on the GPU.
|
|
178
|
+
|
|
179
|
+
Isaac-GR00T is not forked or patched on disk: everything is applied at run time.
|
|
180
|
+
|
|
181
|
+
## Limitations
|
|
182
|
+
|
|
183
|
+
- Measured only on GR00T N1.7-3B with the VLM frozen, on LIBERO-10 and one LIBERO-Spatial run.
|
|
184
|
+
- Evaluations are 100 episodes, not the usual 500, and rollouts are not deterministic: the same checkpoint with the same seeds differed on 12 of 100 episodes.
|
|
185
|
+
- The stock and 24 GB arms were trained and evaluated on different machines.
|
|
186
|
+
- Memory figures are 30-step probes, not peaks over a full run.
|
|
187
|
+
- `K=2` costs about 17 % more training time and comes bundled with stratified timestep sampling. Neither an equal-compute `K=1` baseline nor that ablation has been run.
|
|
188
|
+
- Keep 32 frames per optimizer step. In one run at the same step count, a batch of 16 scored 36 against 75.
|
|
189
|
+
- The Triton kernel is tested against the CPU reference on a GPU, but CI runs on CPU only.
|
|
190
|
+
|
|
191
|
+
The full list, with negative results and the differences from upstream, is in [docs/LIMITATIONS.md](https://github.com/hly000/gr00t-bonsai/blob/main/docs/LIMITATIONS.md). Commands that reproduce every table are in [docs/BENCHMARKS.md](https://github.com/hly000/gr00t-bonsai/blob/main/docs/BENCHMARKS.md#reproduction-commands).
|
|
192
|
+
|
|
193
|
+
## Citation
|
|
194
|
+
|
|
195
|
+
```bibtex
|
|
196
|
+
@software{gr00t_bonsai_2026,
|
|
197
|
+
title = {gr00t-bonsai: 24 GB single-GPU fine-tuning, Lance streaming and Spot resume for NVIDIA Isaac-GR00T},
|
|
198
|
+
author = {{gr00t-bonsai contributors}},
|
|
199
|
+
year = {2026},
|
|
200
|
+
url = {https://github.com/hly000/gr00t-bonsai}
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
If you use the optimizer, please also cite [FlashOptim](https://arxiv.org/abs/2602.23349).
|
|
205
|
+
|
|
206
|
+
## Acknowledgments
|
|
207
|
+
|
|
208
|
+
Built on [NVIDIA Isaac-GR00T](https://github.com/NVIDIA/Isaac-GR00T), [Hugging Face LeRobot](https://github.com/huggingface/lerobot) and [lerobot-lancedb](https://github.com/lancedb/lerobot-lancedb), and evaluated with [LIBERO](https://github.com/Lifelong-Robot-Learning/LIBERO). Parts of the code are adapted from Isaac-GR00T (Apache-2.0); see [NOTICE](https://github.com/hly000/gr00t-bonsai/blob/main/NOTICE). The optimizer follows [FlashOptim](https://github.com/databricks/flashoptim) for weight compensation and uses it and [bitsandbytes](https://github.com/bitsandbytes-foundation/bitsandbytes) as baselines; no code from either is included.
|
|
209
|
+
|
|
210
|
+
Contributions are welcome: see [CONTRIBUTING.md](https://github.com/hly000/gr00t-bonsai/blob/main/CONTRIBUTING.md) and the [changelog](https://github.com/hly000/gr00t-bonsai/blob/main/CHANGELOG.md).
|
|
211
|
+
|
|
212
|
+
## License
|
|
213
|
+
|
|
214
|
+
The code in this repository is licensed under [Apache-2.0](https://github.com/hly000/gr00t-bonsai/blob/main/LICENSE). See also [NOTICE](https://github.com/hly000/gr00t-bonsai/blob/main/NOTICE).
|
|
215
|
+
|
|
216
|
+
- **NVIDIA Isaac-GR00T** (runtime dependency): the upstream *code* is Apache-2.0. **Model weights** such as `nvidia/GR00T-N1.7-3B` are licensed separately under the [NVIDIA Open Model License](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/). You must accept that license to download and use the weights; this repository's Apache-2.0 license does not grant it.
|
|
217
|
+
- **LIBERO** (evaluation): the [LIBERO](https://github.com/Lifelong-Robot-Learning/LIBERO) *codebase* is MIT; the demonstration *datasets* are [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
|
|
218
|
+
|
|
219
|
+
This project is independent and is not affiliated with or endorsed by NVIDIA or LanceDB.
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# gr00t-bonsai
|
|
4
|
+
|
|
5
|
+
### Fine-tune NVIDIA GR00T N1.7 on one 24 GB GPU
|
|
6
|
+
|
|
7
|
+
NVIDIA recommends 40 GB+ to fine-tune GR00T N1.7: the default recipe peaks at **37 GB**.<br>
|
|
8
|
+
This repo runs it in **18 GB** on an RTX 4090, at the same batch of 32.
|
|
9
|
+
|
|
10
|
+
<p>
|
|
11
|
+
<a href="https://github.com/hly000/gr00t-bonsai/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-Apache--2.0-blue.svg" alt="License: Apache-2.0"></a>
|
|
12
|
+
<img src="https://img.shields.io/badge/Python-3.10%2B-3776AB.svg" alt="Python 3.10+">
|
|
13
|
+
<img src="https://img.shields.io/badge/PyTorch-tested%20on%202.8%20%2F%202.9-EE4C2C.svg" alt="PyTorch: tested on 2.8 and 2.9">
|
|
14
|
+
<a href="https://github.com/hly000/gr00t-bonsai/actions/workflows/tests.yml"><img src="https://github.com/hly000/gr00t-bonsai/actions/workflows/tests.yml/badge.svg" alt="Tests"></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
**English** · [简体中文](https://github.com/hly000/gr00t-bonsai/blob/main/README_ZH.md) · [Results](https://github.com/hly000/gr00t-bonsai/blob/main/docs/RESULTS.md) · [Benchmarks](https://github.com/hly000/gr00t-bonsai/blob/main/docs/BENCHMARKS.md) · [Limitations](https://github.com/hly000/gr00t-bonsai/blob/main/docs/LIMITATIONS.md) · [FAQ](https://github.com/hly000/gr00t-bonsai/blob/main/docs/FAQ.md)
|
|
18
|
+
|
|
19
|
+
<img src="https://raw.githubusercontent.com/hly000/gr00t-bonsai/main/docs/assets/fig1_hero_summary.png" width="860" alt="Peak GPU memory (stock 37.0 and 39.2 GiB, this repo 18.2 and 20.6 GiB) and LIBERO-10 success after 3,000 steps (72.3 vs 72.0 with one noise draw, 83.0 vs 83.7 with two), stock on an A100 and this repo on an RTX 4090">
|
|
20
|
+
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
| | Stock Isaac-GR00T | This repo |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| Peak GPU memory, batch 32 | 37.0 GB on an A100, out of memory on 24 GB | **18.2 GB** on an RTX 4090 |
|
|
26
|
+
| LIBERO-10, 3,000 steps, 3 seeds | 72.3 % | 72.0 % |
|
|
27
|
+
| Same, with this repo's two noise draws per frame (`K=2`) | 83 % with fp32 AdamW, 32 × 2 in one pass (1 seed, 39.2 GB) | 83.7 % with 16 × 2 accumulated twice (3 seeds, 20.6 GB) |
|
|
28
|
+
| Weights + gradients + optimizer state | 16 bytes/param | 7.07 bytes/param (`FlashAdamW-24`: 7.14) |
|
|
29
|
+
| Batches a preempted run sees after resuming | 0/50 match the uninterrupted run | 50/50 match |
|
|
30
|
+
|
|
31
|
+
**The claim is memory, not accuracy.** In these runs the 24 GB recipe scored the same as stock, not better. Each score is 100 episodes (10 per task, about ±9 points), stock was evaluated on an A100 and this repo on an RTX 4090, and three seeds cannot rule out a gap under about 10 points. "Stock" means upstream's trainer with fp32 AdamW, started through this repo's launcher on the same dataset. Memory is in GiB as `nvidia-smi` reports it. Every number comes from a file in [`results/`](https://github.com/hly000/gr00t-bonsai/tree/main/results): see the [results ledger](https://github.com/hly000/gr00t-bonsai/blob/main/docs/RESULTS.md) and the [limitations](https://github.com/hly000/gr00t-bonsai/blob/main/docs/LIMITATIONS.md).
|
|
32
|
+
|
|
33
|
+
## What is new here, and what is not
|
|
34
|
+
|
|
35
|
+
- **Fitting N1.7 in 24 GB is not new.** [gr00t-on-4090](https://github.com/VShirokun/gr00t-on-4090) does it in about 21 GiB with paged 8-bit Adam, a bf16 load and gradient checkpointing, and evaluates on its own SO-101 task. In our probes `bitsandbytes.AdamW8bit` on fp32 weights also fits: 20.1 GB at 16 frames per step and 22.5 GB at 16 × 2. We did not probe it at 32 frames, where it probably fits too. Against that route this repo offers more headroom and a faster optimizer step. It has not been shown to be more accurate.
|
|
36
|
+
- **The optimizer builds on [FlashOptim](https://arxiv.org/abs/2602.23349).** FlashOptim already takes AdamW from 16 to 7 bytes per parameter with 8-bit moments. The int8 weight compensation here is its weight splitting, and `FlashAdamW-24` fits this job just as well (18.3 GB, 481 ms/step against 18.2 GB, 469 ms). What differs is the encoding of the two moments. The only closed-loop comparison is one batch-16 run each, 38/100 for `FlashAdamW` and 46/100 for `LowMemAdamW`, which is within noise.
|
|
37
|
+
- **`K=2` is a known technique** (the `diffusion_batch_mul` of [MAR](https://github.com/LTH14/mar), [Mini Diffuser](https://arxiv.org/abs/2505.09430)). The gain does not come from the memory work: the one fp32 run with `K=2` also scored 83.
|
|
38
|
+
- **What this repo adds:** the 24 GB recipe measured over three seeds, a seeded LIBERO evaluator that runs one process per episode, a Lance data layer for GR00T, and resume that restores the data order. It also has optional per-block DiT activation checkpointing (upstream declares a `gradient_checkpointing` flag that its forward pass never reads); that is used in one memory probe and in none of the published runs.
|
|
39
|
+
|
|
40
|
+
## Quickstart
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install gr00t-bonsai # torch and numpy only
|
|
44
|
+
|
|
45
|
+
# or from a clone:
|
|
46
|
+
git clone https://github.com/hly000/gr00t-bonsai && cd gr00t-bonsai
|
|
47
|
+
pip install -e . # torch and numpy only
|
|
48
|
+
python examples/standalone_lowmem_adamw.py # the optimizer on a toy model, CPU or GPU, under a minute
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Fine-tune GR00T on 24 GB
|
|
52
|
+
|
|
53
|
+
Needs one 24 GB NVIDIA GPU and [Isaac-GR00T](https://github.com/NVIDIA/Isaac-GR00T) checked out at `$GR00T_ROOT` ([full requirements](https://github.com/hly000/gr00t-bonsai/blob/main/docs/LIMITATIONS.md#requirements)). It trains what upstream trains by default: the projector and DiT action head (1.62B parameters), with the VLM frozen.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
MODE=lowmem24_b32 EMA_DECAY=0 MAX_STEPS=3000 TRAIN_SEED=42 N_EPISODES=10 \
|
|
57
|
+
DATASET=/data/datasets/libero_10_lance bash scripts/run_online_turbo.sh
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
| `MODE` | Frames × noise draws | Peak memory (RTX 4090) | 3,000 steps take | LIBERO-10, 3 seeds |
|
|
61
|
+
|---|---|---:|---:|---:|
|
|
62
|
+
| `lowmem24_b32` | 32 × 1 | 18.2 GB | 28 min | 72.0 % |
|
|
63
|
+
| `lowmem24_mn2_ga2` | 16 × 2, accumulated twice | 20.6 GB | 32 min | 83.7 % |
|
|
64
|
+
|
|
65
|
+
The script checks the kernel, runs a 5-step smoke test, trains, then runs the seeded LIBERO-10 evaluation. The checkpoint loads in upstream `run_gr00t_server.py`. It reads a Lance dataset by default, which needs the install in [the data section](#stream-from-s3-or-gcs-resume-in-the-same-data-order). The Isaac-GR00T commit used for these runs was not recorded, and the launcher patches upstream at run time, so a newer upstream may need fixes.
|
|
66
|
+
|
|
67
|
+
One 20,000-step run reached 90/100. NVIDIA's released LIBERO checkpoint scored 85 on the same evaluator and 91 and 93 on an A100, so read this as in the same range, not as a win: it is one seed with no 20,000-step stock baseline.
|
|
68
|
+
|
|
69
|
+
## Use the optimizer anywhere
|
|
70
|
+
|
|
71
|
+
`LowMemAdamW` works with any PyTorch model that has `bfloat16` weights. It does not need GR00T or Lance.
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
import torch
|
|
75
|
+
from gr00t_bonsai import LowMemAdamW
|
|
76
|
+
|
|
77
|
+
for p in model.parameters():
|
|
78
|
+
if p.ndim >= 2:
|
|
79
|
+
p.data = p.data.to(torch.bfloat16) # this snippet keeps 1-D parameters in fp32
|
|
80
|
+
|
|
81
|
+
optimizer = LowMemAdamW(model.parameters(), lr=1e-4, weight_decay=1e-5, comp_dtype="int8")
|
|
82
|
+
|
|
83
|
+
with torch.autocast("cuda", dtype=torch.bfloat16):
|
|
84
|
+
loss = model(batch)
|
|
85
|
+
loss.backward()
|
|
86
|
+
_, scale = optimizer.clip_scale(max_norm=1.0) # global-norm clip without rewriting the grads
|
|
87
|
+
optimizer.step(grad_scale=scale)
|
|
88
|
+
optimizer.zero_grad(set_to_none=True)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`comp_dtype="int8"` is what the 24 GB modes use; the default `"bf16"` takes one more byte per parameter. On the 1.62B-parameter action head (RTX 4090) it is level with `FlashAdamW-24`: 22.35 ms/step and 7.07 bytes/param against 23.18 ms and 7.14. `bitsandbytes.AdamW8bit` takes 47.90 ms at 10.05 bytes/param on fp32 weights. [Full table](https://github.com/hly000/gr00t-bonsai/blob/main/docs/RESULTS.md#optimizer-microbenchmark-537-action-head-tensors-162b-parameters) · [runnable example with EMA](https://github.com/hly000/gr00t-bonsai/blob/main/examples/standalone_lowmem_adamw.py)
|
|
92
|
+
|
|
93
|
+
## Stream from S3 or GCS, resume in the same data order
|
|
94
|
+
|
|
95
|
+
Train from object storage with no download first. After a Spot preemption, the resumed run reads the same batches the uninterrupted run would have (50/50 batch fingerprints matched in one 80-step test; stock reseeds its loader). This is a guarantee about data order, not about bit-identical weights.
|
|
96
|
+
|
|
97
|
+
The `[lance]` extra (and `[s3]`, `[gcs]`, `[cloud]`) depends on `lancedb>=0.42.0b26`, which is a prerelease — the latest stable version on PyPI is 0.41.0. Install with `--pre` (or uv's `--prerelease=allow`):
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
pip install --pre "gr00t-bonsai[lance]"
|
|
101
|
+
# or, for S3 and GCS as well:
|
|
102
|
+
pip install --pre "gr00t-bonsai[cloud]"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
From a clone, the full stack used in the published runs is:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
uv pip install --prerelease=allow --extra-index-url https://pypi.fury.io/lancedb/ \
|
|
109
|
+
"git+https://github.com/lancedb/lerobot-lancedb.git#egg=lerobot-lancedb[s3]" \
|
|
110
|
+
"lerobot[dataset]>=0.7.0" "lancedb>=0.42.0b26" -e ".[cloud]"
|
|
111
|
+
|
|
112
|
+
# convert a GR00T v2.1 dataset (videos are referenced, not copied)
|
|
113
|
+
gr00t-lance-convert --src s3://my-bucket/my-v2-dataset --out s3://my-bucket/my-v2-lance --video-mode external
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The training script above reads Lance through [`scripts/launch_finetune_lance.py`](https://github.com/hly000/gr00t-bonsai/blob/main/scripts/launch_finetune_lance.py). Measurements: [Benchmarks](https://github.com/hly000/gr00t-bonsai/blob/main/docs/BENCHMARKS.md#lance-data-layer-spot-resume-and-curation-a100).
|
|
117
|
+
|
|
118
|
+
## How it works
|
|
119
|
+
|
|
120
|
+
<div align="center">
|
|
121
|
+
<img src="https://raw.githubusercontent.com/hly000/gr00t-bonsai/main/docs/assets/architecture.png" width="820" alt="24 GB fine-tuning pipeline: Lance dataset, frozen bf16 VLM backbone, K noise draws per frame, the trainable action head, LowMemAdamW, and optional DiT activation checkpointing">
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
- **`LowMemAdamW`** stores weights in bf16 and carries the rounding error of each update in one int8 per weight (FlashOptim's scheme). The second moment is an 8-bit code with a 5-bit exponent and 3-bit mantissa, the first moment is stored as `m/√v` in int8, and both use stochastic rounding.
|
|
125
|
+
- **Multi-noise flow matching** runs the frozen VLM once per batch and trains the action head on `K` stratified timesteps and noise draws per frame.
|
|
126
|
+
- **DiT activation checkpointing** (5 in the figure) is optional and off in the published modes.
|
|
127
|
+
- **`CpuShadowEMA`** keeps an optional fp32 EMA in host RAM instead of on the GPU.
|
|
128
|
+
|
|
129
|
+
Isaac-GR00T is not forked or patched on disk: everything is applied at run time.
|
|
130
|
+
|
|
131
|
+
## Limitations
|
|
132
|
+
|
|
133
|
+
- Measured only on GR00T N1.7-3B with the VLM frozen, on LIBERO-10 and one LIBERO-Spatial run.
|
|
134
|
+
- Evaluations are 100 episodes, not the usual 500, and rollouts are not deterministic: the same checkpoint with the same seeds differed on 12 of 100 episodes.
|
|
135
|
+
- The stock and 24 GB arms were trained and evaluated on different machines.
|
|
136
|
+
- Memory figures are 30-step probes, not peaks over a full run.
|
|
137
|
+
- `K=2` costs about 17 % more training time and comes bundled with stratified timestep sampling. Neither an equal-compute `K=1` baseline nor that ablation has been run.
|
|
138
|
+
- Keep 32 frames per optimizer step. In one run at the same step count, a batch of 16 scored 36 against 75.
|
|
139
|
+
- The Triton kernel is tested against the CPU reference on a GPU, but CI runs on CPU only.
|
|
140
|
+
|
|
141
|
+
The full list, with negative results and the differences from upstream, is in [docs/LIMITATIONS.md](https://github.com/hly000/gr00t-bonsai/blob/main/docs/LIMITATIONS.md). Commands that reproduce every table are in [docs/BENCHMARKS.md](https://github.com/hly000/gr00t-bonsai/blob/main/docs/BENCHMARKS.md#reproduction-commands).
|
|
142
|
+
|
|
143
|
+
## Citation
|
|
144
|
+
|
|
145
|
+
```bibtex
|
|
146
|
+
@software{gr00t_bonsai_2026,
|
|
147
|
+
title = {gr00t-bonsai: 24 GB single-GPU fine-tuning, Lance streaming and Spot resume for NVIDIA Isaac-GR00T},
|
|
148
|
+
author = {{gr00t-bonsai contributors}},
|
|
149
|
+
year = {2026},
|
|
150
|
+
url = {https://github.com/hly000/gr00t-bonsai}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
If you use the optimizer, please also cite [FlashOptim](https://arxiv.org/abs/2602.23349).
|
|
155
|
+
|
|
156
|
+
## Acknowledgments
|
|
157
|
+
|
|
158
|
+
Built on [NVIDIA Isaac-GR00T](https://github.com/NVIDIA/Isaac-GR00T), [Hugging Face LeRobot](https://github.com/huggingface/lerobot) and [lerobot-lancedb](https://github.com/lancedb/lerobot-lancedb), and evaluated with [LIBERO](https://github.com/Lifelong-Robot-Learning/LIBERO). Parts of the code are adapted from Isaac-GR00T (Apache-2.0); see [NOTICE](https://github.com/hly000/gr00t-bonsai/blob/main/NOTICE). The optimizer follows [FlashOptim](https://github.com/databricks/flashoptim) for weight compensation and uses it and [bitsandbytes](https://github.com/bitsandbytes-foundation/bitsandbytes) as baselines; no code from either is included.
|
|
159
|
+
|
|
160
|
+
Contributions are welcome: see [CONTRIBUTING.md](https://github.com/hly000/gr00t-bonsai/blob/main/CONTRIBUTING.md) and the [changelog](https://github.com/hly000/gr00t-bonsai/blob/main/CHANGELOG.md).
|
|
161
|
+
|
|
162
|
+
## License
|
|
163
|
+
|
|
164
|
+
The code in this repository is licensed under [Apache-2.0](https://github.com/hly000/gr00t-bonsai/blob/main/LICENSE). See also [NOTICE](https://github.com/hly000/gr00t-bonsai/blob/main/NOTICE).
|
|
165
|
+
|
|
166
|
+
- **NVIDIA Isaac-GR00T** (runtime dependency): the upstream *code* is Apache-2.0. **Model weights** such as `nvidia/GR00T-N1.7-3B` are licensed separately under the [NVIDIA Open Model License](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/). You must accept that license to download and use the weights; this repository's Apache-2.0 license does not grant it.
|
|
167
|
+
- **LIBERO** (evaluation): the [LIBERO](https://github.com/Lifelong-Robot-Learning/LIBERO) *codebase* is MIT; the demonstration *datasets* are [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
|
|
168
|
+
|
|
169
|
+
This project is independent and is not affiliated with or endorsed by NVIDIA or LanceDB.
|