vlagents 0.0.1__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.
vlagents-0.0.1/LICENSE ADDED
@@ -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,231 @@
1
+ Metadata-Version: 2.4
2
+ Name: vlagents
3
+ Version: 0.0.1
4
+ Summary: Modular VLA and Environment interfaces.
5
+ Author-email: Tobias Jülg <tobias.juelg@utn.de>
6
+ Maintainer-email: Tobias Jülg <tobias.juelg@utn.de>
7
+ License-Expression: Apache-2.0
8
+ Project-URL: Homepage, https://github.com/RobotControlStack/vlagents
9
+ Project-URL: Issues, https://github.com/RobotControlStack/vlagents/issues
10
+ Classifier: Programming Language :: Python :: 3
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: rpyc
15
+ Requires-Dist: numpy
16
+ Requires-Dist: json_numpy
17
+ Requires-Dist: gymnasium
18
+ Requires-Dist: typer
19
+ Requires-Dist: simple-slurm
20
+ Requires-Dist: wandb
21
+ Requires-Dist: pillow
22
+ Requires-Dist: tqdm
23
+ Requires-Dist: simplejpeg
24
+ Provides-Extra: dev
25
+ Requires-Dist: ruff; extra == "dev"
26
+ Requires-Dist: black; extra == "dev"
27
+ Requires-Dist: isort; extra == "dev"
28
+ Requires-Dist: mypy; extra == "dev"
29
+ Requires-Dist: build; extra == "dev"
30
+ Requires-Dist: pytest; extra == "dev"
31
+ Requires-Dist: commitizen; extra == "dev"
32
+ Dynamic: license-file
33
+
34
+ # VLAgents
35
+ VLAgents is a python library that allows to separate next action prediction from policy networks from action execution in simulated or real environments.
36
+ It defines an interface for policies and for environments.
37
+ The policies run independent in their own virtual environment, potentially on a different computer, and can be queried for an action (in principle similar to the chatgpt api).
38
+
39
+ Why is this useful?
40
+ - Separation of dependencies by using two different python environments: Some times dependencies contradict e.g. pytorch and jax
41
+ - Some robot hardware requires a real time linux kernel which does not easily allow you to use an Nvidia GPU.
42
+ - Separate deployment and model code
43
+
44
+ This library is a byproduct of the [Refined Policy Distillation (RPD)](https://refined-policy-distillation.github.io/) paper which distilled VLAs into expert policies using Reinforcement Learning.
45
+ The work also includes a section on related engineering challenges regarding jax and pytorch.
46
+
47
+ ## Installation
48
+
49
+ ### Local Installation
50
+ ```shell
51
+ git clone https://github.com/juelg/vlagents.git
52
+ cd vlagents
53
+ pip install -ve .
54
+ ```
55
+
56
+ ### Repo Installation
57
+ ```shell
58
+ pip install git+https://github.com/juelg/vlagents.git
59
+ ```
60
+
61
+ ### Environment and Policy Installation
62
+ On top of vlagents you can then install a simulation environment where the agent acts.
63
+ We currently support [maniskill](https://github.com/haosulab/ManiSkill) with more to come.
64
+ In order to avoid dependency conflicts, use a second conda/pip environment to install your policy.
65
+ We currently support [octo](https://github.com/octo-models/octo) and [openvla](https://github.com/openvla/openvla).
66
+
67
+ ### Octo
68
+ To use Octo as an agent/policy you need to create a new conda environment:
69
+ ```shell
70
+ conda create -n octo python=3.10
71
+ conda activate octo
72
+ conda install nvidia/label/cuda-11.8.0::cuda --no-channel-priority
73
+ conda install conda-forge::cudnn=8.9
74
+ # octo dependencies
75
+ pip install git+https://github.com/octo-models/octo.git@241fb3514b7c40957a86d869fecb7c7fc353f540
76
+ pip install -r vlagents/utils/fixed_octo_requirements.txt
77
+ # for gpu support:
78
+ pip install --upgrade "jax[cuda11_pip]==0.4.20" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
79
+ ```
80
+
81
+ Verify that the jax installation was successful and that jax finds your gpu.
82
+ Open a python shell in the same conda env and type
83
+ ```python
84
+ from jax.lib import xla_bridge
85
+ # this should output "gpu" if the gpu installation was successful
86
+ print(xla_bridge.get_backend().platform)
87
+ ```
88
+
89
+
90
+ Install the vlagents library on top:
91
+ ```shell
92
+ pip install git+https://github.com/juelg/vlagents.git
93
+ ```
94
+
95
+ For more details, see the [Octo github page](https://github.com/octo-models/octo).
96
+
97
+ #### Troubleshooting
98
+ If pip conplains about dependency issues than it might have happened that torch somehow slipped in.
99
+ Check if you have any torch packages installed by
100
+ ```shell
101
+ pip freeze | grep torch
102
+ # if any, uninstall them e.g.
103
+ pip uninstall arm_pytorch_utilities
104
+ pip uninstall pytorch-seed
105
+ pip uninstall pytorch_kinematics
106
+ ```
107
+
108
+ ### OpenVLA
109
+ To use OpenVLA, create a new conda environment:
110
+ ```shell
111
+ conda create -n openvla python=3.10 -y
112
+ conda activate openvla
113
+ conda install pytorch torchvision torchaudio pytorch-cuda=12.4 -c pytorch -c nvidia -y
114
+ ```
115
+
116
+ Install [flash attention](https://github.com/Dao-AILab/flash-attention):
117
+ ```shell
118
+ pip install packaging ninja
119
+ ninja --version; echo $? # Verify Ninja --> should return exit code "0"
120
+ pip install "flash-attn==2.5.5" --no-build-isolation
121
+ # if you run into issues try `pip cache remove flash_attn` first
122
+ ```
123
+
124
+ Install OpenVLA
125
+ ```shell
126
+ pip install git+https://github.com/openvla/openvla.git@46b752f477cc5773cc1234b2e82c0e2130e4e890
127
+ ```
128
+
129
+ Install the vlagents library on top:
130
+ ```shell
131
+ pip install git+https://github.com/juelg/vlagents.git
132
+ ```
133
+
134
+ For more details, see the [OpenVLA github page](https://github.com/openvla/openvla).
135
+
136
+ ### OpenPi / Pi0
137
+ To use OpenPi, create a new conda environment:
138
+ ```shell
139
+ conda create -n openpi python=3.11 -y
140
+ conda activate openpi
141
+ ```
142
+ Clone the repo and install it.
143
+ ```shell
144
+ git clone --recurse-submodules git@github.com:Physical-Intelligence/openpi.git
145
+ # Or if you already cloned the repo:
146
+ git submodule update --init --recursive
147
+ # install dependencies
148
+ GIT_LFS_SKIP_SMUDGE=1 uv sync
149
+ GIT_LFS_SKIP_SMUDGE=1 uv pip install -e .
150
+ ```
151
+ For more details see [openpi's github](https://github.com/Physical-Intelligence/openpi).
152
+
153
+ ### vjEPA2-ac
154
+ To use VJEPA2-AC, create a new conda environment:
155
+ ```shell
156
+ conda create -n vjepa2 python=3.12
157
+ conda activate vjepa2
158
+ ```
159
+ Clone the repo and install it.
160
+ ```shell
161
+ git clone git@github.com:facebookresearch/vjepa2.git
162
+ cd vjepa2
163
+ pip install -e .
164
+
165
+ pip install git+https://github.com/juelg/vlagents.git
166
+ pip install -ve .
167
+
168
+ ```
169
+
170
+ ## Usage
171
+ To start an vlagents server use the `start-server` command where `kwargs` is a dictionary of the constructor arguments of the policy you want to start e.g.
172
+ ```shell
173
+ # octo
174
+ python -m vlagents start-server octo --host localhost --port 8080 --kwargs '{"checkpoint_path": "hf://Juelg/octo-base-1.5-finetuned-maniskill", "checkpoint_step": None, "horizon": 1, "unnorm_key": []}'
175
+
176
+ # openvla
177
+ python -m vlagents start-server openvla --host localhost --port 8080 --kwargs '{"checkpoint_path": "Juelg/openvla-7b-finetuned-maniskill", "device": "cuda:0", "attn_implementation": "flash_attention_2", "unnorm_key": "maniskill_human:7.0.0", "checkpoint_step": 40000}'
178
+
179
+ # openpi
180
+ python -m vlagents start-server openpi --port=8080 --host=localhost --kwargs='{"checkpoint_path": "<path to checkpoint>/{checkpoint_step}", "model_name": "pi0_rcs", "checkpoint_step": <checkpoint_step>}' # leave "{checkpoint_step}" it will be replaced, "model_name" is the key for the training config
181
+
182
+ # vjepa2-ac
183
+ python -m vlagents start-server vjepa --port=20997 --host=0.0.0.0 --kwargs='{"cfg_path": "configs/inference/vjepa2-ac-vitg/<your_config>.yaml", "model_name": "vjepa2_ac_vit_giant", "default_checkpoint_path": "../.cache/torch/hub/checkpoints/vjepa2-ac-vitg.pt"}'
184
+ ```
185
+
186
+
187
+ There is also the `run-eval-during-training` command to evaluate a model during training, so a single checkpoint.
188
+ The `run-eval-post-training` command evaluates a range of checkpoints in parallel.
189
+ In both cases environment and arguments as well as policy and arguments and wandb config for logging can be passed as CLI arguments.
190
+
191
+
192
+ ## Contribution
193
+
194
+ ### New Policy
195
+ In order to extend the library with a new policy network, extend the `Agent` class in [policies.py](src/vlagents/policies.py).
196
+ It is important to only invoke policy specific imports in the class functions, as each policy can have its own dependencies.
197
+
198
+
199
+ ### New Environment
200
+ In order to extend the library with a new agent environment, extend the `EvaluatorEnv` class in [evaluator_envs.py](src/vlagents/evaluator_envs.py).
201
+
202
+
203
+ ### Developer Tools
204
+ Install the following dev dependencies:
205
+ ```shell
206
+ pip install -ve '.[dev]'
207
+ ```
208
+
209
+ The following dev tools are provided:
210
+ ```shell
211
+ # format the code
212
+ make format
213
+
214
+ # lint the code
215
+ make lint
216
+
217
+ # run tests
218
+ make test
219
+ ```
220
+
221
+ ## Citation
222
+ If you find the agent useful for your work, please consider citing the original work behind it:
223
+ ```
224
+ @inproceedings{juelg2025refinedpolicydistillationvla,
225
+ title={{Refined Policy Distillation}: {F}rom {VLA} Generalists to {RL} Experts},
226
+ author={Tobias Jülg and Wolfram Burgard and Florian Walter},
227
+ year={2025},
228
+ booktitle={Proc.~of the IEEE/RSJ Int.~Conf.~on Intelligent Robots and Systems (IROS)},
229
+ note={Accepted for publication.}
230
+ }
231
+ ```
@@ -0,0 +1,198 @@
1
+ # VLAgents
2
+ VLAgents is a python library that allows to separate next action prediction from policy networks from action execution in simulated or real environments.
3
+ It defines an interface for policies and for environments.
4
+ The policies run independent in their own virtual environment, potentially on a different computer, and can be queried for an action (in principle similar to the chatgpt api).
5
+
6
+ Why is this useful?
7
+ - Separation of dependencies by using two different python environments: Some times dependencies contradict e.g. pytorch and jax
8
+ - Some robot hardware requires a real time linux kernel which does not easily allow you to use an Nvidia GPU.
9
+ - Separate deployment and model code
10
+
11
+ This library is a byproduct of the [Refined Policy Distillation (RPD)](https://refined-policy-distillation.github.io/) paper which distilled VLAs into expert policies using Reinforcement Learning.
12
+ The work also includes a section on related engineering challenges regarding jax and pytorch.
13
+
14
+ ## Installation
15
+
16
+ ### Local Installation
17
+ ```shell
18
+ git clone https://github.com/juelg/vlagents.git
19
+ cd vlagents
20
+ pip install -ve .
21
+ ```
22
+
23
+ ### Repo Installation
24
+ ```shell
25
+ pip install git+https://github.com/juelg/vlagents.git
26
+ ```
27
+
28
+ ### Environment and Policy Installation
29
+ On top of vlagents you can then install a simulation environment where the agent acts.
30
+ We currently support [maniskill](https://github.com/haosulab/ManiSkill) with more to come.
31
+ In order to avoid dependency conflicts, use a second conda/pip environment to install your policy.
32
+ We currently support [octo](https://github.com/octo-models/octo) and [openvla](https://github.com/openvla/openvla).
33
+
34
+ ### Octo
35
+ To use Octo as an agent/policy you need to create a new conda environment:
36
+ ```shell
37
+ conda create -n octo python=3.10
38
+ conda activate octo
39
+ conda install nvidia/label/cuda-11.8.0::cuda --no-channel-priority
40
+ conda install conda-forge::cudnn=8.9
41
+ # octo dependencies
42
+ pip install git+https://github.com/octo-models/octo.git@241fb3514b7c40957a86d869fecb7c7fc353f540
43
+ pip install -r vlagents/utils/fixed_octo_requirements.txt
44
+ # for gpu support:
45
+ pip install --upgrade "jax[cuda11_pip]==0.4.20" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
46
+ ```
47
+
48
+ Verify that the jax installation was successful and that jax finds your gpu.
49
+ Open a python shell in the same conda env and type
50
+ ```python
51
+ from jax.lib import xla_bridge
52
+ # this should output "gpu" if the gpu installation was successful
53
+ print(xla_bridge.get_backend().platform)
54
+ ```
55
+
56
+
57
+ Install the vlagents library on top:
58
+ ```shell
59
+ pip install git+https://github.com/juelg/vlagents.git
60
+ ```
61
+
62
+ For more details, see the [Octo github page](https://github.com/octo-models/octo).
63
+
64
+ #### Troubleshooting
65
+ If pip conplains about dependency issues than it might have happened that torch somehow slipped in.
66
+ Check if you have any torch packages installed by
67
+ ```shell
68
+ pip freeze | grep torch
69
+ # if any, uninstall them e.g.
70
+ pip uninstall arm_pytorch_utilities
71
+ pip uninstall pytorch-seed
72
+ pip uninstall pytorch_kinematics
73
+ ```
74
+
75
+ ### OpenVLA
76
+ To use OpenVLA, create a new conda environment:
77
+ ```shell
78
+ conda create -n openvla python=3.10 -y
79
+ conda activate openvla
80
+ conda install pytorch torchvision torchaudio pytorch-cuda=12.4 -c pytorch -c nvidia -y
81
+ ```
82
+
83
+ Install [flash attention](https://github.com/Dao-AILab/flash-attention):
84
+ ```shell
85
+ pip install packaging ninja
86
+ ninja --version; echo $? # Verify Ninja --> should return exit code "0"
87
+ pip install "flash-attn==2.5.5" --no-build-isolation
88
+ # if you run into issues try `pip cache remove flash_attn` first
89
+ ```
90
+
91
+ Install OpenVLA
92
+ ```shell
93
+ pip install git+https://github.com/openvla/openvla.git@46b752f477cc5773cc1234b2e82c0e2130e4e890
94
+ ```
95
+
96
+ Install the vlagents library on top:
97
+ ```shell
98
+ pip install git+https://github.com/juelg/vlagents.git
99
+ ```
100
+
101
+ For more details, see the [OpenVLA github page](https://github.com/openvla/openvla).
102
+
103
+ ### OpenPi / Pi0
104
+ To use OpenPi, create a new conda environment:
105
+ ```shell
106
+ conda create -n openpi python=3.11 -y
107
+ conda activate openpi
108
+ ```
109
+ Clone the repo and install it.
110
+ ```shell
111
+ git clone --recurse-submodules git@github.com:Physical-Intelligence/openpi.git
112
+ # Or if you already cloned the repo:
113
+ git submodule update --init --recursive
114
+ # install dependencies
115
+ GIT_LFS_SKIP_SMUDGE=1 uv sync
116
+ GIT_LFS_SKIP_SMUDGE=1 uv pip install -e .
117
+ ```
118
+ For more details see [openpi's github](https://github.com/Physical-Intelligence/openpi).
119
+
120
+ ### vjEPA2-ac
121
+ To use VJEPA2-AC, create a new conda environment:
122
+ ```shell
123
+ conda create -n vjepa2 python=3.12
124
+ conda activate vjepa2
125
+ ```
126
+ Clone the repo and install it.
127
+ ```shell
128
+ git clone git@github.com:facebookresearch/vjepa2.git
129
+ cd vjepa2
130
+ pip install -e .
131
+
132
+ pip install git+https://github.com/juelg/vlagents.git
133
+ pip install -ve .
134
+
135
+ ```
136
+
137
+ ## Usage
138
+ To start an vlagents server use the `start-server` command where `kwargs` is a dictionary of the constructor arguments of the policy you want to start e.g.
139
+ ```shell
140
+ # octo
141
+ python -m vlagents start-server octo --host localhost --port 8080 --kwargs '{"checkpoint_path": "hf://Juelg/octo-base-1.5-finetuned-maniskill", "checkpoint_step": None, "horizon": 1, "unnorm_key": []}'
142
+
143
+ # openvla
144
+ python -m vlagents start-server openvla --host localhost --port 8080 --kwargs '{"checkpoint_path": "Juelg/openvla-7b-finetuned-maniskill", "device": "cuda:0", "attn_implementation": "flash_attention_2", "unnorm_key": "maniskill_human:7.0.0", "checkpoint_step": 40000}'
145
+
146
+ # openpi
147
+ python -m vlagents start-server openpi --port=8080 --host=localhost --kwargs='{"checkpoint_path": "<path to checkpoint>/{checkpoint_step}", "model_name": "pi0_rcs", "checkpoint_step": <checkpoint_step>}' # leave "{checkpoint_step}" it will be replaced, "model_name" is the key for the training config
148
+
149
+ # vjepa2-ac
150
+ python -m vlagents start-server vjepa --port=20997 --host=0.0.0.0 --kwargs='{"cfg_path": "configs/inference/vjepa2-ac-vitg/<your_config>.yaml", "model_name": "vjepa2_ac_vit_giant", "default_checkpoint_path": "../.cache/torch/hub/checkpoints/vjepa2-ac-vitg.pt"}'
151
+ ```
152
+
153
+
154
+ There is also the `run-eval-during-training` command to evaluate a model during training, so a single checkpoint.
155
+ The `run-eval-post-training` command evaluates a range of checkpoints in parallel.
156
+ In both cases environment and arguments as well as policy and arguments and wandb config for logging can be passed as CLI arguments.
157
+
158
+
159
+ ## Contribution
160
+
161
+ ### New Policy
162
+ In order to extend the library with a new policy network, extend the `Agent` class in [policies.py](src/vlagents/policies.py).
163
+ It is important to only invoke policy specific imports in the class functions, as each policy can have its own dependencies.
164
+
165
+
166
+ ### New Environment
167
+ In order to extend the library with a new agent environment, extend the `EvaluatorEnv` class in [evaluator_envs.py](src/vlagents/evaluator_envs.py).
168
+
169
+
170
+ ### Developer Tools
171
+ Install the following dev dependencies:
172
+ ```shell
173
+ pip install -ve '.[dev]'
174
+ ```
175
+
176
+ The following dev tools are provided:
177
+ ```shell
178
+ # format the code
179
+ make format
180
+
181
+ # lint the code
182
+ make lint
183
+
184
+ # run tests
185
+ make test
186
+ ```
187
+
188
+ ## Citation
189
+ If you find the agent useful for your work, please consider citing the original work behind it:
190
+ ```
191
+ @inproceedings{juelg2025refinedpolicydistillationvla,
192
+ title={{Refined Policy Distillation}: {F}rom {VLA} Generalists to {RL} Experts},
193
+ author={Tobias Jülg and Wolfram Burgard and Florian Walter},
194
+ year={2025},
195
+ booktitle={Proc.~of the IEEE/RSJ Int.~Conf.~on Intelligent Robots and Systems (IROS)},
196
+ note={Accepted for publication.}
197
+ }
198
+ ```