Publish sealed evaluation sources, batch 1
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitignore +7 -0
- Makefile +23 -0
- README_dinov3.md +882 -0
- README_starVLA.md +446 -0
- THIRD_PARTY_NOTICES.md +25 -0
- TRAINING_PROVENANCE.md +54 -0
- VALIDATION.md +222 -0
- checkpoints/README.md +9 -0
- deployment/__init__.py +0 -0
- deployment/model_server/README.md +22 -0
- deployment/model_server/__init__.py +0 -0
- deployment/model_server/server_policy.py +70 -0
- deployment/model_server/tools/__init__.py +0 -0
- deployment/model_server/tools/debug_server_policy.py +91 -0
- deployment/model_server/tools/image_tools.py +119 -0
- deployment/model_server/tools/msgpack_numpy.py +57 -0
- deployment/model_server/tools/websocket_policy_client.py +77 -0
- deployment/model_server/tools/websocket_policy_server.py +179 -0
- deployment/readme-deployment.md +11 -0
- deployment/real_infer/open_loop_eval.py +315 -0
- deployment/real_infer/server.py +332 -0
- deployment/upload/push_model_to_hf.py +12 -0
- deployment_robotwin/__init__.py +0 -0
- deployment_robotwin/model_server/README.md +22 -0
- deployment_robotwin/model_server/__init__.py +0 -0
- deployment_robotwin/model_server/server_policy.py +91 -0
- deployment_robotwin/model_server/tools/.ipynb_checkpoints/websocket_policy_client-checkpoint.py +149 -0
- deployment_robotwin/model_server/tools/.ipynb_checkpoints/websocket_policy_server-checkpoint.py +207 -0
- deployment_robotwin/model_server/tools/__init__.py +0 -0
- deployment_robotwin/model_server/tools/debug_server_policy.py +91 -0
- deployment_robotwin/model_server/tools/image_tools.py +119 -0
- deployment_robotwin/model_server/tools/msgpack_numpy.py +57 -0
- deployment_robotwin/model_server/tools/websocket_policy_client.py +149 -0
- deployment_robotwin/model_server/tools/websocket_policy_server.py +207 -0
- deployment_robotwin/readme-deployment.md +11 -0
- deployment_robotwin/real_infer/open_loop_eval.py +418 -0
- deployment_robotwin/real_infer/server.py +375 -0
- deployment_robotwin/upload/push_model_to_hf.py +12 -0
- docs/WM4A.md +154 -0
- environment/README.md +67 -0
- environment/build_kdl.sh +27 -0
- environment/create_linux_envs.sh +31 -0
- environment/policy.requirements.txt +24 -0
- environment/robocasa.observed.json +1288 -0
- environment/simulation.requirements.txt +31 -0
- environment/starVLA_1.observed.json +1309 -0
- examples/Behavior/README.md +98 -0
- examples/Behavior/adaptive_ensemble.py +104 -0
- examples/Behavior/custom_argparse.py +43 -0
- examples/Behavior/model2behavior_interface.py +384 -0
.gitignore
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.runtime/
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.pyc
|
| 4 |
+
.DS_Store
|
| 5 |
+
.env
|
| 6 |
+
*.token
|
| 7 |
+
.cache/
|
Makefile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.PHONY: help clean check autoformat
|
| 2 |
+
.DEFAULT: help
|
| 3 |
+
|
| 4 |
+
# Generates a useful overview/help message for various make features - add to this as necessary!
|
| 5 |
+
help:
|
| 6 |
+
@echo "make clean"
|
| 7 |
+
@echo " Remove all temporary pyc/pycache files"
|
| 8 |
+
@echo "make check"
|
| 9 |
+
@echo " Run code style and linting (black, ruff) *without* changing files!"
|
| 10 |
+
@echo "make autoformat"
|
| 11 |
+
@echo " Run code styling (black, ruff) and update in place - committing with pre-commit also does this."
|
| 12 |
+
|
| 13 |
+
clean:
|
| 14 |
+
find . -name "*.pyc" | xargs rm -f && \
|
| 15 |
+
find . -name "__pycache__" | xargs rm -rf
|
| 16 |
+
|
| 17 |
+
check:
|
| 18 |
+
black --check .
|
| 19 |
+
ruff check --show-source .
|
| 20 |
+
|
| 21 |
+
autoformat:
|
| 22 |
+
black .
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
:new: [2026-03-10] :fire: The [Canopy Height Maps v2 (CHMv2) model](https://arxiv.org/abs/2603.06382) and inference code are now available (more details on downloading the model weights and using the code [here](#canopy-height-maps-v2-chmv2)). The model weights are also available in [Hugging Face Hub](https://huggingface.co/facebook/dinov3-vitl16-chmv2-dpt-head) and [supported](https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/chmv2.md) by the Hugging Face [Transformers](https://huggingface.co/docs/transformers/index) library. Building on our original high-resolution canopy height maps released in 2024, CHMv2 delivers substantial improvements in accuracy, detail, and global consistency by leveraging DINOv3.
|
| 2 |
+
|
| 3 |
+
[2025-11-20] Distillation code and configurations for ConvNeXt backbones are now released!
|
| 4 |
+
|
| 5 |
+
[2025-10-13] [Semantic segmentation](https://github.com/facebookresearch/dinov3?tab=readme-ov-file#linear-segmentation-with-data-augmentation-on-ade20k) (ADE20K) and [monocular depth estimation](https://github.com/facebookresearch/dinov3?tab=readme-ov-file#linear-depth-estimation-on-nyuv2-depth) (NYUv2-Depth) linear probing code are now released!
|
| 6 |
+
|
| 7 |
+
[2025-09-17] DINOv3 backbones are now supported by the [PyTorch Image Models / timm](https://github.com/huggingface/pytorch-image-models/) library starting with version [1.0.20](https://github.com/huggingface/pytorch-image-models/releases/tag/v1.0.20)
|
| 8 |
+
|
| 9 |
+
[2025-08-29] DINOv3 backbones are [supported](https://huggingface.co/docs/transformers/model_doc/dinov3) by released versions of the Hugging Face [Transformers](https://huggingface.co/docs/transformers/index) library starting with version [4.56.0](https://github.com/huggingface/transformers/releases/tag/v4.56.0)
|
| 10 |
+
|
| 11 |
+
[2025-08-14] DINOv3 backbones are now available in [Hugging Face Hub](https://huggingface.co/collections/facebook/dinov3-68924841bd6b561778e31009) and [supported](https://huggingface.co/docs/transformers/model_doc/dinov3) by the [development](https://github.com/huggingface/transformers/) version of the Hugging Face [Transformers](https://huggingface.co/docs/transformers/index) library
|
| 12 |
+
|
| 13 |
+
# DINOv3 🦖🦖🦖
|
| 14 |
+
|
| 15 |
+
**[Meta AI Research, FAIR](https://ai.meta.com/research/)**
|
| 16 |
+
|
| 17 |
+
Oriane Siméoni, Huy V. Vo, Maximilian Seitzer, Federico Baldassarre, Maxime Oquab, <br/>
|
| 18 |
+
Cijo Jose, Vasil Khalidov, Marc Szafraniec, Seungeun Yi, Michaël Ramamonjisoa, <br/>
|
| 19 |
+
Francisco Massa, Daniel Haziza, Luca Wehrstedt, Jianyuan Wang, <br/>
|
| 20 |
+
Timothée Darcet, Théo Moutakanni, Leonel Sentana, Claire Roberts, <br/>
|
| 21 |
+
Andrea Vedaldi, Jamie Tolan, John Brandt, Camille Couprie, <br/>
|
| 22 |
+
Julien Mairal, Hervé Jégou, Patrick Labatut, Piotr Bojanowski
|
| 23 |
+
|
| 24 |
+
[ :scroll: [`Paper`](https://arxiv.org/abs/2508.10104)] [ :newspaper: [`Blog`](https://ai.meta.com/blog/dinov3-self-supervised-vision-model/)] [ :globe_with_meridians: [`Website`](https://ai.meta.com/dinov3/)] [ :book: [`BibTeX`](#citing-dinov3)]
|
| 25 |
+
|
| 26 |
+
Reference PyTorch implementation and models for DINOv3. For details, see the **[DINOv3](https://arxiv.org/abs/2508.10104)** paper.
|
| 27 |
+
|
| 28 |
+
## Overview
|
| 29 |
+
|
| 30 |
+
<div align="center">
|
| 31 |
+
<img width="1364" height="1024" alt="market" src="https://github.com/user-attachments/assets/1411f491-988e-49cb-95ae-d03fe6e3c268" />
|
| 32 |
+
|
| 33 |
+
<i></em><b>High-resolution dense features.</b><br/>We visualize the cosine similarity maps obtained with DINOv3 output features<br/> between the patches marked with a red cross and all other patches.</i>
|
| 34 |
+
</div>
|
| 35 |
+
|
| 36 |
+
<br/>
|
| 37 |
+
|
| 38 |
+
An extended family of versatile vision foundation models producing high-quality dense features and achieving outstanding performance on various vision tasks including outperforming the specialized state of the art across a broad range of settings, without fine-tuning
|
| 39 |
+
|
| 40 |
+
## Pretrained models
|
| 41 |
+
|
| 42 |
+
:information_source: Please follow the link provided below to get access to all the model weights: once accepted, an e-mail will be sent with the complete list of URLs pointing to all the available model weights (both backbones and adapters). These URLs can then be used to either:
|
| 43 |
+
- download the model or adapter weights to a local filesystem and point `torch.hub.load()` to these local weights via the `weights` or `backbone_weights` parameters, or
|
| 44 |
+
- directly invoke `torch.hub.load()` to download and load a backbone or an adapter from its URL via also the `weights` or `backbone_weights` parameters.
|
| 45 |
+
|
| 46 |
+
See the example code snippets below.
|
| 47 |
+
|
| 48 |
+
:warning: Please use `wget` instead of a web browser to download the weights.
|
| 49 |
+
|
| 50 |
+
ViT models pretrained on web dataset (LVD-1689M):
|
| 51 |
+
<table style="margin: auto">
|
| 52 |
+
<thead>
|
| 53 |
+
<tr>
|
| 54 |
+
<th>Model</th>
|
| 55 |
+
<th>Parameters</th>
|
| 56 |
+
<th>Pretraining<br/>Dataset</th>
|
| 57 |
+
<th>Download</th>
|
| 58 |
+
</tr>
|
| 59 |
+
</thead>
|
| 60 |
+
<tbody>
|
| 61 |
+
<tr>
|
| 62 |
+
<td>ViT-S/16 distilled </td>
|
| 63 |
+
<td align="right">21M</td>
|
| 64 |
+
<td align="center">LVD-1689M</td>
|
| 65 |
+
<td align="center"><a href="https://ai.meta.com/resources/models-and-libraries/dinov3-downloads/">[link]</a></td>
|
| 66 |
+
</tr>
|
| 67 |
+
<tr>
|
| 68 |
+
<td>ViT-S+/16 distilled</td>
|
| 69 |
+
<td align="right">29M</td>
|
| 70 |
+
<td align="center">LVD-1689M</td>
|
| 71 |
+
<td align="center"><a href="https://ai.meta.com/resources/models-and-libraries/dinov3-downloads/">[link]</a></td>
|
| 72 |
+
</tr>
|
| 73 |
+
<tr>
|
| 74 |
+
<td>ViT-B/16 distilled</td>
|
| 75 |
+
<td align="right">86M</td>
|
| 76 |
+
<td align="center">LVD-1689M</td>
|
| 77 |
+
<td align="center"><a href="https://ai.meta.com/resources/models-and-libraries/dinov3-downloads/">[link]</a></td>
|
| 78 |
+
</tr>
|
| 79 |
+
<tr>
|
| 80 |
+
<td>ViT-L/16 distilled</td>
|
| 81 |
+
<td align="right">300M</td>
|
| 82 |
+
<td align="center">LVD-1689M</td>
|
| 83 |
+
<td align="center"><a href="https://ai.meta.com/resources/models-and-libraries/dinov3-downloads/">[link]</a></td>
|
| 84 |
+
</tr>
|
| 85 |
+
<tr>
|
| 86 |
+
<td>ViT-H+/16 distilled</td>
|
| 87 |
+
<td align="right">840M</td>
|
| 88 |
+
<td align="center">LVD-1689M</td>
|
| 89 |
+
<td align="center"><a href="https://ai.meta.com/resources/models-and-libraries/dinov3-downloads/">[link]</a></td>
|
| 90 |
+
</tr>
|
| 91 |
+
<tr>
|
| 92 |
+
<td>ViT-7B/16</td>
|
| 93 |
+
<td align="right">6,716M</td>
|
| 94 |
+
<td align="center">LVD-1689M</td>
|
| 95 |
+
<td align="center"><a href="https://ai.meta.com/resources/models-and-libraries/dinov3-downloads/">[link]</a></td>
|
| 96 |
+
</tr>
|
| 97 |
+
</tbody>
|
| 98 |
+
</table>
|
| 99 |
+
|
| 100 |
+
ConvNeXt models pretrained on web dataset (LVD-1689M):
|
| 101 |
+
<table style="margin: auto">
|
| 102 |
+
<thead>
|
| 103 |
+
<tr>
|
| 104 |
+
<th>Model</th>
|
| 105 |
+
<th>Parameters</th>
|
| 106 |
+
<th>Pretraining<br/>Dataset</th>
|
| 107 |
+
<th>Download</th>
|
| 108 |
+
</tr>
|
| 109 |
+
</thead>
|
| 110 |
+
<tbody>
|
| 111 |
+
<tr>
|
| 112 |
+
<td>ConvNeXt Tiny</td>
|
| 113 |
+
<td align="right">29M</td>
|
| 114 |
+
<td align="center">LVD-1689M</td>
|
| 115 |
+
<td align="center"><a href="https://ai.meta.com/resources/models-and-libraries/dinov3-downloads/">[link]</a></td>
|
| 116 |
+
</tr>
|
| 117 |
+
<tr>
|
| 118 |
+
<td>ConvNeXt Small</td>
|
| 119 |
+
<td align="right">50M</td>
|
| 120 |
+
<td align="center">LVD-1689M</td>
|
| 121 |
+
<td align="center"><a href="https://ai.meta.com/resources/models-and-libraries/dinov3-downloads/">[link]</a></td>
|
| 122 |
+
</tr>
|
| 123 |
+
<tr>
|
| 124 |
+
<td>ConvNeXt Base</td>
|
| 125 |
+
<td align="right">89M</td>
|
| 126 |
+
<td align="center">LVD-1689M</td>
|
| 127 |
+
<td align="center"><a href="https://ai.meta.com/resources/models-and-libraries/dinov3-downloads/">[link]</a></td>
|
| 128 |
+
</tr>
|
| 129 |
+
<tr>
|
| 130 |
+
<td>ConvNeXt Large</td>
|
| 131 |
+
<td align="right">198M</td>
|
| 132 |
+
<td align="center">LVD-1689M</td>
|
| 133 |
+
<td align="center"><a href="https://ai.meta.com/resources/models-and-libraries/dinov3-downloads/">[link]</a></td>
|
| 134 |
+
</tr>
|
| 135 |
+
</tbody>
|
| 136 |
+
</table>
|
| 137 |
+
|
| 138 |
+
ViT models pretrained on satellite dataset (SAT-493M):
|
| 139 |
+
<table style="margin: auto">
|
| 140 |
+
<thead>
|
| 141 |
+
<tr>
|
| 142 |
+
<th>Model</th>
|
| 143 |
+
<th>Parameters</th>
|
| 144 |
+
<th>Pretraining<br/>Dataset</th>
|
| 145 |
+
<th>Download</th>
|
| 146 |
+
</tr>
|
| 147 |
+
</thead>
|
| 148 |
+
<tbody>
|
| 149 |
+
<tr>
|
| 150 |
+
<td>ViT-L/16 distilled</td>
|
| 151 |
+
<td align="right">300M</td>
|
| 152 |
+
<td align="center">SAT-493M</td>
|
| 153 |
+
<td align="center"><a href="https://ai.meta.com/resources/models-and-libraries/dinov3-downloads/">[link]</a></td>
|
| 154 |
+
</tr>
|
| 155 |
+
<tr>
|
| 156 |
+
<td>ViT-7B/16</td>
|
| 157 |
+
<td align="right">6,716M</td>
|
| 158 |
+
<td align="center">SAT-493M</td>
|
| 159 |
+
<td align="center"><a href="https://ai.meta.com/resources/models-and-libraries/dinov3-downloads/">[link]</a></td>
|
| 160 |
+
</tr>
|
| 161 |
+
</tbody>
|
| 162 |
+
</table>
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
### Pretrained backbones (via PyTorch [Hub](https://docs.pytorch.org/docs/stable/hub.html))
|
| 166 |
+
|
| 167 |
+
Please follow the instructions [here](https://pytorch.org/get-started/locally/) to install PyTorch (the only required dependency for loading the model). Installing PyTorch with CUDA support is strongly recommended.
|
| 168 |
+
|
| 169 |
+
```python
|
| 170 |
+
import torch
|
| 171 |
+
|
| 172 |
+
REPO_DIR = <PATH/TO/A/LOCAL/DIRECTORY/WHERE/THE/DINOV3/REPO/WAS/CLONED>
|
| 173 |
+
|
| 174 |
+
# DINOv3 ViT models pretrained on web images
|
| 175 |
+
dinov3_vits16 = torch.hub.load(REPO_DIR, 'dinov3_vits16', source='local', weights=<CHECKPOINT/URL/OR/PATH>)
|
| 176 |
+
dinov3_vits16plus = torch.hub.load(REPO_DIR, 'dinov3_vits16plus', source='local', weights=<CHECKPOINT/URL/OR/PATH>)
|
| 177 |
+
dinov3_vitb16 = torch.hub.load(REPO_DIR, 'dinov3_vitb16', source='local', weights=<CHECKPOINT/URL/OR/PATH>)
|
| 178 |
+
dinov3_vitl16 = torch.hub.load(REPO_DIR, 'dinov3_vitl16', source='local', weights=<CHECKPOINT/URL/OR/PATH>)
|
| 179 |
+
dinov3_vith16plus = torch.hub.load(REPO_DIR, 'dinov3_vith16plus', source='local', weights=<CHECKPOINT/URL/OR/PATH>)
|
| 180 |
+
dinov3_vit7b16 = torch.hub.load(REPO_DIR, 'dinov3_vit7b16', source='local', weights=<CHECKPOINT/URL/OR/PATH>)
|
| 181 |
+
|
| 182 |
+
# DINOv3 ConvNeXt models pretrained on web images
|
| 183 |
+
dinov3_convnext_tiny = torch.hub.load(REPO_DIR, 'dinov3_convnext_tiny', source='local', weights=<CHECKPOINT/URL/OR/PATH>)
|
| 184 |
+
dinov3_convnext_small = torch.hub.load(REPO_DIR, 'dinov3_convnext_small', source='local', weights=<CHECKPOINT/URL/OR/PATH>)
|
| 185 |
+
dinov3_convnext_base = torch.hub.load(REPO_DIR, 'dinov3_convnext_base', source='local', weights=<CHECKPOINT/URL/OR/PATH>)
|
| 186 |
+
dinov3_convnext_large = torch.hub.load(REPO_DIR, 'dinov3_convnext_large', source='local', weights=<CHECKPOINT/URL/OR/PATH>)
|
| 187 |
+
|
| 188 |
+
# DINOv3 ViT models pretrained on satellite imagery
|
| 189 |
+
dinov3_vitl16 = torch.hub.load(REPO_DIR, 'dinov3_vitl16', source='local', weights=<CHECKPOINT/URL/OR/PATH>)
|
| 190 |
+
dinov3_vit7b16 = torch.hub.load(REPO_DIR, 'dinov3_vit7b16', source='local', weights=<CHECKPOINT/URL/OR/PATH>)
|
| 191 |
+
```
|
| 192 |
+
|
| 193 |
+
### Pretrained backbones (via Hugging Face [Transformers](https://huggingface.co/docs/transformers/))
|
| 194 |
+
|
| 195 |
+
All the backbones are available in the [DINOv3](https://huggingface.co/collections/facebook/dinov3-68924841bd6b561778e31009) collection on Hugging Face Hub and supported via the Hugging Face [Transformers](https://huggingface.co/docs/transformers/index) library (with released packages from version 4.56.0). Please refer to the corresponding documentation for usage, but below is a short example that demonstrates how to obtain an image embedding with either [Pipeline] or the [AutoModel] class.
|
| 196 |
+
|
| 197 |
+
```python
|
| 198 |
+
from transformers import pipeline
|
| 199 |
+
from transformers.image_utils import load_image
|
| 200 |
+
|
| 201 |
+
url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
|
| 202 |
+
image = load_image(url)
|
| 203 |
+
|
| 204 |
+
feature_extractor = pipeline(
|
| 205 |
+
model="facebook/dinov3-convnext-tiny-pretrain-lvd1689m",
|
| 206 |
+
task="image-feature-extraction",
|
| 207 |
+
)
|
| 208 |
+
features = feature_extractor(image)
|
| 209 |
+
```
|
| 210 |
+
|
| 211 |
+
```python
|
| 212 |
+
import torch
|
| 213 |
+
from transformers import AutoImageProcessor, AutoModel
|
| 214 |
+
from transformers.image_utils import load_image
|
| 215 |
+
|
| 216 |
+
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
| 217 |
+
image = load_image(url)
|
| 218 |
+
|
| 219 |
+
pretrained_model_name = "facebook/dinov3-convnext-tiny-pretrain-lvd1689m"
|
| 220 |
+
processor = AutoImageProcessor.from_pretrained(pretrained_model_name)
|
| 221 |
+
model = AutoModel.from_pretrained(
|
| 222 |
+
pretrained_model_name,
|
| 223 |
+
device_map="auto",
|
| 224 |
+
)
|
| 225 |
+
|
| 226 |
+
inputs = processor(images=image, return_tensors="pt").to(model.device)
|
| 227 |
+
with torch.inference_mode():
|
| 228 |
+
outputs = model(**inputs)
|
| 229 |
+
|
| 230 |
+
pooled_output = outputs.pooler_output
|
| 231 |
+
print("Pooled output shape:", pooled_output.shape)
|
| 232 |
+
```
|
| 233 |
+
|
| 234 |
+
where `model` and `pretrained_model_name` above can be one of:
|
| 235 |
+
- `facebook/dinov3-vits16-pretrain-lvd1689m`
|
| 236 |
+
- `facebook/dinov3-vits16plus-pretrain-lvd1689m`
|
| 237 |
+
- `facebook/dinov3-vitb16-pretrain-lvd1689m`
|
| 238 |
+
- `facebook/dinov3-vitl16-pretrain-lvd1689m`
|
| 239 |
+
- `facebook/dinov3-vith16plus-pretrain-lvd1689m`
|
| 240 |
+
- `facebook/dinov3-vit7b16-pretrain-lvd1689m`
|
| 241 |
+
- `facebook/dinov3-convnext-base-pretrain-lvd1689m`
|
| 242 |
+
- `facebook/dinov3-convnext-large-pretrain-lvd1689m`
|
| 243 |
+
- `facebook/dinov3-convnext-small-pretrain-lvd1689m`
|
| 244 |
+
- `facebook/dinov3-convnext-tiny-pretrain-lvd1689m`
|
| 245 |
+
- `facebook/dinov3-vitl16-pretrain-sat493m`
|
| 246 |
+
- `facebook/dinov3-vit7b16-pretrain-sat493m`
|
| 247 |
+
|
| 248 |
+
### Image transforms
|
| 249 |
+
|
| 250 |
+
For models using the LVD-1689M weights (pretrained on web images), please use the following transform (standard ImageNet evaluation transform):
|
| 251 |
+
|
| 252 |
+
```python
|
| 253 |
+
import torchvision
|
| 254 |
+
from torchvision.transforms import v2
|
| 255 |
+
|
| 256 |
+
def make_transform(resize_size: int = 256):
|
| 257 |
+
to_tensor = v2.ToImage()
|
| 258 |
+
resize = v2.Resize((resize_size, resize_size), antialias=True)
|
| 259 |
+
to_float = v2.ToDtype(torch.float32, scale=True)
|
| 260 |
+
normalize = v2.Normalize(
|
| 261 |
+
mean=(0.485, 0.456, 0.406),
|
| 262 |
+
std=(0.229, 0.224, 0.225),
|
| 263 |
+
)
|
| 264 |
+
return v2.Compose([to_tensor, resize, to_float, normalize])
|
| 265 |
+
```
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
For models using the SAT-493M weights (pretrained on satellite imagery), please use the following transform:
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
```python
|
| 272 |
+
import torchvision
|
| 273 |
+
from torchvision.transforms import v2
|
| 274 |
+
|
| 275 |
+
def make_transform(resize_size: int = 256):
|
| 276 |
+
to_tensor = v2.ToImage()
|
| 277 |
+
resize = v2.Resize((resize_size, resize_size), antialias=True)
|
| 278 |
+
to_float = v2.ToDtype(torch.float32, scale=True)
|
| 279 |
+
normalize = v2.Normalize(
|
| 280 |
+
mean=(0.430, 0.411, 0.296),
|
| 281 |
+
std=(0.213, 0.156, 0.143),
|
| 282 |
+
)
|
| 283 |
+
return v2.Compose([to_tensor, resize, to_float, normalize])
|
| 284 |
+
```
|
| 285 |
+
|
| 286 |
+
### Pretrained heads - Image classification
|
| 287 |
+
|
| 288 |
+
<table style="margin: auto">
|
| 289 |
+
<thead>
|
| 290 |
+
<tr>
|
| 291 |
+
<th>Backbone</th>
|
| 292 |
+
<th>Pretraining<br/>Dataset</th>
|
| 293 |
+
<th>Head<br/>Dataset</th>
|
| 294 |
+
<th>Download</th>
|
| 295 |
+
</tr>
|
| 296 |
+
</thead>
|
| 297 |
+
<tbody>
|
| 298 |
+
<tr>
|
| 299 |
+
<td>ViT-7B/16</td>
|
| 300 |
+
<td align="center">LVD-1689M</td>
|
| 301 |
+
<td align="center">ImageNet</td>
|
| 302 |
+
<td align="center"><a href="https://ai.meta.com/resources/models-and-libraries/dinov3-downloads/">[link]</a></td>
|
| 303 |
+
</tr>
|
| 304 |
+
</tbody>
|
| 305 |
+
</table>
|
| 306 |
+
|
| 307 |
+
|
| 308 |
+
The (full) classifier models can be loaded via PyTorch Hub:
|
| 309 |
+
|
| 310 |
+
```python
|
| 311 |
+
import torch
|
| 312 |
+
|
| 313 |
+
# DINOv3
|
| 314 |
+
dinov3_vit7b16_lc = torch.hub.load(REPO_DIR, 'dinov3_vit7b16_lc', source="local", weights=<DEPTHER/CHECKPOINT/URL/OR/PATH>, backbone_weights=<BACKBONE/CHECKPOINT/URL/OR/PATH>)
|
| 315 |
+
|
| 316 |
+
```
|
| 317 |
+
|
| 318 |
+
### Pretrained heads - Depther trained on SYNTHMIX dataset
|
| 319 |
+
|
| 320 |
+
<table style="margin: auto">
|
| 321 |
+
<thead>
|
| 322 |
+
<tr>
|
| 323 |
+
<th>Backbone</th>
|
| 324 |
+
<th>Pretraining<br/>Dataset</th>
|
| 325 |
+
<th>Head<br/>Dataset</th>
|
| 326 |
+
<th>Download</th>
|
| 327 |
+
</tr>
|
| 328 |
+
</thead>
|
| 329 |
+
<tbody>
|
| 330 |
+
<tr>
|
| 331 |
+
<td>ViT-7B/16</td>
|
| 332 |
+
<td align="center">LVD-1689M</td>
|
| 333 |
+
<td align="center">SYNTHMIX</td>
|
| 334 |
+
<td align="center"><a href="https://ai.meta.com/resources/models-and-libraries/dinov3-downloads/">[link]</a></td>
|
| 335 |
+
</tr>
|
| 336 |
+
</tbody>
|
| 337 |
+
</table>
|
| 338 |
+
|
| 339 |
+
|
| 340 |
+
```python
|
| 341 |
+
depther = torch.hub.load(REPO_DIR, 'dinov3_vit7b16_dd', source="local", weights=<DEPTHER/CHECKPOINT/URL/OR/PATH>, backbone_weights=<BACKBONE/CHECKPOINT/URL/OR/PATH>)
|
| 342 |
+
```
|
| 343 |
+
|
| 344 |
+
Full example code of depther on an image
|
| 345 |
+
|
| 346 |
+
```python
|
| 347 |
+
from PIL import Image
|
| 348 |
+
import torch
|
| 349 |
+
from torchvision.transforms import v2
|
| 350 |
+
import matplotlib.pyplot as plt
|
| 351 |
+
from matplotlib import colormaps
|
| 352 |
+
|
| 353 |
+
def get_img():
|
| 354 |
+
import requests
|
| 355 |
+
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
| 356 |
+
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
|
| 357 |
+
return image
|
| 358 |
+
|
| 359 |
+
def make_transform(resize_size: int | list[int] = 768):
|
| 360 |
+
to_tensor = v2.ToImage()
|
| 361 |
+
resize = v2.Resize((resize_size, resize_size), antialias=True)
|
| 362 |
+
to_float = v2.ToDtype(torch.float32, scale=True)
|
| 363 |
+
normalize = v2.Normalize(
|
| 364 |
+
mean=(0.485, 0.456, 0.406),
|
| 365 |
+
std=(0.229, 0.224, 0.225),
|
| 366 |
+
)
|
| 367 |
+
return v2.Compose([to_tensor, resize, to_float, normalize])
|
| 368 |
+
|
| 369 |
+
depther = torch.hub.load(REPO_DIR, 'dinov3_vit7b16_dd', source="local", weights=<DEPTHER/CHECKPOINT/URL/OR/PATH>, backbone_weights=<BACKBONE/CHECKPOINT/URL/OR/PATH>)
|
| 370 |
+
|
| 371 |
+
img_size = 1024
|
| 372 |
+
img = get_img()
|
| 373 |
+
transform = make_transform(img_size)
|
| 374 |
+
with torch.inference_mode():
|
| 375 |
+
with torch.autocast('cuda', dtype=torch.bfloat16):
|
| 376 |
+
batch_img = transform(img)[None]
|
| 377 |
+
batch_img = batch_img
|
| 378 |
+
depths = depther(batch_img)
|
| 379 |
+
|
| 380 |
+
plt.figure(figsize=(12, 6))
|
| 381 |
+
plt.subplot(121)
|
| 382 |
+
plt.imshow(img)
|
| 383 |
+
plt.axis("off")
|
| 384 |
+
plt.subplot(122)
|
| 385 |
+
plt.imshow(depths[0,0].cpu(), cmap=colormaps["Spectral"])
|
| 386 |
+
plt.axis("off")
|
| 387 |
+
|
| 388 |
+
```
|
| 389 |
+
|
| 390 |
+
#### Reproduce paper results
|
| 391 |
+
|
| 392 |
+
Make sure the NYU dataset is setup following [this](DATASETS.md#depth-estimation-on-nyu).
|
| 393 |
+
|
| 394 |
+
Launch the following to reproduce our paper's depth estimation results on NYUv2 with the pretrained Depther trained on SYNTHMIX:
|
| 395 |
+
|
| 396 |
+
```shell
|
| 397 |
+
PYTHONPATH=. python -m dinov3.run.submit dinov3/eval/depth/run.py \
|
| 398 |
+
config=dinov3/eval/depth/configs/config-nyu-synthmix-dpt-inference.yaml \
|
| 399 |
+
datasets.root=<PATH/TO/DATASET> \
|
| 400 |
+
load_from=dinov3_vit7b16_dd \
|
| 401 |
+
--output-dir <PATH/TO/OUTPUT/DIR>
|
| 402 |
+
```
|
| 403 |
+
|
| 404 |
+
Notes:
|
| 405 |
+
- if you want to launch the code without dinov3.run.submit, you can do so using python directly or torchrun:
|
| 406 |
+
|
| 407 |
+
```shell
|
| 408 |
+
PYTHONPATH=. python dinov3/eval/depth/run.py \
|
| 409 |
+
config=dinov3/eval/depth/configs/config-nyu-synthmix-dpt-inference.yaml \
|
| 410 |
+
datasets.root=<PATH/TO/DATASET> \
|
| 411 |
+
load_from=dinov3_vit7b16_dd \
|
| 412 |
+
output_dir=<PATH/TO/OUTPUT/DIR>
|
| 413 |
+
```
|
| 414 |
+
|
| 415 |
+
- One can also save prediction results using `result_config.save_results=true`.
|
| 416 |
+
|
| 417 |
+
|
| 418 |
+
### Pretrained heads - Detector trained on COCO2017 dataset
|
| 419 |
+
|
| 420 |
+
<table style="margin: auto">
|
| 421 |
+
<thead>
|
| 422 |
+
<tr>
|
| 423 |
+
<th>Backbone</th>
|
| 424 |
+
<th>Pretraining<br/>Dataset</th>
|
| 425 |
+
<th>Head<br/>Dataset</th>
|
| 426 |
+
<th>Download</th>
|
| 427 |
+
</tr>
|
| 428 |
+
</thead>
|
| 429 |
+
<tbody>
|
| 430 |
+
<tr>
|
| 431 |
+
<td>ViT-7B/16</td>
|
| 432 |
+
<td align="center">LVD-1689M</td>
|
| 433 |
+
<td align="center">COCO2017</td>
|
| 434 |
+
<td align="center"><a href="https://ai.meta.com/resources/models-and-libraries/dinov3-downloads/">[link]</a></td>
|
| 435 |
+
</tr>
|
| 436 |
+
</tbody>
|
| 437 |
+
</table>
|
| 438 |
+
|
| 439 |
+
|
| 440 |
+
```python
|
| 441 |
+
detector = torch.hub.load(REPO_DIR, 'dinov3_vit7b16_de', source="local", weights=<DETECTOR/CHECKPOINT/URL/OR/PATH>, backbone_weights=<BACKBONE/CHECKPOINT/URL/OR/PATH>)
|
| 442 |
+
```
|
| 443 |
+
|
| 444 |
+
### Pretrained heads - Segmentor trained on ADE20K dataset
|
| 445 |
+
|
| 446 |
+
<table style="margin: auto">
|
| 447 |
+
<thead>
|
| 448 |
+
<tr>
|
| 449 |
+
<th>Backbone</th>
|
| 450 |
+
<th>Pretraining<br/>Dataset</th>
|
| 451 |
+
<th>Head<br/>Dataset</th>
|
| 452 |
+
<th>Download</th>
|
| 453 |
+
</tr>
|
| 454 |
+
</thead>
|
| 455 |
+
<tbody>
|
| 456 |
+
<tr>
|
| 457 |
+
<td>ViT-7B/16</td>
|
| 458 |
+
<td align="center">LVD-1689M</td>
|
| 459 |
+
<td align="center">ADE20K</td>
|
| 460 |
+
<td align="center"><a href="https://ai.meta.com/resources/models-and-libraries/dinov3-downloads/">[link]</a></td>
|
| 461 |
+
</tr>
|
| 462 |
+
</tbody>
|
| 463 |
+
</table>
|
| 464 |
+
|
| 465 |
+
```python
|
| 466 |
+
segmentor = torch.hub.load(REPO_DIR, 'dinov3_vit7b16_ms', source="local", weights=<SEGMENTOR/CHECKPOINT/URL/OR/PATH>, backbone_weights=<BACKBONE/CHECKPOINT/URL/OR/PATH>)
|
| 467 |
+
```
|
| 468 |
+
|
| 469 |
+
Example command to run a full inference on ADE20K with the provided segmentor (ViT-7B + M2F):
|
| 470 |
+
|
| 471 |
+
```shell
|
| 472 |
+
PYTHONPATH=. python -m dinov3.run.submit dinov3/eval/segmentation/run.py \
|
| 473 |
+
config=dinov3/eval/segmentation/configs/config-ade20k-m2f-inference.yaml \
|
| 474 |
+
datasets.root=<PATH/TO/DATASET> \
|
| 475 |
+
load_from=dinov3_vit7b16_ms \
|
| 476 |
+
--output-dir <PATH/TO/OUTPUT/DIR>
|
| 477 |
+
```
|
| 478 |
+
|
| 479 |
+
Full example code of segmentator on an image
|
| 480 |
+
|
| 481 |
+
```python
|
| 482 |
+
import sys
|
| 483 |
+
sys.path.append(REPO_DIR)
|
| 484 |
+
|
| 485 |
+
from PIL import Image
|
| 486 |
+
import torch
|
| 487 |
+
from torchvision import transforms
|
| 488 |
+
import matplotlib.pyplot as plt
|
| 489 |
+
from matplotlib import colormaps
|
| 490 |
+
from functools import partial
|
| 491 |
+
from dinov3.eval.segmentation.inference import make_inference
|
| 492 |
+
|
| 493 |
+
|
| 494 |
+
def get_img():
|
| 495 |
+
import requests
|
| 496 |
+
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
| 497 |
+
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
|
| 498 |
+
return image
|
| 499 |
+
|
| 500 |
+
def make_transform(resize_size: int | list[int] = 768):
|
| 501 |
+
to_tensor = v2.ToImage()
|
| 502 |
+
resize = v2.Resize((resize_size, resize_size), antialias=True)
|
| 503 |
+
to_float = v2.ToDtype(torch.float32, scale=True)
|
| 504 |
+
normalize = v2.Normalize(
|
| 505 |
+
mean=(0.485, 0.456, 0.406),
|
| 506 |
+
std=(0.229, 0.224, 0.225),
|
| 507 |
+
)
|
| 508 |
+
return v2.Compose([to_tensor, resize, to_float, normalize])
|
| 509 |
+
|
| 510 |
+
segmentor = torch.hub.load(REPO_DIR, 'dinov3_vit7b16_ms', source="local", weights=<SEGMENTOR/CHECKPOINT/URL/OR/PATH>, backbone_weights=<BACKBONE/CHECKPOINT/URL/OR/PATH>)
|
| 511 |
+
|
| 512 |
+
img_size = 896
|
| 513 |
+
img = get_img()
|
| 514 |
+
transform = make_transform(img_size)
|
| 515 |
+
with torch.inference_mode():
|
| 516 |
+
with torch.autocast('cuda', dtype=torch.bfloat16):
|
| 517 |
+
batch_img = transform(img)[None]
|
| 518 |
+
pred_vit7b = segmentor(batch_img) # raw predictions
|
| 519 |
+
# actual segmentation map
|
| 520 |
+
segmentation_map_vit7b = make_inference(
|
| 521 |
+
batch_img,
|
| 522 |
+
segmentor,
|
| 523 |
+
inference_mode="slide",
|
| 524 |
+
decoder_head_type="m2f",
|
| 525 |
+
rescale_to=(img.size[-1], img.size[-2]),
|
| 526 |
+
n_output_channels=150,
|
| 527 |
+
crop_size=(img_size, img_size),
|
| 528 |
+
stride=(img_size, img_size),
|
| 529 |
+
output_activation=partial(torch.nn.functional.softmax, dim=1),
|
| 530 |
+
).argmax(dim=1, keepdim=True)
|
| 531 |
+
plt.figure(figsize=(12, 6))
|
| 532 |
+
plt.subplot(121)
|
| 533 |
+
plt.imshow(img)
|
| 534 |
+
plt.axis("off")
|
| 535 |
+
plt.subplot(122)
|
| 536 |
+
plt.imshow(segmentation_map_vit7b[0,0].cpu(), cmap=colormaps["Spectral"])
|
| 537 |
+
plt.axis("off")
|
| 538 |
+
```
|
| 539 |
+
|
| 540 |
+
|
| 541 |
+
|
| 542 |
+
|
| 543 |
+
### Pretrained heads - Zero-shot tasks with `dino.txt`
|
| 544 |
+
|
| 545 |
+
<table style="margin: auto">
|
| 546 |
+
<thead>
|
| 547 |
+
<tr>
|
| 548 |
+
<th rowspan="2">Backbone</th>
|
| 549 |
+
<th>Download</th>
|
| 550 |
+
</tr>
|
| 551 |
+
</thead>
|
| 552 |
+
<tbody>
|
| 553 |
+
<tr>
|
| 554 |
+
<td>ViT-L/16 distilled</td>
|
| 555 |
+
<td align="center">
|
| 556 |
+
<a href="https://ai.meta.com/resources/models-and-libraries/dinov3-downloads/">[link]</a>,
|
| 557 |
+
<a href="https://dl.fbaipublicfiles.com/dinov3/thirdparty/bpe_simple_vocab_16e6.txt.gz">vocabulary</a>,
|
| 558 |
+
<a href="https://dl.fbaipublicfiles.com/dinov2/thirdparty/LICENSE">vocabulary license</a>
|
| 559 |
+
</td>
|
| 560 |
+
</tr>
|
| 561 |
+
</tbody>
|
| 562 |
+
</table>
|
| 563 |
+
|
| 564 |
+
The (full) dino.txt model can be loaded via PyTorch Hub:
|
| 565 |
+
|
| 566 |
+
```python
|
| 567 |
+
import torch
|
| 568 |
+
# DINOv3
|
| 569 |
+
dinov3_vitl16_dinotxt_tet1280d20h24l, tokenizer = torch.hub.load(REPO_DIR, 'dinov3_vitl16_dinotxt_tet1280d20h24l', weights=<SEGMENTOR/CHECKPOINT/URL/OR/PATH>, backbone_weights=<BACKBONE/CHECKPOINT/URL/OR/PATH>)
|
| 570 |
+
```
|
| 571 |
+
|
| 572 |
+
|
| 573 |
+
## Installation
|
| 574 |
+
|
| 575 |
+
The training and evaluation code requires PyTorch version >= 2.7.1 as well as a few other 3rd party packages. Note that the code has only been tested with the specified versions and also expects a Linux environment. To setup all the required dependencies for training and evaluation, please follow the instructions below:
|
| 576 |
+
|
| 577 |
+
*[micromamba](https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html)* **(Recommended)** - Clone the repository and then create and activate a `dinov3` conda environment using the provided environment definition:
|
| 578 |
+
|
| 579 |
+
```shell
|
| 580 |
+
micromamba env create -f conda.yaml
|
| 581 |
+
micromamba activate dinov3
|
| 582 |
+
```
|
| 583 |
+
|
| 584 |
+
## Getting started
|
| 585 |
+
|
| 586 |
+
Several notebooks are provided to get started applying DINOv3:
|
| 587 |
+
- [PCA of patch features](notebooks/pca.ipynb): display the PCA of DINOv3 patch features on a foreground object (rainbow visualizations from the paper) [[Run in Google Colab]](https://colab.research.google.com/github/facebookresearch/dinov3/blob/main/notebooks/pca.ipynb)
|
| 588 |
+
- [Foreground segmentation](notebooks/foreground_segmentation.ipynb): train a linear foreground segmentation model based on DINOv3 features [[Run in Google Colab]](https://colab.research.google.com/github/facebookresearch/dinov3/blob/main/notebooks/foreground_segmentation.ipynb)
|
| 589 |
+
- [Dense and sparse matching](notebooks/dense_sparse_matching.ipynb): match patches from objects on two different images based on DINOv3 features [[Run in Google Colab]](https://colab.research.google.com/github/facebookresearch/dinov3/blob/main/notebooks/dense_sparse_matching.ipynb)
|
| 590 |
+
- [Segmentation tracking](notebooks/segmentation_tracking.ipynb): video segmentation tracking using a non-parametric method based on DINOv3 features [[Run in Google Colab]](https://colab.research.google.com/github/facebookresearch/dinov3/blob/main/notebooks/segmentation_tracking.ipynb)
|
| 591 |
+
- [Zero-shot segmentation with DINOv3-based dino.txt](notebooks/dinotxt_segmentation_inference.ipynb): compute the open-vocabulary segmentation results with dino.txt strategy.
|
| 592 |
+
|
| 593 |
+
## Data preparation
|
| 594 |
+
|
| 595 |
+
### ImageNet-1k
|
| 596 |
+
|
| 597 |
+
The root directory of the dataset should hold the following contents:
|
| 598 |
+
|
| 599 |
+
- `<ROOT>/test/ILSVRC2012_test_00000001.JPEG`
|
| 600 |
+
- `<ROOT>/test/[..]`
|
| 601 |
+
- `<ROOT>/test/ILSVRC2012_test_00100000.JPEG`
|
| 602 |
+
- `<ROOT>/train/n01440764/n01440764_10026.JPEG`
|
| 603 |
+
- `<ROOT>/train/[...]`
|
| 604 |
+
- `<ROOT>/train/n15075141/n15075141_9993.JPEG`
|
| 605 |
+
- `<ROOT>/val/n01440764/ILSVRC2012_val_00000293.JPEG`
|
| 606 |
+
- `<ROOT>/val/[...]`
|
| 607 |
+
- `<ROOT>/val/n15075141/ILSVRC2012_val_00049174.JPEG`
|
| 608 |
+
- `<ROOT>/labels.txt`
|
| 609 |
+
|
| 610 |
+
The provided dataset implementation expects a few additional metadata files to be present under the extra directory:
|
| 611 |
+
|
| 612 |
+
- `<EXTRA>/class-ids-TRAIN.npy`
|
| 613 |
+
- `<EXTRA>/class-ids-VAL.npy`
|
| 614 |
+
- `<EXTRA>/class-names-TRAIN.npy`
|
| 615 |
+
- `<EXTRA>/class-names-VAL.npy`
|
| 616 |
+
- `<EXTRA>/entries-TEST.npy`
|
| 617 |
+
- `<EXTRA>/entries-TRAIN.npy`
|
| 618 |
+
- `<EXTRA>/entries-VAL.npy`
|
| 619 |
+
|
| 620 |
+
These metadata files can be generated (once) with the following lines of Python code:
|
| 621 |
+
|
| 622 |
+
```python
|
| 623 |
+
from dinov3.data.datasets import ImageNet
|
| 624 |
+
|
| 625 |
+
for split in ImageNet.Split:
|
| 626 |
+
dataset = ImageNet(split=split, root="<ROOT>", extra="<EXTRA>")
|
| 627 |
+
dataset.dump_extra()
|
| 628 |
+
```
|
| 629 |
+
|
| 630 |
+
Note that the root and extra directories do not have to be distinct directories.
|
| 631 |
+
|
| 632 |
+
### ImageNet-22k
|
| 633 |
+
|
| 634 |
+
Please adapt the [dataset class](dinov3/data/datasets/image_net_22k.py) to match your local setup.
|
| 635 |
+
|
| 636 |
+
<br />
|
| 637 |
+
|
| 638 |
+
:warning: To execute the commands provided in the next sections for training and evaluation, the `dinov3` package should be included in the Python module search path, i.e. simply prefix the command to run with `PYTHONPATH=.`.
|
| 639 |
+
|
| 640 |
+
## Training
|
| 641 |
+
|
| 642 |
+
### Fast setup: training DINOv3 ViT-L/16 on ImageNet-1k
|
| 643 |
+
|
| 644 |
+
Run DINOv3 pre-training on 4 H100-80GB nodes (32 GPUs) in a SLURM cluster environment with submitit:
|
| 645 |
+
|
| 646 |
+
```shell
|
| 647 |
+
PYTHONPATH=${PWD} python -m dinov3.run.submit dinov3/train/train.py \
|
| 648 |
+
--nodes 4 \
|
| 649 |
+
--config-file dinov3/configs/train/vitl_im1k_lin834.yaml \
|
| 650 |
+
--output-dir <PATH/TO/OUTPUT/DIR> \
|
| 651 |
+
train.dataset_path=ImageNet22k:root=<PATH/TO/DATASET>:extra=<PATH/TO/DATASET>
|
| 652 |
+
```
|
| 653 |
+
Training time is approximately 14 hours and the resulting checkpoint should reach 82.0% on k-NN eval and 83.5% on linear eval.
|
| 654 |
+
|
| 655 |
+
The training code saves the weights of the teacher in the eval folder every 12500 iterations for evaluation.
|
| 656 |
+
|
| 657 |
+
### Exact DINOv3 setup: training DINOv3 ViT-7B/16
|
| 658 |
+
|
| 659 |
+
DINOv3 ViT-7B/16 is trained on a private dataset. The training involves 3 stages:
|
| 660 |
+
- Pretraining
|
| 661 |
+
- Gram anchoring
|
| 662 |
+
- High resolution adaptation
|
| 663 |
+
|
| 664 |
+
#### Pretraining
|
| 665 |
+
|
| 666 |
+
Launch DINOV3 ViT-7B/16 pretraining on 32 nodes (256 GPUs) in a SLURM cluster environment with submitit.
|
| 667 |
+
|
| 668 |
+
```shell
|
| 669 |
+
PYTHONPATH=${PWD} python -m dinov3.run.submit dinov3/train/train.py \
|
| 670 |
+
--nodes 32 \
|
| 671 |
+
--config-file dinov3/configs/train/dinov3_vit7b16_pretrain.yaml \
|
| 672 |
+
--output-dir <PATH/TO/OUTPUT/DIR> \
|
| 673 |
+
train.dataset_path=<DATASET>:root=<PATH/TO/DATASET>:extra=<PATH/TO/DATASET>
|
| 674 |
+
```
|
| 675 |
+
|
| 676 |
+
#### Gram anchoring
|
| 677 |
+
|
| 678 |
+
```shell
|
| 679 |
+
PYTHONPATH=${PWD} python -m dinov3.run.submit dinov3/train/train.py \
|
| 680 |
+
--nodes 32 \
|
| 681 |
+
--config-file dinov3/configs/train/dinov3_vit7b16_gram_anchor.yaml \
|
| 682 |
+
--output-dir <PATH/TO/OUTPUT/DIR> \
|
| 683 |
+
train.dataset_path=<DATASET>:root=<PATH/TO/DATASET>:extra=<PATH/TO/DATASET> \
|
| 684 |
+
gram.ckpt=<PATH/TO/GRAM_TEACHER_FROM_PREVIOUS_STEP>
|
| 685 |
+
```
|
| 686 |
+
|
| 687 |
+
#### High-resolution adaptation
|
| 688 |
+
|
| 689 |
+
|
| 690 |
+
```shell
|
| 691 |
+
PYTHONPATH=${PWD} python -m dinov3.run.submit dinov3/train/train.py \
|
| 692 |
+
--nodes 32 \
|
| 693 |
+
--config-file dinov3/configs/train/dinov3_vit7b16_high_res_adapt.yaml \
|
| 694 |
+
--output-dir <PATH/TO/OUTPUT/DIR> \
|
| 695 |
+
train.dataset_path=<DATASET>:root=<PATH/TO/DATASET>:extra=<PATH/TO/DATASET> \
|
| 696 |
+
gram.ckpt=<PATH/TO/TEACHER_FROM_GRAM> \
|
| 697 |
+
student.resume_from_teacher_chkpt=<PATH/TO/TEACHER_FROM_GRAM>
|
| 698 |
+
```
|
| 699 |
+
|
| 700 |
+
## Multi-distillation
|
| 701 |
+
|
| 702 |
+
### Test setup:
|
| 703 |
+
|
| 704 |
+
```shell
|
| 705 |
+
PYTHONPATH=${PWD} python -m dinov3.run.submit dinov3/train/train.py \
|
| 706 |
+
--nodes 1 \
|
| 707 |
+
--config-file dinov3/configs/train/multi_distillation_test.yaml \
|
| 708 |
+
--output-dir <PATH/TO/OUTPUT/DIR> \
|
| 709 |
+
--multi-distillation \
|
| 710 |
+
train.dataset_path=<DATASET>:root=<PATH/TO/DATASET>:extra=<PATH/TO/DATASET>
|
| 711 |
+
```
|
| 712 |
+
|
| 713 |
+
## Evaluation
|
| 714 |
+
|
| 715 |
+
The training code regularly saves the teacher weights. In order to evaluate the model, run the following evaluation on a single node:
|
| 716 |
+
|
| 717 |
+
|
| 718 |
+
### Logistic regression classification on ImageNet-1k
|
| 719 |
+
|
| 720 |
+
```shell
|
| 721 |
+
PYTHONPATH=${PWD} python -m dinov3.run.submit dinov3/eval/log_regression.py \
|
| 722 |
+
model.config_file=<PATH/TO/OUTPUT/DIR>/config.yaml \
|
| 723 |
+
model.pretrained_weights=<PATH/TO/OUTPUT/DIR>/teacher_checkpoint.pth \
|
| 724 |
+
output_dir=<PATH/TO/OUTPUT/DIR> \
|
| 725 |
+
train.dataset=ImageNet:split=TRAIN:root=<PATH/TO/DATASET>:extra=<PATH/TO/DATASET> \
|
| 726 |
+
eval.test_dataset=ImageNet:split=VAL:root=<PATH/TO/DATASET>:extra=<PATH/TO/DATASET>
|
| 727 |
+
```
|
| 728 |
+
|
| 729 |
+
### k-NN classification on ImageNet-1k
|
| 730 |
+
|
| 731 |
+
```shell
|
| 732 |
+
PYTHONPATH=${PWD} python -m dinov3.run.submit dinov3/eval/knn.py \
|
| 733 |
+
model.config_file=<PATH/TO/OUTPUT/DIR>/config.yaml \
|
| 734 |
+
model.pretrained_weights=<PATH/TO/OUTPUT/DIR>/teacher_checkpoint.pth \
|
| 735 |
+
output_dir=<PATH/TO/OUTPUT/DIR> \
|
| 736 |
+
train.dataset=ImageNet:split=TRAIN:root=<PATH/TO/DATASET>:extra=<PATH/TO/DATASET> \
|
| 737 |
+
eval.test_dataset=ImageNet:split=VAL:root=<PATH/TO/DATASET>:extra=<PATH/TO/DATASET>
|
| 738 |
+
```
|
| 739 |
+
|
| 740 |
+
### Linear classification with data augmentation on ImageNet-1k
|
| 741 |
+
|
| 742 |
+
```shell
|
| 743 |
+
PYTHONPATH=${PWD} python -m dinov3.run.submit dinov3/eval/linear.py \
|
| 744 |
+
model.config_file=<PATH/TO/OUTPUT/DIR>/config.yaml \
|
| 745 |
+
model.pretrained_weights=<PATH/TO/OUTPUT/DIR>/teacher_checkpoint.pth \
|
| 746 |
+
output_dir=<PATH/TO/OUTPUT/DIR> \
|
| 747 |
+
train.dataset=ImageNet:split=TRAIN:root=<PATH/TO/DATASET>:extra=<PATH/TO/DATASET> \
|
| 748 |
+
train.val_dataset=ImageNet:split=VAL:root=<PATH/TO/DATASET>:extra=<PATH/TO/DATASET>
|
| 749 |
+
```
|
| 750 |
+
|
| 751 |
+
### Linear segmentation with data augmentation on ADE20K
|
| 752 |
+
|
| 753 |
+
```shell
|
| 754 |
+
PYTHONPATH=. python -m dinov3.run.submit dinov3/eval/segmentation/run.py \
|
| 755 |
+
model.dino_hub=dinov3_vit7b16 \
|
| 756 |
+
config=dinov3/eval/segmentation/configs/config-ade20k-linear-training.yaml \
|
| 757 |
+
datasets.root=<PATH/TO/DATASET> \
|
| 758 |
+
--output-dir <PATH/TO/OUTPUT/DIR>
|
| 759 |
+
```
|
| 760 |
+
|
| 761 |
+
After the job completes, you will find in the output path directory you specified
|
| 762 |
+
- `segmentation_config.yaml` that contains the config you trained the model with;
|
| 763 |
+
- `model_final.pth`, the final linear head checkpoint at the end of training; and
|
| 764 |
+
- `results-semantic-segmentation.csv` with the final metrics.
|
| 765 |
+
|
| 766 |
+
|
| 767 |
+
#### Linear depth estimation on NYUv2 Depth
|
| 768 |
+
```shell
|
| 769 |
+
PYTHONPATH=. python -m dinov3.run.submit dinov3/eval/depth/run.py \
|
| 770 |
+
model.dino_hub=dinov3_vit7b16 \
|
| 771 |
+
config=dinov3/eval/depth/configs/config-nyu.yaml \
|
| 772 |
+
datasets.root=<PATH/TO/DATASET> \
|
| 773 |
+
--output-dir <PATH/TO/OUTPUT/DIR>
|
| 774 |
+
```
|
| 775 |
+
|
| 776 |
+
After the job completes, you will find in the output path directory you specified
|
| 777 |
+
- `depth_config.yaml` that contains the config you trained the model with;
|
| 778 |
+
- `model_final.pth`, the final linear head checkpoint at the end of training; and
|
| 779 |
+
- `results-depth.csv` with the final metrics.
|
| 780 |
+
|
| 781 |
+
### Text alignment on DINOv3 using dino.txt
|
| 782 |
+
|
| 783 |
+
Text alignment can be done following the method from `dino.txt` aka [DINOv2 Meets Text](https://arxiv.org/abs/2412.16334).
|
| 784 |
+
|
| 785 |
+
```shell
|
| 786 |
+
PYTHONPATH=${PWD} python -m dinov3.run.submit dinov3/eval/text/train_dinotxt.py \
|
| 787 |
+
--nodes 4 \
|
| 788 |
+
# An example config for text alignment is here: dinov3/eval/text/configs/dinov3_vitl_text.yaml \
|
| 789 |
+
trainer_config_file="<PATH/TO/DINOv3/TEXT/CONFIG>" \
|
| 790 |
+
output-dir=<PATH/TO/OUTPUT/DIR>
|
| 791 |
+
```
|
| 792 |
+
Launching the above trains text alignment on 4 nodes with 8 gpus each (32 gpus in total).
|
| 793 |
+
Please note that the text alignment model in the DINOv3 paper was trained on a private dataset and here we have given an example config in ```dinov3/eval/text/configs/dinov3_vitl_text.yaml``` using ```CocoCaptions``` dataset for illustration purposes.
|
| 794 |
+
Please adapt the provided ```CocoCaptions``` dataset class, the dataset can be found [here](https://www.kaggle.com/datasets/nikhil7280/coco-image-caption)
|
| 795 |
+
|
| 796 |
+
|
| 797 |
+
## Canopy Height Maps v2 (CHMv2)
|
| 798 |
+
|
| 799 |
+
John Brandt, Seungeun Yi, Jamie Tolan, Xinyuan Li, Peter Potapov, <br/>
|
| 800 |
+
Jessica Ertel, Justine Spore, Huy V. Vo, Michaël Ramamonjisoa, Patrick Labatut, <br/>
|
| 801 |
+
Piotr Bojanowski, Camille Couprie
|
| 802 |
+
|
| 803 |
+
[ :scroll: [`Paper`](https://arxiv.org/abs/2603.06382)] [ :newspaper: [`Blog`](http://ai.meta.com/blog/world-resources-institute-dino-canopy-height-maps-v2)]
|
| 804 |
+
|
| 805 |
+
### CHMv2 model loading (via PyTorch [Hub](https://docs.pytorch.org/docs/stable/hub.html))
|
| 806 |
+
|
| 807 |
+
:information_source: Please follow the link provided below to get access to the CHMv2 model weights: once accepted, an e-mail will be sent with the URL pointing to the available model weights. The URL can then be used to either:
|
| 808 |
+
- download the model weights to a local filesystem and point `torch.hub.load()` to these local weights via the `weights` parameters, or
|
| 809 |
+
- directly invoke `torch.hub.load()` to download and load a backbone from its URL.
|
| 810 |
+
|
| 811 |
+
CHMv2 uses the DINOv3 ViT-L/16 satellite as the backbone, available after requesting access [here](https://ai.meta.com/resources/models-and-libraries/dinov3-downloads/).
|
| 812 |
+
|
| 813 |
+
:warning: Please use `wget` instead of a web browser to download the weights.
|
| 814 |
+
|
| 815 |
+
Download link: https://ai.meta.com/resources/models-and-libraries/chmv2-downloads/
|
| 816 |
+
|
| 817 |
+
```python
|
| 818 |
+
import torch
|
| 819 |
+
from dinov3.hub.backbones import Weights
|
| 820 |
+
|
| 821 |
+
REPO_DIR = <PATH/TO/A/LOCAL/DIRECTORY/WHERE/THE/DINOv3/REPO/WAS/CLONED>
|
| 822 |
+
|
| 823 |
+
chmv2_model = torch.hub.load(
|
| 824 |
+
REPO_DIR,
|
| 825 |
+
'dinov3_vitl16_chmv2',
|
| 826 |
+
source="local",
|
| 827 |
+
weights="<CHMV2_MODEL/CHECKPOINT/URL/OR/PATH>",
|
| 828 |
+
backbone_weights=Weights.SAT493M, # or <DINOV3_VITL_SAT/CHECKPOINT/URL/OR/PATH>
|
| 829 |
+
)
|
| 830 |
+
```
|
| 831 |
+
|
| 832 |
+
Refer to this [notebook](notebooks/chmv2_inference.ipynb) for an example of how to use the DINOv3 + CHMv2 model.
|
| 833 |
+
|
| 834 |
+
This [notebook](notebooks/chmv2_dataset_exploration.ipynb) can be used to download inference data from the existing global dataset stored on aws.
|
| 835 |
+
|
| 836 |
+
### CHMv2 model loading (via Hugging Face [Transformers](https://huggingface.co/docs/transformers/))
|
| 837 |
+
|
| 838 |
+
The CHMv2 model is also available on [Hugging Face Hub](https://huggingface.co/facebook/dinov3-vitl16-chmv2-dpt-head) and supported via the Hugging Face [Transformers](https://huggingface.co/docs/transformers/index) library. Please refer to the corresponding documentation for usage, but below is a short example that demonstrates how to obtain canopy height predictions on a sample image.
|
| 839 |
+
|
| 840 |
+
```python
|
| 841 |
+
from PIL import Image
|
| 842 |
+
import torch
|
| 843 |
+
|
| 844 |
+
from transformers import AutoModelForDepthEstimation, AutoImageProcessor
|
| 845 |
+
|
| 846 |
+
processor = AutoImageProcessor.from_pretrained("facebook/dinov3-vitl16-chmv2-dpt-head")
|
| 847 |
+
model = AutoModelForDepthEstimation.from_pretrained("facebook/dinov3-vitl16-chmv2-dpt-head")
|
| 848 |
+
|
| 849 |
+
image = Image.open("image.tif")
|
| 850 |
+
inputs = processor(images=image, return_tensors="pt")
|
| 851 |
+
|
| 852 |
+
with torch.no_grad():
|
| 853 |
+
outputs = model(**inputs)
|
| 854 |
+
|
| 855 |
+
depth = processor.post_process_depth_estimation(
|
| 856 |
+
outputs, target_sizes=[(image.height, image.width)]
|
| 857 |
+
)[0]["predicted_depth"]
|
| 858 |
+
```
|
| 859 |
+
|
| 860 |
+
## License
|
| 861 |
+
|
| 862 |
+
DINOv3 code and model weights are released under the DINOv3 License. See [LICENSE.md](LICENSE.md) for additional details.
|
| 863 |
+
|
| 864 |
+
## Contributing
|
| 865 |
+
|
| 866 |
+
See [contributing](CONTRIBUTING.md) and the [code of conduct](CODE_OF_CONDUCT.md).
|
| 867 |
+
|
| 868 |
+
## Citing DINOv3
|
| 869 |
+
|
| 870 |
+
If you find this repository useful, please consider giving a star :star: and citation :t-rex::
|
| 871 |
+
|
| 872 |
+
```
|
| 873 |
+
@misc{simeoni2025dinov3,
|
| 874 |
+
title={{DINOv3}},
|
| 875 |
+
author={Sim{\'e}oni, Oriane and Vo, Huy V. and Seitzer, Maximilian and Baldassarre, Federico and Oquab, Maxime and Jose, Cijo and Khalidov, Vasil and Szafraniec, Marc and Yi, Seungeun and Ramamonjisoa, Micha{\"e}l and Massa, Francisco and Haziza, Daniel and Wehrstedt, Luca and Wang, Jianyuan and Darcet, Timoth{\'e}e and Moutakanni, Th{\'e}o and Sentana, Leonel and Roberts, Claire and Vedaldi, Andrea and Tolan, Jamie and Brandt, John and Couprie, Camille and Mairal, Julien and J{\'e}gou, Herv{\'e} and Labatut, Patrick and Bojanowski, Piotr},
|
| 876 |
+
year={2025},
|
| 877 |
+
eprint={2508.10104},
|
| 878 |
+
archivePrefix={arXiv},
|
| 879 |
+
primaryClass={cs.CV},
|
| 880 |
+
url={https://arxiv.org/abs/2508.10104},
|
| 881 |
+
}
|
| 882 |
+
```
|
README_starVLA.md
ADDED
|
@@ -0,0 +1,446 @@
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# StarVLA: A Lego-like Codebase for Vision-Language-Action Model Developing
|
| 2 |
+
|
| 3 |
+
<!-- [](https://github.com/starVLA/starVLA) -->
|
| 4 |
+
[](https://huggingface.co/StarVLA) [](assets/starVLA_wechat.jpg)
|
| 5 |
+
|
| 6 |
+
**[205/12/25]** We've simultaneously established pipelines for [Behavior-1K](examples/Behavior), [RoboTwin 2.0](examples/Robotwin), and CALVIN. We'd love to collaborate and share baseline results for more benchs with the community!
|
| 7 |
+
|
| 8 |
+
**[205/12/25]** We've released RoboCasa evaluation support, which trained **without pretraining and reach SOTA performance**. Check out more details in [examples/Robocasa_tabletop](examples/Robocasa_tabletop).
|
| 9 |
+
|
| 10 |
+
**[2025/12/15]** Completed a release regression check to ensure the public code runs smoothly. Routine updates—including recent support for the LeRobot dataset v3.0 and DeepSpeed ZeRO-3—will continue to appear in the [🚧 Daily Development Log](https://github.com/starVLA/starVLA/issues/64#issue-3727060165).
|
| 11 |
+
|
| 12 |
+
**[2025/12/09]** Be the first open-source repository that can train with [train your vlm](starVLA/training/train_starvlm.py), [train your vla](starVLA/training/train_starvla.py), and [train your vla with vlm](starVLA/training/train_starvla_cotrain.py). Check out how to co-train your VLA with multimodal data in [examples/CoTrainVLM](examples/CoTrainVLM/README.md).
|
| 13 |
+
|
| 14 |
+
<details close>
|
| 15 |
+
<summary><b> Historical Milestones </b></summary>
|
| 16 |
+
|
| 17 |
+
**[2025/11/12]** We now support [Florence-2](https://github.com/anyantudre/Florence-2-Vision-Language-Model) as a smaller VLM for resource-constrained development. StarVLA can now run on a single A100 GPU. See the [🚀Train with a smaller VLM](#train-smaller-vlm) section for more details.
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
**[2025/10/30]:** We released the LIBERO Training & Evaluation README. Results are very promising. More detail are in [examples/LIBERO](examples/LIBERO).
|
| 21 |
+
|
| 22 |
+
**[2025/10/25]:** We fixed several script links and so everything is smoother now. Thanks to the community for the feedback.
|
| 23 |
+
|
| 24 |
+
</details>
|
| 25 |
+
|
| 26 |
+
---
|
| 27 |
+
|
| 28 |
+
StarVLA is a modular and flexible codebase for developing Vision-Language Model (VLM) to Vision-Language-Action (VLA) models.
|
| 29 |
+
In StarVLA (also a pun on “start VLA” ), each functional component (model, data, trainer, config, evaluation, etc.) follows a top-down, intuitive separation and high cohesion and low coupling principle, which enabling plug-and-play design, rapid prototyping, and independent debugging.
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+

|
| 34 |
+
*Modules with solid borders are supported; borderless ones are coming soon.
|
| 35 |
+
|
| 36 |
+
## Projects Based on StarVLA
|
| 37 |
+
|
| 38 |
+
**NeuroVLA**: [*A Brain-like Embodied Intelligence for Fluid and Fast Reflexive Robotics Control*](https://github.com/guoweiyu/NeuroVLA)
|
| 39 |
+
|
| 40 |
+
**PhysBrain**: [*Human Egocentric Data as a Bridge from Vision Language Models to Physical Intelligence*](https://zgc-embodyai.github.io/PhysBrain)
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
## 🔥 Key Features
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
<details open>
|
| 48 |
+
<summary><b>Various VLA Frameworks </b></summary>
|
| 49 |
+
|
| 50 |
+
- [x] **Qwen-FAST**: Utilizes Qwen2.5-VL-3B with a fast tokenizer to autoregressively generate discrete action tokens conditioned on visual and linguistic inputs (in line with π₀-fast).
|
| 51 |
+
- [x] **Qwen-OFT**: Combines Qwen2.5-VL-3B with an MLP action head to perform parallel decoding of continuous actions, regressed from the hidden states of predefined special action tokens (in line with OpenVLA-OFT/EO).
|
| 52 |
+
- [x] **Qwen-PI**: Integrates the Flow-Matching (FM) action expert with Qwen2.5-VL-3B, adopting a diffusion-based approach for continuous action prediction (in line with π₀).
|
| 53 |
+
- [x] **Qwen-GR00T**: Implements a dual-system VLA architecture, where Qwen2.5-VL-3B serves as System2 for high-level vision-language reasoning, while the Flow-Matching module acts as System1 for rapid action prediction (in line with GR00T).
|
| 54 |
+
|
| 55 |
+
<details open>
|
| 56 |
+
<summary><b> Results on SimplerEnv </b></summary>
|
| 57 |
+
|
| 58 |
+
<p align="center">
|
| 59 |
+
<img src="assets/starvla_simpleEnv.png" alt="SimplerEnv modules" width="95%">
|
| 60 |
+
</p>
|
| 61 |
+
|
| 62 |
+
</details>
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
<details open>
|
| 66 |
+
<summary><b> Results on RoboCasa GR1 </b></summary>
|
| 67 |
+
|
| 68 |
+
<p align="center">
|
| 69 |
+
<img src="assets/stavla_RoboCasa.png" alt="RoboCasa modules" width="94%">
|
| 70 |
+
</p>
|
| 71 |
+
|
| 72 |
+
</details>
|
| 73 |
+
|
| 74 |
+
<details close>
|
| 75 |
+
<summary><b> Results on LIBERO </b></summary>
|
| 76 |
+
|
| 77 |
+
<p align="center">
|
| 78 |
+
<img src="assets/starvla_LIBERO.png" alt="LIBERO modules" width="84%">
|
| 79 |
+
</p>
|
| 80 |
+
|
| 81 |
+
</details>
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
We have more results for RoboCasa, RoboTwin 2.0, Behavior-1k, Calvin. See our [🍀 Overleaf](https://www.overleaf.com/read/qqtwrnprctkf#d5bdce), which continuously presents our real-time experimental results.
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
### 📈 Model Zoo
|
| 93 |
+
We release a series of modified models and finetuning checkpoints to facilitate reproduction and downstream use.
|
| 94 |
+
|
| 95 |
+
#### ✅ Available Modified Models
|
| 96 |
+
|
| 97 |
+
| Model | Description | Link |
|
| 98 |
+
|-------|-------------|------|
|
| 99 |
+
| **Qwen2.5-VL-3B-Action** | Extend Qwen2.5-VL's vocabulary with Fast Tokens | [🤗 Hugging Face](https://huggingface.co/StarVLA/Qwen2.5-VL-3B-Instruct-Action) |
|
| 100 |
+
| **Qwen3-VL-4B-Action** | Extend Qwen3-VL's vocabulary with Fast Tokens | [🤗 Hugging Face](https://huggingface.co/StarVLA/Qwen3-VL-4B-Instruct-Action) |
|
| 101 |
+
|
| 102 |
+
#### ✅ Available Finetuning Checkpoints
|
| 103 |
+
| Model | Description | WidowX | Link |
|
| 104 |
+
|-------|-------------|------|------|
|
| 105 |
+
| **QWen2.5-FAST-Bridge-RT-1** | Training on [Bridge](https://huggingface.co/datasets/IPEC-COMMUNITY/bridge_orig_lerobot) and [Fractal](https://huggingface.co/datasets/IPEC-COMMUNITY/fractal20220817_data_lerobot) | 58.6 | [🤗 Hugging Face](https://huggingface.co/StarVLA/Qwen-FAST-Bridge-RT-1) |
|
| 106 |
+
| **QWen2.5-OFT-Bridge-RT-1** | Training on [Bridge](https://huggingface.co/datasets/IPEC-COMMUNITY/bridge_orig_lerobot) and [Fractal](https://huggingface.co/datasets/IPEC-COMMUNITY/fractal20220817_data_lerobot) | 41.8 | [🤗 Hugging Face](https://huggingface.co/StarVLA/Qwen-OFT-Bridge-RT-1) |
|
| 107 |
+
| **QWen2.5-PI-Bridge-RT-1** | Training on [Bridge](https://huggingface.co/datasets/IPEC-COMMUNITY/bridge_orig_lerobot) and [Fractal](https://huggingface.co/datasets/IPEC-COMMUNITY/fractal20220817_data_lerobot) | 62.5 | [🤗 Hugging Face](https://huggingface.co/StarVLA/Qwen-FM-Bridge-RT-1) |
|
| 108 |
+
| **QWen2.5-GR00T-Bridge-RT-1** | Training on [Bridge](https://huggingface.co/datasets/IPEC-COMMUNITY/bridge_orig_lerobot) and [Fractal](https://huggingface.co/datasets/IPEC-COMMUNITY/fractal20220817_data_lerobot) | 63.6 | [🤗 Hugging Face](https://huggingface.co/StarVLA/Qwen-PI-Bridge-RT-1) |
|
| 109 |
+
| **QWen-GR00T-Bridge** | Training only on [Bridge](https://huggingface.co/datasets/IPEC-COMMUNITY/bridge_orig_lerobot) | 71.4 | [🤗 Hugging Face](https://huggingface.co/StarVLA/Qwen-GR00T-Bridge) |
|
| 110 |
+
| **QWen3VL-OFT-Bridge-RT-1** | Training on [Bridge](https://huggingface.co/datasets/IPEC-COMMUNITY/bridge_orig_lerobot) and [Fractal](https://huggingface.co/datasets/IPEC-COMMUNITY/fractal20220817_data_lerobot) | 42.7 | [🤗 Hugging Face](https://huggingface.co/StarVLA/Qwen3VL-OFT-Bridge-RT-1) |
|
| 111 |
+
| **QWen3VL-GR00T-Bridge-RT-1** | Training on [Bridge](https://huggingface.co/datasets/IPEC-COMMUNITY/bridge_orig_lerobot) and [Fractal](https://huggingface.co/datasets/IPEC-COMMUNITY/fractal20220817_data_lerobot) | 65.3 | [🤗 Hugging Face](https://huggingface.co/StarVLA/Qwen3VL-GR00T-Bridge-RT-1) |
|
| 112 |
+
|
| 113 |
+
---
|
| 114 |
+
</details>
|
| 115 |
+
|
| 116 |
+
<details open>
|
| 117 |
+
<summary><b>Various Simulation Benchmarks </b></summary>
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
- [x] **SimplerEnV**
|
| 121 |
+
- [x] **LIBERO**
|
| 122 |
+
- [x] **Robocasa**
|
| 123 |
+
- [x] **RoboTwin**
|
| 124 |
+
- [x] **BEHAVIOR**
|
| 125 |
+
- [ ] **SO101**
|
| 126 |
+
- [ ] **Calvin**
|
| 127 |
+
- [ ] **RLBench**
|
| 128 |
+
|
| 129 |
+
</details>
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
<details close>
|
| 133 |
+
<summary><b> Various Training Strategies </b></summary>
|
| 134 |
+
|
| 135 |
+
* [x] Single Imitation Learning
|
| 136 |
+
* [x] Multimodal Multitasks Co-training
|
| 137 |
+
* [ ] Reinforcement Learning Adaption
|
| 138 |
+
|
| 139 |
+
</details>
|
| 140 |
+
|
| 141 |
+
---
|
| 142 |
+
|
| 143 |
+
## 🚀 Quick Start
|
| 144 |
+
|
| 145 |
+
<details close>
|
| 146 |
+
<summary><b>🛠 Environment Setup
|
| 147 |
+
</b></summary>
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
```bash
|
| 152 |
+
# Clone the repo
|
| 153 |
+
git clone https://github.com/starVLA/starVLA
|
| 154 |
+
|
| 155 |
+
# Create conda environment
|
| 156 |
+
conda create -n starVLA python=3.10 -y
|
| 157 |
+
conda activate starVLA
|
| 158 |
+
|
| 159 |
+
# Install requirements
|
| 160 |
+
pip install -r requirements.txt
|
| 161 |
+
|
| 162 |
+
# Install FlashAttention2
|
| 163 |
+
pip install flash-attn --no-build-isolation
|
| 164 |
+
|
| 165 |
+
# Install starVLA
|
| 166 |
+
pip install -e .
|
| 167 |
+
```
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
⚠️ **Common Issues**
|
| 171 |
+
flash-attn can be tricky to install because it must match your system’s CUDA toolkit (nvcc) and PyTorch versions. The `--no-build-isolation` flag resolves most issues, but on newer systems you may need to manually choose a compatible flash-attn version. Ensure your CUDA driver/toolkit and torch versions are aligned. Check your environment:
|
| 172 |
+
|
| 173 |
+
```bash
|
| 174 |
+
nvcc -V
|
| 175 |
+
pip list | grep -E 'torch|transformers|flash-attn'
|
| 176 |
+
```
|
| 177 |
+
|
| 178 |
+
If issues persist, pick a flash-attn release that matches your versions (CUDA and torch) or ask chatGPT with searching function for help with the outputs above.
|
| 179 |
+
|
| 180 |
+
We have verified that `flash-attn==2.7.4.post1` works well with nvcc versions `12.0` and `12.4`.
|
| 181 |
+
|
| 182 |
+
</details>
|
| 183 |
+
|
| 184 |
+
<details close>
|
| 185 |
+
<summary><b>👀 Quick Check StarVLA
|
| 186 |
+
</b></summary>
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
```bash
|
| 191 |
+
# check framework with fake examples
|
| 192 |
+
python starVLA/model/framework/QwenGR00T.py
|
| 193 |
+
```
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
You should download [Qwen3-VL-4B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-4B-Instruct) and put it as `./playground/Pretrained_models/Qwen3-VL-4B-Instruct`. It should build successfully and `print(model)`. You can also call `model.forward(fake_data)` and obtain unnormalized actions via `model.predict_action(fake_data)`.
|
| 197 |
+
|
| 198 |
+
</details>
|
| 199 |
+
|
| 200 |
+
<details close>
|
| 201 |
+
<summary><b>🧪 Evaluate Existing Models</b></summary>
|
| 202 |
+
|
| 203 |
+
We publish benchmark-specific evaluation guides inside each folder under [examples](examples).
|
| 204 |
+
|
| 205 |
+
**Recommended quick start: LIBERO simulator**
|
| 206 |
+
|
| 207 |
+
1. Download [Qwen2.5-VL-GR00T-LIBERO-4in1](https://huggingface.co/StarVLA/Qwen2.5-VL-GR00T-LIBERO-4in1).
|
| 208 |
+
2. Follow the [LIBERO Eval](https://github.com/starVLA/starVLA/tree/starVLA/examples/LIBERO#-1-environment-setup) instructions to prepare the Python environment.
|
| 209 |
+
3. Set the environment variables at the top of [`eval_libero.sh`](examples/LIBERO/eval_files/eval_libero.sh) and [`run_policy_server.sh`](examples/LIBERO/eval_files/run_policy_server.sh).
|
| 210 |
+
4. Run:
|
| 211 |
+
|
| 212 |
+
```bash
|
| 213 |
+
bash examples/LIBERO/eval_files/run_policy_server.sh &
|
| 214 |
+
bash examples/LIBERO/eval_files/eval_libero.sh
|
| 215 |
+
```
|
| 216 |
+
|
| 217 |
+
⚠️ **Common issue**
|
| 218 |
+
If `NotImplementedError: Framework QwenGR00T is not implemented` appears, run `python starVLA/model/framework/QwenGR00T.py` to verify your environment.
|
| 219 |
+
|
| 220 |
+
</details>
|
| 221 |
+
|
| 222 |
+
<details open>
|
| 223 |
+
<summary><b>🚀 Train Your Own Model</b></summary>
|
| 224 |
+
|
| 225 |
+
We ship benchmark-specific training scripts under [examples](examples). We recommend starting with the [LIBERO suite](examples/LIBERO/train_files):
|
| 226 |
+
|
| 227 |
+
1. Edit `run_libero_train.sh` to point to your checkpoint, dataset root, and desired output directory.
|
| 228 |
+
2. Launch training:
|
| 229 |
+
|
| 230 |
+
```bash
|
| 231 |
+
bash examples/LIBERO/train_files/run_libero_train.sh
|
| 232 |
+
```
|
| 233 |
+
|
| 234 |
+
⚠️ **Note:** Ensure all absolute paths inside `run_libero_train.sh` match your local environment before launching.
|
| 235 |
+
|
| 236 |
+
</details>
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
## 🌟 How does starVLA make model development Lego-like again?
|
| 241 |
+
👇 StarVLA achieves “Lego-like” development via the following designs:
|
| 242 |
+
<a id="model"></a>
|
| 243 |
+
<details close>
|
| 244 |
+
<summary><b>1. Smoke test any submodule </b></summary>
|
| 245 |
+
|
| 246 |
+
StarVLA emphasizes a modular model design. Each major framework file can be run standalone for rapid debugging and smoke test your code. For example:
|
| 247 |
+
|
| 248 |
+
```bash
|
| 249 |
+
# model
|
| 250 |
+
python starVLA/model/framework/QwenOFT.py --config_yaml starvla_cotrain_oxe.yaml
|
| 251 |
+
# dataloader
|
| 252 |
+
python starVLA/dataloader/lerobot_datasets.py --config_yaml starvla_cotrain_oxe.yaml
|
| 253 |
+
|
| 254 |
+
```
|
| 255 |
+
Note: `starVLA/model/framework/yourframework.py` is the single external API surface of the model; it should mirror (be structurally isomorphic to) the framework diagram in your paper.
|
| 256 |
+
</details>
|
| 257 |
+
<a id="data"></a>
|
| 258 |
+
<details close>
|
| 259 |
+
<summary><b>2. Explicit model boundaries</b></summary>
|
| 260 |
+
|
| 261 |
+
StarVLA follows top‑down decomposition and the principle of high cohesion & low coupling.
|
| 262 |
+
|
| 263 |
+
For example:
|
| 264 |
+
- Dataloader
|
| 265 |
+
- Returns a raw, model‑agnostic dict only; no model‑specific preprocessing (e.g., tokenizer, image encoding).
|
| 266 |
+
- A single sample should include (add/remove as needed):
|
| 267 |
+
- image: list[PIL.Image] | np.ndarray
|
| 268 |
+
- lang: str
|
| 269 |
+
- action: np.ndarray[T, action_dim]
|
| 270 |
+
- state: Optional[np.ndarray[..., state_dim]]
|
| 271 |
+
|
| 272 |
+
Both `framework.forward()` and `framework.predict_action()` operate directly on raw inputs, keeping train/test boundaries explicit and easy to hack.
|
| 273 |
+
</details>
|
| 274 |
+
<a id="config"></a>
|
| 275 |
+
<details close>
|
| 276 |
+
<summary><b>3. Flexible configuration system</b></summary>
|
| 277 |
+
|
| 278 |
+
StarVLA uses a single global configuration object
|
| 279 |
+
Parameters are passed primarily via extensible dicts, allowing overrides and controlled redundancy.
|
| 280 |
+
|
| 281 |
+
</details>
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
🧪 *To self‑test and iterate on StarVLA’s usability, we re‑implemented several representative VLA frameworks. Our have done a beta test: an internal developer can stand up a new VLA framework in under half a day (leat then 3 hours), and an new user can build their first custom VLA framework within a single day. More design insights for each item can be found in [assets/intro_v1.md](assets/intro_v1.md).*
|
| 285 |
+
|
| 286 |
+
|
| 287 |
+
---
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
## 📖 FAQ
|
| 291 |
+
|
| 292 |
+
<details close>
|
| 293 |
+
<summary><b>Q: Why not put preprocessing in the dataloader?</b></summary>
|
| 294 |
+
|
| 295 |
+
A: We profiled it: data preprocessing takes <1% time. Keeping it inside the Framework is acceptable and allows model‑specific flexible handling.
|
| 296 |
+
|
| 297 |
+
</details>
|
| 298 |
+
|
| 299 |
+
<details close>
|
| 300 |
+
<summary><b>Q: Can I use a backbone other than Qwen2.5-VL?</b></summary>
|
| 301 |
+
|
| 302 |
+
A: Yes. Implement new vision + language modules and compose them inside a Framework; any other existing models can be swapped in. Yet, due to the framework processing raw action data, it is very easy to swap in.
|
| 303 |
+
</details>
|
| 304 |
+
|
| 305 |
+
<details close> <summary><b>Q: Why isn't there an abstract interface for the vision tower?</b></summary>
|
| 306 |
+
|
| 307 |
+
A: We believe that VLM will become the base model and will inherently possess its own native vision tower.
|
| 308 |
+
|
| 309 |
+
</details>
|
| 310 |
+
|
| 311 |
+
|
| 312 |
+
<details close>
|
| 313 |
+
<summary><b>Q: Can I override or add parameters via the terminal?</b></summary>
|
| 314 |
+
|
| 315 |
+
A: Yes. We use OmegaConf.load(args.config_yaml) as the single configuration entry; standalone debugging also uses args.config_yaml. Parameters may be intentionally redundant; you can freely add or override them via the CLI.
|
| 316 |
+
|
| 317 |
+
Examples:
|
| 318 |
+
```bash
|
| 319 |
+
accelerate launch \
|
| 320 |
+
--config_file starVLA/config/deepseeds/deepspeed_zero2.yaml \
|
| 321 |
+
--num_processes 8 \
|
| 322 |
+
starVLA/training/train_internvla.py \
|
| 323 |
+
--config_yaml ./starVLA/config/training/starvla_cotrain_oxe.yaml \
|
| 324 |
+
--framework.qwenvl.base_vlm Qwen/Qwen2.5-VL-7B-Instruct \ # override framework choice
|
| 325 |
+
--framework.qwenvl.base_vlm Qwen/Qwen2.5-VL-7B-Instruct \ # override framework choice
|
| 326 |
+
--framework.action_model.new_module ${module_name} \ # plug-in a new module to action model
|
| 327 |
+
```
|
| 328 |
+
|
| 329 |
+
⚠️: `framework.action_model.new_module` only adds to the global config; its behavior is on your framework.
|
| 330 |
+
|
| 331 |
+
|
| 332 |
+
</details>
|
| 333 |
+
|
| 334 |
+
<details close>
|
| 335 |
+
<summary><b>Q: Can I freeze the VLM via parameters?</b></summary>
|
| 336 |
+
|
| 337 |
+
A: Yes. StarVLA uses a regex / name list to control freezing. Example:
|
| 338 |
+
```
|
| 339 |
+
--trainer.freeze_modules "qwen_vl_interface.model.model.visual,dino_encoder" \
|
| 340 |
+
```
|
| 341 |
+
Tips: You can ``print(your_model)`` first to check the relative paths of your modules and list them as comma-separated values.
|
| 342 |
+
(implementation in `TrainerUtils.freeze_backbones`.)
|
| 343 |
+
|
| 344 |
+
</details>
|
| 345 |
+
|
| 346 |
+
<details close>
|
| 347 |
+
<summary><b>Q: Can I set different learning rates for different modules?</b></summary>
|
| 348 |
+
|
| 349 |
+
A: Yes, starVLA also uses name: value dict to control learning group. Config example:
|
| 350 |
+
```yaml
|
| 351 |
+
trainer:
|
| 352 |
+
learning_rate:
|
| 353 |
+
base: 1e-05 # other modules
|
| 354 |
+
qwen_vl_interface: 1.0e-05
|
| 355 |
+
action_model: 1.0e-04
|
| 356 |
+
```
|
| 357 |
+
(Also referenced in `trainer_tools.build_param_lr_groups`.)
|
| 358 |
+
</details>
|
| 359 |
+
|
| 360 |
+
<details close>
|
| 361 |
+
<summary><b>Q: Can I resume training from a checkpoint?</b></summary>
|
| 362 |
+
|
| 363 |
+
A: Yes, somehow can. Specify the latest checkpoint path in `config.yaml`, e.g.:
|
| 364 |
+
```yaml
|
| 365 |
+
trainer:
|
| 366 |
+
pretrained_checkpoint: path_to_steps_10000.pt
|
| 367 |
+
reload_modules: "action_model"
|
| 368 |
+
```
|
| 369 |
+
Empty `reload_modules` means full load all model. However, starVLA does not save `optimizer state`. It requires a lot of memory/disk and bring limited benefit.
|
| 370 |
+
</details>
|
| 371 |
+
|
| 372 |
+
|
| 373 |
+
<details id="train-smaller-vlm" close>
|
| 374 |
+
<summary><b>🚀 Train with a smaller VLM</b></summary>
|
| 375 |
+
|
| 376 |
+
```bash
|
| 377 |
+
accelerate launch \
|
| 378 |
+
--config_file starVLA/config/deepseeds/deepspeed_zero2.yaml \
|
| 379 |
+
--main_process_ip $MASTER_ADDR \
|
| 380 |
+
--main_process_port $MASTER_PORT \
|
| 381 |
+
--machine_rank $SLURM_PROCID \
|
| 382 |
+
--num_machines $SLURM_NNODES \
|
| 383 |
+
--num_processes=${TOTAL_GPUS} \
|
| 384 |
+
starVLA/training/train_starvla.py \
|
| 385 |
+
--config_yaml ./starVLA/config/training/starvla_cotrain_oxe.yaml \
|
| 386 |
+
--framework.framework_py QwenGR00T \
|
| 387 |
+
--framework.qwenvl.base_vlm microsoft/Florence-2-large \
|
| 388 |
+
--run_root_dir ${run_root_dir} \
|
| 389 |
+
--run_id ${run_id} \
|
| 390 |
+
--wandb_project your_project \
|
| 391 |
+
--wandb_entity your_name
|
| 392 |
+
```
|
| 393 |
+
|
| 394 |
+
Note: To ensure better compatibility with already released checkpoints, we are continuing to use `--framework.qwenvl`. This parameter will be unified in the next release.
|
| 395 |
+
|
| 396 |
+
</details>
|
| 397 |
+
|
| 398 |
+
|
| 399 |
+
|
| 400 |
+
## ✍️ Citation & Copyright
|
| 401 |
+
|
| 402 |
+
|
| 403 |
+
StarVLA is released under the MIT License, which permits commercial use, modification, distribution, and private use. Rebases are allowed for forks and feature branches; when rebasing from upstream StarVLA, use descriptive commit messages (e.g., "chore: rebase from StarVLA") and keep at least the two latest upstream commits as separate. See [License](LICENSE) for details.
|
| 404 |
+
|
| 405 |
+
|
| 406 |
+
```
|
| 407 |
+
@misc{starvla2025,
|
| 408 |
+
title = {StarVLA: A Lego-like Codebase for Vision-Language-Action Model Developing},
|
| 409 |
+
author = {starVLA Community},
|
| 410 |
+
url = {https://github.com/starVLA/starVLA}
|
| 411 |
+
year = {2025}
|
| 412 |
+
}
|
| 413 |
+
```
|
| 414 |
+
|
| 415 |
+
|
| 416 |
+
## 🤝 Contributing
|
| 417 |
+
|
| 418 |
+
|
| 419 |
+
1) If you find an issue, please open an Issue first. If it persists or needs clarification, start a Discussion and we’ll follow up.
|
| 420 |
+
|
| 421 |
+
2) If you have ideas to improve StarVLA, feel free to open a PR. To make sure we will accept your effect, please align scope and design first via an Issue or by booking a short sync with this [Cooperation Form](https://forms.gle/R4VvgiVveULibTCCA).
|
| 422 |
+
|
| 423 |
+
3) If you’re blocked or want to brainstorm, please fill out the [Cooperation Form](https://forms.gle/R4VvgiVveULibTCCA). We host office hours every Friday afternoon for live discussion.
|
| 424 |
+
|
| 425 |
+
Tip: Before submitting a PR, run make check locally to pass formatting and lint.
|
| 426 |
+
|
| 427 |
+
|
| 428 |
+
## 🙏 Acknowledgements
|
| 429 |
+
This project draws inspiration and references from several notable open-source initiatives, including:
|
| 430 |
+
- [LeRobot](https://github.com/huggingface/lerobot)
|
| 431 |
+
- [GR00T](https://github.com/NVIDIA/Isaac-GR00T/tree/main)
|
| 432 |
+
- [DeepSpeed](https://github.com/deepspeedai/DeepSpeed)
|
| 433 |
+
- [Qwen-VL](https://github.com/QwenLM/Qwen3-VL/tree/main)
|
| 434 |
+
- [InternVL](https://github.com/OpenGVLab/InternVL)
|
| 435 |
+
|
| 436 |
+
The codebase was originally forked from [InternVLA-M1](https://github.com/InternRobotics/InternVLA-M1).
|
| 437 |
+
|
| 438 |
+
|
| 439 |
+
|
| 440 |
+
# Star History
|
| 441 |
+
Here's how our community has grown over time:
|
| 442 |
+
|
| 443 |
+
[](https://www.star-history.com/#starVLA/starVLA&type=date&legend=bottom-right)
|
| 444 |
+
|
| 445 |
+
|
| 446 |
+
<!-- *Chart updates automatically. Click to interact with the full timeline.* -->
|
THIRD_PARTY_NOTICES.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Third-Party Sources
|
| 2 |
+
|
| 3 |
+
This directory is a private reproducibility archive, not a declaration that
|
| 4 |
+
all upstream code, weights, and assets have one common license.
|
| 5 |
+
|
| 6 |
+
- RoboCasa: original license is retained at `third_party/robocasa/LICENSE`.
|
| 7 |
+
- RoboSuite: upstream license is retained at `third_party/robosuite/LICENSE`.
|
| 8 |
+
Its collection source is recorded in
|
| 9 |
+
`provenance/runtime_versions_and_licenses.json`.
|
| 10 |
+
- pykdl_utils and hrl_geom: original `package.xml` and source copyright
|
| 11 |
+
headers are retained; both package manifests declare BSD. No standalone
|
| 12 |
+
LICENSE file was found in the copied upstream roots. Resolve the complete
|
| 13 |
+
applicable license text before public redistribution.
|
| 14 |
+
- Orocos KDL / PyKDL 1.5.4: the recovered source and its original notices,
|
| 15 |
+
including `orocos_kdl/COPYING`, are vendored. Its pybind11 source/notices
|
| 16 |
+
are also retained. See `provenance/kdl_source.json` for the source revision.
|
| 17 |
+
- GR1 robot geometry and RoboCasa object assets: preserve all embedded
|
| 18 |
+
notices; their redistribution rights must be reviewed separately.
|
| 19 |
+
- Original starVLA, NVIDIA simulation wrappers, VJEPA, model metadata, and
|
| 20 |
+
other source headers/notices are preserved. Backbone weight licenses must
|
| 21 |
+
also be reviewed before distribution; do not relicense them as project code.
|
| 22 |
+
|
| 23 |
+
The owner authorized a private Hugging Face archive. This does not authorize
|
| 24 |
+
public redistribution. No public-distribution license or permission has been
|
| 25 |
+
inferred from local access to these resources.
|
TRAINING_PROVENANCE.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Training Provenance
|
| 2 |
+
|
| 3 |
+
## What Was Recovered
|
| 4 |
+
|
| 5 |
+
- Run-saved `provenance/training/run_yzh_cosmos25_perceiver_vjepa2_ac_resume.sh`.
|
| 6 |
+
- The run's saved `config.yaml`, `dataset_statistics.json`, and
|
| 7 |
+
`summary.jsonl`, under `provenance/training/`.
|
| 8 |
+
- Trainer source `starVLA/training/train_starvla.py` and data/model source.
|
| 9 |
+
- Per-file source hashes and original modification times in
|
| 10 |
+
`provenance/source_snapshot.json`.
|
| 11 |
+
|
| 12 |
+
The current project and its `_back` copy were compared during collection;
|
| 13 |
+
the selected code contents were identical. A backup directory name is not
|
| 14 |
+
evidence of a separate historical version. Original notebook checkpoints,
|
| 15 |
+
where present, are retained as evidence, not substituted automatically.
|
| 16 |
+
|
| 17 |
+
## Run Identity
|
| 18 |
+
|
| 19 |
+
- Model run: `cosmopredict25_vjepa_ImageLatent/robocasa_06-28-13-10`.
|
| 20 |
+
- Selected released checkpoint step: 280000.
|
| 21 |
+
- Dataset mixture: `robocasa_teleop_ee`, original root
|
| 22 |
+
`/mnt/workspace/datasets/`.
|
| 23 |
+
- Dataset files were NOT migrated. The saved normalization statistics were.
|
| 24 |
+
- Final run configuration takes precedence over stale comments or today's
|
| 25 |
+
example launch scripts.
|
| 26 |
+
|
| 27 |
+
WM4A resumes from
|
| 28 |
+
`robocasa_06-26-16-51/checkpoints/steps_180000_pytorch_model.pt`.
|
| 29 |
+
The selected 280000-step checkpoint is from the resumed run.
|
| 30 |
+
|
| 31 |
+
Initialization resources in the archived script:
|
| 32 |
+
|
| 33 |
+
- Cosmos-Predict2.5-2B-Post-Trained, revision
|
| 34 |
+
`diffusers/base/post-trained`.
|
| 35 |
+
- VJEPA2-AC `vjepa2-ac-vitg.pt` and the vendored VJEPA repository.
|
| 36 |
+
- The preceding 180000-step policy checkpoint.
|
| 37 |
+
|
| 38 |
+
The archived script's comment says 25000/50000 steps and loss 0.05, but its
|
| 39 |
+
actual arguments and saved config specify 180000-step resume, 300000 target
|
| 40 |
+
steps, and future-latent loss weight 0.01. Do not use that comment as protocol.
|
| 41 |
+
Saved per-device batch size is 14, checkpoint interval 20000, warmup 2000.
|
| 42 |
+
|
| 43 |
+
## Limits And Safe Use
|
| 44 |
+
|
| 45 |
+
Exact training reproduction is NOT validated. No training was launched.
|
| 46 |
+
The archived scripts contain historical absolute paths and eight-GPU defaults;
|
| 47 |
+
they are evidence, not safe one-click commands for a shared host. Update paths,
|
| 48 |
+
obtain an explicit allocation, and set `CUDA_VISIBLE_DEVICES` before adapting
|
| 49 |
+
them. Required datasets, initialization weights, and any optimizer/resume
|
| 50 |
+
states have not been bundled or proven complete.
|
| 51 |
+
|
| 52 |
+
The evaluation preparer reconstructs initialization files from the FINAL
|
| 53 |
+
policy checkpoint. These files are suitable for loading that policy, not for
|
| 54 |
+
reconstructing its original training initialization.
|
VALIDATION.md
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 4 |
+
|
| 5 |
+
## Current Result
|
| 6 |
+
|
| 7 |
+
The full migrated RoboCasa benchmark was STOPPED at the user's request at
|
| 8 |
+
2026-09-25T16:21:29Z (September 26, 00:21:29 Asia/Shanghai).
|
| 9 |
+
Closed-loop effectiveness has NOT been reproduced. The completed first task,
|
| 10 |
+
cup-to-drawer-close, scored 0/50 versus the historical 11/50. The next task
|
| 11 |
+
was interrupted and must not be counted as a finished result.
|
| 12 |
+
No new complete 24-task mean success rate is available.
|
| 13 |
+
|
| 14 |
+
- Host: exact SSH alias `perdon-hou`, verified hostname `nb-5pl2apckdj-0`.
|
| 15 |
+
- Checkpoint: step 280000; original pinned SHA-256 verified.
|
| 16 |
+
- Strict checkpoint load passed in both the precheck and the full-run process.
|
| 17 |
+
- Policy GPU: 0; simulation CUDA/EGL GPU: 1.
|
| 18 |
+
- Stopped full-run coordinator PID: 538455; its recorded children also exited.
|
| 19 |
+
- Full-run output: `/mnt/workspace/users/maxiangkai/migrations/MaskWAM_WM4A_perdon_hou_20260925T143800Z/WM4A/.runtime/full_01`.
|
| 20 |
+
- Historical mean (reference only, NOT a new result): 56.17%.
|
| 21 |
+
|
| 22 |
+
## Open-Loop Diagnostics
|
| 23 |
+
|
| 24 |
+
36 fixed demonstration windows from 9 episodes and 3 tasks were tested with
|
| 25 |
+
the original checkpoint normalization statistics and per-window seeds.
|
| 26 |
+
The original project/initialization paths and the migrated paths produced
|
| 27 |
+
bitwise-identical predictions for both tested input pipelines (72 paired
|
| 28 |
+
predictions, maximum absolute difference 0).
|
| 29 |
+
|
| 30 |
+
| Input Pipeline | Active-Dimension Action MAE |
|
| 31 |
+
| --- | ---: |
|
| 32 |
+
| Evaluation client inputs | 0.03853773 |
|
| 33 |
+
| Dataset EE state instead of client FK | 0.03853773 |
|
| 34 |
+
| Subtask prompt instead of Task prompt | 0.03840540 |
|
| 35 |
+
| Dataset EE state, Subtask prompt, PIL resize | 0.03988905 |
|
| 36 |
+
|
| 37 |
+
Metrics use the first 12 executed actions, 27 active normalized dimensions.
|
| 38 |
+
These are demonstration diagnostics, not held-out success rates.
|
| 39 |
+
FK versus preconverted EE states has maximum position discrepancy below
|
| 40 |
+
4e-8 m. Changing only the state to dataset EE values changes predicted
|
| 41 |
+
actions by at most 3.19e-6, not exactly zero.
|
| 42 |
+
|
| 43 |
+
Ground-truth EE actions passed 864 IK checks with no residual exceeding
|
| 44 |
+
1 mm or 0.01 rad. Predicted actions exceeded that threshold on 12/864
|
| 45 |
+
checks (3 cup, 9 potato). Four fixed-seed tests with future-image generation
|
| 46 |
+
enabled showed no change to the current or subsequent action prediction.
|
| 47 |
+
Three reset-only simulator observations were captured without policy steps;
|
| 48 |
+
their images are not blank, and the inspected frame has the expected
|
| 49 |
+
orientation and cropped/padded camera layout.
|
| 50 |
+
|
| 51 |
+
This does NOT establish the cause of the 0/50 regression or prove July
|
| 52 |
+
runtime equivalence. The source-path A/B used today's available original
|
| 53 |
+
code and the same current policy environment, not an immutable July runtime.
|
| 54 |
+
The 222 vendored RoboSuite source files match the collected
|
| 55 |
+
`robocasa_liao` source; differences in another editable RoboSuite checkout
|
| 56 |
+
are not evidence that the migrated evaluation used it.
|
| 57 |
+
|
| 58 |
+
Detailed evidence and runnable diagnostic scripts:
|
| 59 |
+
`provenance/validation/wm4a_openloop_20260925T163212Z/`.
|
| 60 |
+
The WM4A full evaluation remains stopped. No model weights, training code,
|
| 61 |
+
simulator source, shared environment, or driver were modified by these tests.
|
| 62 |
+
|
| 63 |
+
## Controlled Follow-Up
|
| 64 |
+
|
| 65 |
+
Evidence: `provenance/validation/wm4a_followup_20260925T170412Z/REPORT.md`.
|
| 66 |
+
The historical effectiveness regression remains unresolved. The full sweep
|
| 67 |
+
was not restarted, and no experimental IK change was promoted to default.
|
| 68 |
+
|
| 69 |
+
The original cup demonstration (LeRobot episode 0 / HDF5 demo_245) was restored
|
| 70 |
+
with bitwise-identical initial simulator state. Recorded joint actions and
|
| 71 |
+
recorded EE actions through the actual WM4A client/IK both completed the task
|
| 72 |
+
from step 213. Model-driven execution from that same state failed after
|
| 73 |
+
720 steps. This validates that particular demonstration/control path, not
|
| 74 |
+
all scenes or historical runtime equivalence.
|
| 75 |
+
|
| 76 |
+
In a separate fixed-constructor-seed scene, the baseline, per-chunk IK-cache
|
| 77 |
+
reset, and bounded 5 mm approximate IK fallback all failed. Their initial
|
| 78 |
+
state, scene XML and first prediction were identical. IK residual misses
|
| 79 |
+
at the common 1 mm / 0.01 rad threshold were 429, 317 and 427 out of 1440.
|
| 80 |
+
No transient successful substep was omitted by the legacy aggregation in
|
| 81 |
+
the five model-driven diagnostic episodes.
|
| 82 |
+
|
| 83 |
+
The controlled BF16 implementation matched all 36 prior open-loop outputs
|
| 84 |
+
bitwise. Restoring action-head weights in FP32 changed MAE only from
|
| 85 |
+
0.03853773 to 0.03852874. All 901 Diffusers and 2347 Transformers Python
|
| 86 |
+
files compared against the June 16 environment archive matched.
|
| 87 |
+
|
| 88 |
+
The diagnostic now distinguishes clipped actuator tracking error from raw
|
| 89 |
+
hand-command differences, and explicitly seeds RoboSuite's constructor.
|
| 90 |
+
Merely calling reset(seed) does not seed its separate RNG. These corrections
|
| 91 |
+
are isolated diagnostic changes; the release's general --seed path is not
|
| 92 |
+
certified for multi-episode determinism.
|
| 93 |
+
|
| 94 |
+
All 1505 sealed source hashes and four release unit tests passed. The
|
| 95 |
+
diagnostic server and rollout processes exited; MaskWAM and unrelated jobs
|
| 96 |
+
were not signaled. The evidence preserves scripts, predictions, simulator
|
| 97 |
+
states, source frames, execution records, and checksums.
|
| 98 |
+
|
| 99 |
+
## Conditioning And Replanning
|
| 100 |
+
|
| 101 |
+
Evidence: `provenance/validation/wm4a_conditioning_20260925T175334Z/REPORT.md`.
|
| 102 |
+
No repair was promoted and the full benchmark remains stopped.
|
| 103 |
+
|
| 104 |
+
The 36 fixed windows were tested with seven paired conditions. Baseline
|
| 105 |
+
outputs again match the prior predictions bitwise. Image, language, and state
|
| 106 |
+
interventions change internal features and actions; no entire input branch
|
| 107 |
+
was found disconnected. Normalized MAE was 0.03854 at baseline, 0.16592 with
|
| 108 |
+
black images, 0.16410 with other-task images, 0.05666 with other-task language,
|
| 109 |
+
and 0.27769 with other-task states. These interventions are not realistic
|
| 110 |
+
evaluation conditions or proof of correct task understanding.
|
| 111 |
+
|
| 112 |
+
At the matched demonstration start, replacing the recorded frame with the
|
| 113 |
+
reconstructed frame changes target positions by only 3.61/2.89 mm on average
|
| 114 |
+
for left/right arms and slightly improves this window's error. This is not
|
| 115 |
+
a validation of all subsequent rendered observations.
|
| 116 |
+
|
| 117 |
+
Six-step rather than twelve-step execution was tested in two paired scenes,
|
| 118 |
+
with initial simulator state, XML, first input and prediction all identical.
|
| 119 |
+
Model seeds were aligned at shared physical timesteps. Both episodes failed
|
| 120 |
+
after 720 steps. IK misses changed from 386 to 187 in demo_245 and from 429
|
| 121 |
+
to zero in the seeded random scene, out of 1440 calls each. Thus IK failure
|
| 122 |
+
alone does not explain every unsuccessful episode.
|
| 123 |
+
|
| 124 |
+
A further oracle-conditioned replay used the original demonstration images
|
| 125 |
+
and states for all 19 model calls. Its predicted actions failed over the
|
| 126 |
+
demonstration's 228 transitions, while both recorded-action controls succeeded
|
| 127 |
+
from step 213. Mean EE target errors were 4.55/2.78 cm and mean orientation
|
| 128 |
+
errors 0.167/0.178 rad. This is not autonomous evaluation, and recorded future
|
| 129 |
+
inputs can become inconsistent with the evolving scene. It shows that
|
| 130 |
+
correcting the input distribution alone was insufficient in this case.
|
| 131 |
+
|
| 132 |
+
The v1 diagnostic's all-dimension `hold_state` metric is invalid because hand
|
| 133 |
+
observations and action commands use different conventions. It is preserved
|
| 134 |
+
but explicitly excluded in `conditioning/metrics_corrected.json` and
|
| 135 |
+
`comparison.json`. Only the direct EE XYZ hold baseline is used.
|
| 136 |
+
|
| 137 |
+
All experiments were bounded and their processes exited. The sealed model
|
| 138 |
+
and simulator sources, checkpoints, shared environments, and other jobs were
|
| 139 |
+
not changed. The historical effectiveness discrepancy remains unresolved.
|
| 140 |
+
|
| 141 |
+
## Action Components And Sampling
|
| 142 |
+
|
| 143 |
+
Evidence: `provenance/validation/wm4a_action_components_20260925T184142Z/REPORT.md`.
|
| 144 |
+
No repair was promoted; the full benchmark remains stopped.
|
| 145 |
+
|
| 146 |
+
Six component replays used the same demonstration, 19 recorded-input model
|
| 147 |
+
calls, and 228 executed transitions. Actual restored simulator states match
|
| 148 |
+
bitwise, as do all untouched action channels. The unchanged model reproduces
|
| 149 |
+
the prior failed replay exactly. Replacing only both arms' Cartesian XYZ with
|
| 150 |
+
recorded targets succeeds from step 215. Full recorded actions and recorded
|
| 151 |
+
complete EE poses succeed from steps 213 and 216. Replacing only rotations or
|
| 152 |
+
hand commands still fails. These are oracle-action interventions on one scene,
|
| 153 |
+
not autonomous evaluation or a validated repair.
|
| 154 |
+
|
| 155 |
+
The real collected training transforms and mixture sample assembly were
|
| 156 |
+
exercised on 55 windows without constructing shared caches. Layout and masks
|
| 157 |
+
match the expected 64-state/32-action padded schema; all 36 prior training
|
| 158 |
+
images and prompts match exactly. FP16 intermediate casting changes 83/3520
|
| 159 |
+
state elements after BF16 conversion. Independently merging the current
|
| 160 |
+
24-dataset min/max statistics exactly reproduces the checkpoint's state and
|
| 161 |
+
action bounds. This is not immutable historical training-source validation.
|
| 162 |
+
|
| 163 |
+
Nineteen baseline predictions and their isolated head replays match bitwise.
|
| 164 |
+
With fixed backbone/VAE features, eight independent head draws have conditional
|
| 165 |
+
XYZ spread of 0.945/0.688 cm RMS versus finite-sample mean errors of
|
| 166 |
+
5.424/3.483 cm RMS against the demonstration. This weakens a pure head-noise
|
| 167 |
+
explanation on these windows, not every possible source of randomness.
|
| 168 |
+
|
| 169 |
+
Four inference variants were replayed without replacing action targets:
|
| 170 |
+
eight-draw XYZ averaging, 80 instead of 20 integration steps, training state
|
| 171 |
+
casting only, and complete current training inputs. All fail and none brings
|
| 172 |
+
the cup into the drawer. XYZ averaging and denser integration reduce maximum
|
| 173 |
+
cup lift to about 1.21 and 0.71 cm. Small normalized-MAE improvements do not
|
| 174 |
+
justify adopting a candidate.
|
| 175 |
+
|
| 176 |
+
CPU-only state-encoder comparisons across five checkpoints are consistent
|
| 177 |
+
with the current padded input layout, but cannot prove historical semantics.
|
| 178 |
+
All diagnostic jobs exited. One failed CPU-only launcher path attempt is
|
| 179 |
+
retained alongside its successful retry. All 1505 sealed source hashes and
|
| 180 |
+
four release tests passed locally and remotely. No original weights, sealed
|
| 181 |
+
sources, dataset metadata, shared environment, or unrelated jobs were changed.
|
| 182 |
+
|
| 183 |
+
## Completed Precheck
|
| 184 |
+
|
| 185 |
+
The cutting-board-to-pan task completed one whole episode: 60 finite action
|
| 186 |
+
chunks of shape [1, 12, 29], with up to 12 simulator steps per chunk and a
|
| 187 |
+
720-step episode cap.
|
| 188 |
+
The task outcome was 0/1; elapsed simulation time was
|
| 189 |
+
130.46 seconds. This single episode is a runtime
|
| 190 |
+
check, not an estimate of the 24-task mean.
|
| 191 |
+
|
| 192 |
+
The first attempt used GPU 0 for both policy and rendering and aborted in MuJoCo read_pixels after 40 action calls. No new kernel Xid was observed. The successful end-to-end retest kept policy inference on GPU 0 and moved simulation CUDA/EGL to GPU 1 through the archived host-only sim-python-render1 wrapper. The original failed evidence is retained; no model or task source was changed.
|
| 193 |
+
|
| 194 |
+
## Protocol And Environment
|
| 195 |
+
|
| 196 |
+
The stopped sweep requested 24 tasks with 50 episodes each, n_envs=1,
|
| 197 |
+
720 maximum simulator steps, action chunks of 12, shift=5.0, and
|
| 198 |
+
the historical top-level inference argument of 5. The action head actually
|
| 199 |
+
uses its saved `num_inference_timesteps=20`; the top-level argument is not
|
| 200 |
+
forwarded to that action branch. As in the original scripts, no seed was
|
| 201 |
+
applied. Independent unseeded reruns are not bitwise-identical reproductions.
|
| 202 |
+
|
| 203 |
+
Full-run video encoding was disabled. Camera observation rendering and
|
| 204 |
+
future-image inference were enabled. Precheck videos remain on the server.
|
| 205 |
+
|
| 206 |
+
The repository's sealed sources and the 44,901 simulation asset files were
|
| 207 |
+
verified. The pinned policy and simulation environments passed their CPU
|
| 208 |
+
doctor checks. Simulation uses the rebuilt KDL/PyKDL 1.5.4 rather than this
|
| 209 |
+
host's system KDL 1.5.1. Host-native NVIDIA EGL libraries are used; no driver
|
| 210 |
+
reset, replacement, or other user's process management was performed.
|
| 211 |
+
|
| 212 |
+
Code was copied from the latest case-safe Mac release. Existing checkpoints,
|
| 213 |
+
backbone caches, environments, and simulation assets were reused on the shared
|
| 214 |
+
filesystem, with new per-host runtime configs in an isolated directory.
|
| 215 |
+
|
| 216 |
+
Initial evidence is in `provenance/validation/perdon_hou_20260925T143800Z/`.
|
| 217 |
+
Its original status snapshots predate the user-requested stop; the new
|
| 218 |
+
open-loop evidence contains the stop record and updated process snapshot.
|
| 219 |
+
Incomplete runs must not be reported as the full benchmark.
|
| 220 |
+
|
| 221 |
+
Clean-machine installation remains unvalidated. The owner has now authorized
|
| 222 |
+
private publication; upload completion is recorded separately in publication receipts.
|
checkpoints/README.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Selected Checkpoint
|
| 2 |
+
|
| 3 |
+
Filename: `steps_280000_pytorch_model.pt`.
|
| 4 |
+
|
| 5 |
+
Bytes: 24232783701
|
| 6 |
+
|
| 7 |
+
SHA-256: `eeba9505f715b582a054baac1ef5b599f1da225cabcc060631c23f2f47affe6c`
|
| 8 |
+
|
| 9 |
+
Included in private repository `mxk1998/WM4A`. Run `hf download mxk1998/WM4A --local-dir WM4A` to download code, metadata, assets, and weights together. Original source provenance is retained in `release_manifest.json`.
|
deployment/__init__.py
ADDED
|
File without changes
|
deployment/model_server/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# start policy server
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
```bash
|
| 6 |
+
|
| 7 |
+
your_ckpt=./results/Checkpoints/1003_qwenfast/checkpoints/steps_50000_pytorch_model.pt
|
| 8 |
+
|
| 9 |
+
python deployment/model_server/server_policy.py \
|
| 10 |
+
--ckpt_path ${your_ckpt} \
|
| 11 |
+
--port 10093 \
|
| 12 |
+
--use_bf16
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# connect to policy server for debug
|
| 17 |
+
|
| 18 |
+
```bash
|
| 19 |
+
python deployment/model_server/debug_server_policy.py
|
| 20 |
+
|
| 21 |
+
# plus server_policy.py into your vla controler by ref to debug_server_policy.py
|
| 22 |
+
```
|
deployment/model_server/__init__.py
ADDED
|
File without changes
|
deployment/model_server/server_policy.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2025 starVLA community. All rights reserved.
|
| 2 |
+
# Licensed under the MIT License, Version 1.0 (the "License");
|
| 3 |
+
# Implemented by [Jinhui YE / HKUST University] in [2025].
|
| 4 |
+
|
| 5 |
+
import logging
|
| 6 |
+
import socket
|
| 7 |
+
import argparse
|
| 8 |
+
from deployment.model_server.tools.websocket_policy_server import WebsocketPolicyServer
|
| 9 |
+
from starVLA.model.framework.base_framework import baseframework
|
| 10 |
+
import torch, os
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def main(args) -> None:
|
| 14 |
+
# Example usage:
|
| 15 |
+
# policy = YourPolicyClass() # Replace with your actual policy class
|
| 16 |
+
# server = WebsocketPolicyServer(policy, host="localhost", port=10091)
|
| 17 |
+
# server.serve_forever()
|
| 18 |
+
|
| 19 |
+
vla = baseframework.from_pretrained( # TODO should auto detect framework from model path
|
| 20 |
+
args.ckpt_path,
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
if args.use_bf16: # False
|
| 24 |
+
vla = vla.to(torch.bfloat16)
|
| 25 |
+
vla = vla.to("cuda").eval()
|
| 26 |
+
|
| 27 |
+
hostname = socket.gethostname()
|
| 28 |
+
local_ip = socket.gethostbyname(hostname)
|
| 29 |
+
logging.info("Creating server (host: %s, ip: %s)", hostname, local_ip)
|
| 30 |
+
|
| 31 |
+
# start websocket server
|
| 32 |
+
server = WebsocketPolicyServer(
|
| 33 |
+
policy=vla,
|
| 34 |
+
host="0.0.0.0",
|
| 35 |
+
port=args.port,
|
| 36 |
+
idle_timeout=args.idle_timeout,
|
| 37 |
+
metadata={"env": "simpler_env"},
|
| 38 |
+
)
|
| 39 |
+
logging.info("server running ...")
|
| 40 |
+
server.serve_forever()
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def build_argparser():
|
| 44 |
+
parser = argparse.ArgumentParser()
|
| 45 |
+
parser.add_argument("--ckpt_path", type=str, default="Qwen/Qwen2.5-VL-3B-Instruct")
|
| 46 |
+
parser.add_argument("--port", type=int, default=10093)
|
| 47 |
+
parser.add_argument("--use_bf16", action="store_true")
|
| 48 |
+
parser.add_argument("--idle_timeout" , type=int, default=1800, help="Idle timeout in seconds, -1 means never close")
|
| 49 |
+
return parser
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def start_debugpy_once():
|
| 53 |
+
"""start debugpy once"""
|
| 54 |
+
import debugpy
|
| 55 |
+
if getattr(start_debugpy_once, "_started", False):
|
| 56 |
+
return
|
| 57 |
+
debugpy.listen(("0.0.0.0", 10095))
|
| 58 |
+
print("🔍 Waiting for VSCode attach on 0.0.0.0:10095 ...")
|
| 59 |
+
debugpy.wait_for_client()
|
| 60 |
+
start_debugpy_once._started = True
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
if __name__ == "__main__":
|
| 64 |
+
logging.basicConfig(level=logging.INFO, force=True)
|
| 65 |
+
parser = build_argparser()
|
| 66 |
+
args = parser.parse_args()
|
| 67 |
+
if os.getenv("DEBUG", False):
|
| 68 |
+
print("🔍 DEBUGPY is enabled")
|
| 69 |
+
start_debugpy_once()
|
| 70 |
+
main(args)
|
deployment/model_server/tools/__init__.py
ADDED
|
File without changes
|
deployment/model_server/tools/debug_server_policy.py
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Debug / smoke-test client for deployment/model_server/server_policy.py.
|
| 3 |
+
|
| 4 |
+
Purpose:
|
| 5 |
+
- Establish a WebSocket connection to the policy server.
|
| 6 |
+
- Initialize device on the server side.
|
| 7 |
+
- Optionally run a very simple inference request to verify end-to-end transport
|
| 8 |
+
(serialization + server handling).
|
| 9 |
+
|
| 10 |
+
Usage example:
|
| 11 |
+
python debug_server_policy.py --host 127.0.0.1 --port 10093 --device cuda --test infer
|
| 12 |
+
|
| 13 |
+
Notes:
|
| 14 |
+
- The random observation is synthetic and only meant to validate the interface.
|
| 15 |
+
- Adjust keys (e.g. 'images', 'task_description') to match the server's expected schema.
|
| 16 |
+
"""
|
| 17 |
+
|
| 18 |
+
import argparse
|
| 19 |
+
import logging
|
| 20 |
+
import numpy as np
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
from tools.websocket_policy_client import WebsocketClientPolicy
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def _build_argparser() -> argparse.ArgumentParser:
|
| 27 |
+
ap = argparse.ArgumentParser(description="WebSocket policy client smoke test (msgpack protocol)")
|
| 28 |
+
ap.add_argument("--host", default="127.0.0.1", help="server hostname/IP (do not use 0.0.0.0)")
|
| 29 |
+
ap.add_argument("--port", type=int, default=10093, help="server port")
|
| 30 |
+
ap.add_argument("--api_key", default="", help="optional: API key for authentication")
|
| 31 |
+
ap.add_argument("--device", default="cuda", choices=["cuda", "cpu"], help="initialize device")
|
| 32 |
+
ap.add_argument(
|
| 33 |
+
"--test", choices=["init", "infer"], default="infer", help="test mode: only initialize, or try simple inference"
|
| 34 |
+
)
|
| 35 |
+
ap.add_argument("--log_level", default="INFO")
|
| 36 |
+
return ap
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def _main():
|
| 40 |
+
args = _build_argparser().parse_args()
|
| 41 |
+
logging.basicConfig(level=getattr(logging, args.log_level.upper(), logging.INFO), force=True)
|
| 42 |
+
|
| 43 |
+
client = WebsocketClientPolicy(host=args.host, port=args.port, api_key=(args.api_key or None))
|
| 44 |
+
logging.info("Connected. Server metadata: %s", client.get_server_metadata())
|
| 45 |
+
|
| 46 |
+
# 1) device initialization
|
| 47 |
+
init_ret = client.init_device(args.device) # here to set some things on the server
|
| 48 |
+
logging.info("Init device resp: %s", init_ret)
|
| 49 |
+
|
| 50 |
+
# 2) optional: try one simple inference
|
| 51 |
+
if args.test == "infer":
|
| 52 |
+
try:
|
| 53 |
+
# build observation aligned with model API
|
| 54 |
+
H, W = 224, 224
|
| 55 |
+
img = np.random.randint(0, 256, (H, W, 3), dtype=np.uint8)
|
| 56 |
+
wrist_img = np.random.randint(0, 256, (H, W, 3), dtype=np.uint8)
|
| 57 |
+
state = np.zeros((7,), dtype=np.float32) # [x,y,z, ax,ay,az, gripper]
|
| 58 |
+
|
| 59 |
+
observation = { # key to align with model API
|
| 60 |
+
"request_id": "smoke-test",
|
| 61 |
+
"observation.primary": np.expand_dims(img, axis=0), # (1,H,W,C), uint8 0-255
|
| 62 |
+
"observation.wrist_image": np.expand_dims(wrist_img, axis=0), # (1,H,W,C)
|
| 63 |
+
"observation.state": np.expand_dims(state, axis=0), # (1,7), float32
|
| 64 |
+
"instruction": ["debug: pick up the red block"], # single element list
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
image_path = "assets/table.jpeg"
|
| 68 |
+
# read image as PIL
|
| 69 |
+
from PIL import Image
|
| 70 |
+
image_primary = Image.open(image_path).convert("RGB")
|
| 71 |
+
# Convert PIL -> numpy uint8 (H,W,3)
|
| 72 |
+
image_primary_np = np.asarray(image_primary, dtype=np.uint8)
|
| 73 |
+
|
| 74 |
+
instruction_lang="pick up the red block"
|
| 75 |
+
obs = {
|
| 76 |
+
"request_id": "smoke-test",
|
| 77 |
+
"batch_images": [[image_primary_np]],
|
| 78 |
+
"instructions": [instruction_lang], # assume batch task description
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
infer_ret = client.infer(obs)
|
| 82 |
+
logging.info("Infer resp: %s", infer_ret)
|
| 83 |
+
except Exception as e:
|
| 84 |
+
logging.error("Infer error (this still proves transport OK): %s", e)
|
| 85 |
+
|
| 86 |
+
client.close()
|
| 87 |
+
logging.info("Smoke test done.")
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
if __name__ == "__main__":
|
| 91 |
+
_main()
|
deployment/model_server/tools/image_tools.py
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
from PIL import Image
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def convert_to_uint8(img: np.ndarray) -> np.ndarray:
|
| 6 |
+
"""Converts an image to uint8 if it is a float image.
|
| 7 |
+
|
| 8 |
+
This is important for reducing the size of the image when sending it over the network.
|
| 9 |
+
"""
|
| 10 |
+
if np.issubdtype(img.dtype, np.floating):
|
| 11 |
+
img = (255 * img).astype(np.uint8)
|
| 12 |
+
return img
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def resize_with_pad(images: np.ndarray, height: int, width: int, method=Image.BILINEAR) -> np.ndarray:
|
| 16 |
+
"""Replicates tf.image.resize_with_pad for multiple images using PIL. Resizes a batch of images to a target height.
|
| 17 |
+
|
| 18 |
+
Args:
|
| 19 |
+
images: A batch of images in [..., height, width, channel] format.
|
| 20 |
+
height: The target height of the image.
|
| 21 |
+
width: The target width of the image.
|
| 22 |
+
method: The interpolation method to use. Default is bilinear.
|
| 23 |
+
|
| 24 |
+
Returns:
|
| 25 |
+
The resized images in [..., height, width, channel].
|
| 26 |
+
"""
|
| 27 |
+
# If the images are already the correct size, return them as is.
|
| 28 |
+
if images.shape[-3:-1] == (height, width):
|
| 29 |
+
return images
|
| 30 |
+
|
| 31 |
+
original_shape = images.shape
|
| 32 |
+
|
| 33 |
+
images = images.reshape(-1, *original_shape[-3:])
|
| 34 |
+
resized = np.stack([_resize_with_pad_pil(Image.fromarray(im), height, width, method=method) for im in images])
|
| 35 |
+
return resized.reshape(*original_shape[:-3], *resized.shape[-3:])
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def _resize_with_pad_pil(image: Image.Image, height: int, width: int, method: int) -> Image.Image:
|
| 39 |
+
"""Replicates tf.image.resize_with_pad for one image using PIL. Resizes an image to a target height and
|
| 40 |
+
width without distortion by padding with zeros.
|
| 41 |
+
|
| 42 |
+
Unlike the jax version, note that PIL uses [width, height, channel] ordering instead of [batch, h, w, c].
|
| 43 |
+
"""
|
| 44 |
+
cur_width, cur_height = image.size
|
| 45 |
+
if cur_width == width and cur_height == height:
|
| 46 |
+
return image # No need to resize if the image is already the correct size.
|
| 47 |
+
|
| 48 |
+
ratio = max(cur_width / width, cur_height / height)
|
| 49 |
+
resized_height = int(cur_height / ratio)
|
| 50 |
+
resized_width = int(cur_width / ratio)
|
| 51 |
+
resized_image = image.resize((resized_width, resized_height), resample=method)
|
| 52 |
+
|
| 53 |
+
zero_image = Image.new(resized_image.mode, (width, height), 0)
|
| 54 |
+
pad_height = max(0, int((height - resized_height) / 2))
|
| 55 |
+
pad_width = max(0, int((width - resized_width) / 2))
|
| 56 |
+
zero_image.paste(resized_image, (pad_width, pad_height))
|
| 57 |
+
assert zero_image.size == (width, height)
|
| 58 |
+
return zero_image
|
| 59 |
+
|
| 60 |
+
from typing import Sequence, Union, List, Tuple, Any
|
| 61 |
+
def to_pil_preserve(images: Any, scale_float: bool = True):
|
| 62 |
+
"""
|
| 63 |
+
Convert (possibly nested) numpy image arrays back to PIL.Image WITHOUT changing spatial shape
|
| 64 |
+
or nesting structure.
|
| 65 |
+
|
| 66 |
+
Accepts:
|
| 67 |
+
- np.ndarray with shape (H, W, C), C in {1,3,4}, dtype uint8 or float
|
| 68 |
+
- PIL.Image.Image (returned as-is)
|
| 69 |
+
- Nested list / tuple structures containing the above
|
| 70 |
+
|
| 71 |
+
Guarantees:
|
| 72 |
+
- No resize / pad / crop performed
|
| 73 |
+
- Returns an object with the SAME nesting layout (list -> list, tuple -> tuple)
|
| 74 |
+
- Only dtype (float -> uint8) and channel-mode adaptation may happen
|
| 75 |
+
* float arrays assumed in [0,1] if scale_float=True (scaled *255 + clip)
|
| 76 |
+
Args:
|
| 77 |
+
images: input object / sequence
|
| 78 |
+
scale_float: whether to scale float images in [0,1] to uint8
|
| 79 |
+
Returns:
|
| 80 |
+
Mirrored structure with all leaf nodes as PIL.Image.Image
|
| 81 |
+
"""
|
| 82 |
+
def _convert(obj):
|
| 83 |
+
# Nested containers
|
| 84 |
+
if isinstance(obj, list):
|
| 85 |
+
return [ _convert(x) for x in obj ]
|
| 86 |
+
if isinstance(obj, tuple):
|
| 87 |
+
return tuple(_convert(x) for x in obj)
|
| 88 |
+
|
| 89 |
+
# PIL stays
|
| 90 |
+
if isinstance(obj, Image.Image):
|
| 91 |
+
return obj
|
| 92 |
+
|
| 93 |
+
# numpy -> PIL
|
| 94 |
+
if isinstance(obj, np.ndarray):
|
| 95 |
+
arr = obj
|
| 96 |
+
if arr.ndim != 3:
|
| 97 |
+
raise ValueError(f"Expected 3D array (H,W,C), got shape={arr.shape}")
|
| 98 |
+
if arr.shape[2] not in (1,3,4):
|
| 99 |
+
raise ValueError(f"Channel count must be 1/3/4, got {arr.shape[2]}")
|
| 100 |
+
if np.issubdtype(arr.dtype, np.floating):
|
| 101 |
+
if scale_float:
|
| 102 |
+
arr = np.clip(arr, 0.0, 1.0)
|
| 103 |
+
arr = (arr * 255.0 + 0.5).astype(np.uint8)
|
| 104 |
+
else:
|
| 105 |
+
raise TypeError("Float array provided but scale_float=False")
|
| 106 |
+
elif arr.dtype != np.uint8:
|
| 107 |
+
arr = arr.astype(np.uint8)
|
| 108 |
+
|
| 109 |
+
# Single channel -> 'L'
|
| 110 |
+
if arr.shape[2] == 1:
|
| 111 |
+
arr = arr[:, :, 0]
|
| 112 |
+
return Image.fromarray(arr, mode="L")
|
| 113 |
+
# 3 channels -> RGB, 4 -> RGBA
|
| 114 |
+
mode = "RGB" if arr.shape[2] == 3 else "RGBA"
|
| 115 |
+
return Image.fromarray(arr, mode=mode)
|
| 116 |
+
|
| 117 |
+
raise TypeError(f"Unsupported element type: {type(obj)}")
|
| 118 |
+
|
| 119 |
+
return _convert(images)
|
deployment/model_server/tools/msgpack_numpy.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Adds NumPy array support to msgpack.
|
| 2 |
+
|
| 3 |
+
msgpack is good for (de)serializing data over a network for multiple reasons:
|
| 4 |
+
- msgpack is secure (as opposed to pickle/dill/etc which allow for arbitrary code execution)
|
| 5 |
+
- msgpack is widely used and has good cross-language support
|
| 6 |
+
- msgpack does not require a schema (as opposed to protobuf/flatbuffers/etc) which is convenient in dynamically typed
|
| 7 |
+
languages like Python and JavaScript
|
| 8 |
+
- msgpack is fast and efficient (as opposed to readable formats like JSON/YAML/etc); I found that msgpack was ~4x faster
|
| 9 |
+
than pickle for serializing large arrays using the below strategy
|
| 10 |
+
|
| 11 |
+
The code below is adapted from https://github.com/lebedov/msgpack-numpy. The reason not to use that library directly is
|
| 12 |
+
that it falls back to pickle for object arrays.
|
| 13 |
+
"""
|
| 14 |
+
|
| 15 |
+
import functools
|
| 16 |
+
|
| 17 |
+
import msgpack
|
| 18 |
+
import numpy as np
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def pack_array(obj):
|
| 22 |
+
if (isinstance(obj, (np.ndarray, np.generic))) and obj.dtype.kind in ("V", "O", "c"):
|
| 23 |
+
raise ValueError(f"Unsupported dtype: {obj.dtype}")
|
| 24 |
+
|
| 25 |
+
if isinstance(obj, np.ndarray):
|
| 26 |
+
return {
|
| 27 |
+
b"__ndarray__": True,
|
| 28 |
+
b"data": obj.tobytes(),
|
| 29 |
+
b"dtype": obj.dtype.str,
|
| 30 |
+
b"shape": obj.shape,
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
if isinstance(obj, np.generic):
|
| 34 |
+
return {
|
| 35 |
+
b"__npgeneric__": True,
|
| 36 |
+
b"data": obj.item(),
|
| 37 |
+
b"dtype": obj.dtype.str,
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
return obj
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def unpack_array(obj):
|
| 44 |
+
if b"__ndarray__" in obj:
|
| 45 |
+
return np.ndarray(buffer=obj[b"data"], dtype=np.dtype(obj[b"dtype"]), shape=obj[b"shape"])
|
| 46 |
+
|
| 47 |
+
if b"__npgeneric__" in obj:
|
| 48 |
+
return np.dtype(obj[b"dtype"]).type(obj[b"data"])
|
| 49 |
+
|
| 50 |
+
return obj
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
Packer = functools.partial(msgpack.Packer, default=pack_array)
|
| 54 |
+
packb = functools.partial(msgpack.packb, default=pack_array)
|
| 55 |
+
|
| 56 |
+
Unpacker = functools.partial(msgpack.Unpacker, object_hook=unpack_array)
|
| 57 |
+
unpackb = functools.partial(msgpack.unpackb, object_hook=unpack_array)
|
deployment/model_server/tools/websocket_policy_client.py
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2025 starVLA community. All rights reserved.
|
| 2 |
+
# Licensed under the MIT License, Version 1.0 (the "License");
|
| 3 |
+
# Implemented by [Jinhui YE / HKUST University] in [2025].
|
| 4 |
+
|
| 5 |
+
import logging, argparse
|
| 6 |
+
import time, os
|
| 7 |
+
from typing import Dict, Optional, Tuple
|
| 8 |
+
|
| 9 |
+
from typing_extensions import override
|
| 10 |
+
import websockets.sync.client
|
| 11 |
+
|
| 12 |
+
from . import msgpack_numpy
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
class WebsocketClientPolicy:
|
| 16 |
+
"""Implements the Policy interface by communicating with a server over websocket.
|
| 17 |
+
|
| 18 |
+
See WebsocketPolicyServer for a corresponding server implementation.
|
| 19 |
+
"""
|
| 20 |
+
|
| 21 |
+
def __init__(self, host: str = "127.0.0.1", port: Optional[int] = 10093, api_key: Optional[str] = None) -> None:
|
| 22 |
+
# 0.0.0.0 cannot be used as a connection target, here default 127.0.0.1
|
| 23 |
+
self._uri = f"ws://{host}"
|
| 24 |
+
if port is not None:
|
| 25 |
+
self._uri += f":{port}"
|
| 26 |
+
self._packer = msgpack_numpy.Packer()
|
| 27 |
+
self._api_key = api_key
|
| 28 |
+
self._ws, self._server_metadata = self._wait_for_server()
|
| 29 |
+
|
| 30 |
+
def get_server_metadata(self) -> Dict:
|
| 31 |
+
return self._server_metadata
|
| 32 |
+
|
| 33 |
+
def _wait_for_server(self, timeout: float = 300) -> Tuple[websockets.sync.client.ClientConnection, Dict]:
|
| 34 |
+
logging.info(f"Waiting for server at {self._uri}...")
|
| 35 |
+
start_time = time.time()
|
| 36 |
+
|
| 37 |
+
for k in ("HTTP_PROXY", "http_proxy", "HTTPS_PROXY", "https_proxy", "ALL_PROXY", "all_proxy"):
|
| 38 |
+
os.environ.pop(k, None)
|
| 39 |
+
|
| 40 |
+
while True:
|
| 41 |
+
if time.time() - start_time > timeout:
|
| 42 |
+
raise TimeoutError(f"Failed to connect to server within {timeout} seconds")
|
| 43 |
+
|
| 44 |
+
try:
|
| 45 |
+
headers = {"Authorization": f"Api-Key {self._api_key}"} if self._api_key else None
|
| 46 |
+
conn = websockets.sync.client.connect(
|
| 47 |
+
self._uri,
|
| 48 |
+
compression=None,
|
| 49 |
+
max_size=None,
|
| 50 |
+
additional_headers=headers,
|
| 51 |
+
open_timeout=150,
|
| 52 |
+
ping_interval=20,
|
| 53 |
+
ping_timeout=20,
|
| 54 |
+
)
|
| 55 |
+
metadata = msgpack_numpy.unpackb(conn.recv())
|
| 56 |
+
return conn, metadata
|
| 57 |
+
except ConnectionRefusedError:
|
| 58 |
+
logging.info(f"Still waiting for server {self._uri} ...")
|
| 59 |
+
time.sleep(2)
|
| 60 |
+
|
| 61 |
+
def close(self) -> None:
|
| 62 |
+
try:
|
| 63 |
+
self._ws.close()
|
| 64 |
+
except Exception:
|
| 65 |
+
pass
|
| 66 |
+
|
| 67 |
+
@override
|
| 68 |
+
def predict_action(self, query_info: Dict) -> Dict:
|
| 69 |
+
data = self._packer.pack(query_info)
|
| 70 |
+
self._ws.send(data)
|
| 71 |
+
response = self._ws.recv()
|
| 72 |
+
if isinstance(response, str):
|
| 73 |
+
raise RuntimeError(f"Error in inference server:\n{response}")
|
| 74 |
+
return msgpack_numpy.unpackb(response)
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
|
deployment/model_server/tools/websocket_policy_server.py
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2025 starVLA community. All rights reserved.
|
| 2 |
+
# Licensed under the MIT License, Version 1.0 (the "License");
|
| 3 |
+
# Implemented by [Jinhui YE / HKUST University] in [2025].
|
| 4 |
+
|
| 5 |
+
import asyncio
|
| 6 |
+
import logging
|
| 7 |
+
import traceback
|
| 8 |
+
import time
|
| 9 |
+
|
| 10 |
+
import numpy as np
|
| 11 |
+
import torch
|
| 12 |
+
import websockets.asyncio.server
|
| 13 |
+
import websockets.frames
|
| 14 |
+
from PIL import Image
|
| 15 |
+
|
| 16 |
+
# from openpi_client import base_policy as _base_policy
|
| 17 |
+
from . import msgpack_numpy
|
| 18 |
+
|
| 19 |
+
class WebsocketPolicyServer:
|
| 20 |
+
"""Serves a policy using the websocket protocol. See websocket_client_policy.py for a client implementation.
|
| 21 |
+
|
| 22 |
+
Currently only implements the `load` and `infer` methods.
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
def __init__(
|
| 26 |
+
self,
|
| 27 |
+
policy,
|
| 28 |
+
host: str = "0.0.0.0",
|
| 29 |
+
port: int = 10093,
|
| 30 |
+
idle_timeout: int = -1, # 新增参数,单位秒,-1表示永不关闭
|
| 31 |
+
metadata: dict | None = None,
|
| 32 |
+
|
| 33 |
+
) -> None:
|
| 34 |
+
self._policy = policy #
|
| 35 |
+
self._host = host
|
| 36 |
+
self._port = port
|
| 37 |
+
self._metadata = metadata or {}
|
| 38 |
+
self._idle_timeout = idle_timeout
|
| 39 |
+
self._last_active = time.time()
|
| 40 |
+
logging.getLogger("websockets.server").setLevel(logging.INFO)
|
| 41 |
+
|
| 42 |
+
def serve_forever(self) -> None:
|
| 43 |
+
asyncio.run(self.run())
|
| 44 |
+
|
| 45 |
+
@staticmethod
|
| 46 |
+
def _make_msgpack_safe(obj):
|
| 47 |
+
"""Convert common model outputs into msgpack-serializable objects."""
|
| 48 |
+
if isinstance(obj, Image.Image):
|
| 49 |
+
return np.asarray(obj.convert("RGB"))
|
| 50 |
+
if isinstance(obj, torch.Tensor):
|
| 51 |
+
return obj.detach().cpu().numpy()
|
| 52 |
+
if isinstance(obj, dict):
|
| 53 |
+
return {key: WebsocketPolicyServer._make_msgpack_safe(value) for key, value in obj.items()}
|
| 54 |
+
if isinstance(obj, list):
|
| 55 |
+
return [WebsocketPolicyServer._make_msgpack_safe(value) for value in obj]
|
| 56 |
+
if isinstance(obj, tuple):
|
| 57 |
+
return tuple(WebsocketPolicyServer._make_msgpack_safe(value) for value in obj)
|
| 58 |
+
return obj
|
| 59 |
+
|
| 60 |
+
async def run(self):
|
| 61 |
+
async with websockets.asyncio.server.serve(
|
| 62 |
+
self._handler,
|
| 63 |
+
self._host,
|
| 64 |
+
self._port,
|
| 65 |
+
compression=None,
|
| 66 |
+
max_size=None,
|
| 67 |
+
) as server:
|
| 68 |
+
if self._idle_timeout > 0:
|
| 69 |
+
await self._idle_watchdog(server)
|
| 70 |
+
else:
|
| 71 |
+
await server.serve_forever()
|
| 72 |
+
|
| 73 |
+
async def _idle_watchdog(self, server):
|
| 74 |
+
"""监控空闲时间,超时则关闭服务器"""
|
| 75 |
+
while True:
|
| 76 |
+
await asyncio.sleep(5)
|
| 77 |
+
if time.time() - self._last_active > self._idle_timeout:
|
| 78 |
+
logging.info(f"Idle timeout ({self._idle_timeout}s) reached, shutting down server.")
|
| 79 |
+
server.close()
|
| 80 |
+
await server.wait_closed()
|
| 81 |
+
break
|
| 82 |
+
|
| 83 |
+
async def _handler(self, websocket: websockets.asyncio.server.ServerConnection):
|
| 84 |
+
logging.info(f"Connection from {websocket.remote_address} opened")
|
| 85 |
+
packer = msgpack_numpy.Packer()
|
| 86 |
+
|
| 87 |
+
await websocket.send(packer.pack(self._metadata))
|
| 88 |
+
|
| 89 |
+
while True:
|
| 90 |
+
try:
|
| 91 |
+
msg = msgpack_numpy.unpackb(await websocket.recv())
|
| 92 |
+
self._last_active = time.time() # 每次收到消息刷新活跃时间
|
| 93 |
+
ret = self._route_message(msg) # route message
|
| 94 |
+
await websocket.send(packer.pack(ret))
|
| 95 |
+
except websockets.ConnectionClosed:
|
| 96 |
+
logging.info(f"Connection from {websocket.remote_address} closed")
|
| 97 |
+
break
|
| 98 |
+
except Exception:
|
| 99 |
+
await websocket.send(traceback.format_exc())
|
| 100 |
+
await websocket.close(
|
| 101 |
+
code=websockets.frames.CloseCode.INTERNAL_ERROR,
|
| 102 |
+
reason="Internal server error. Traceback included in previous frame.",
|
| 103 |
+
)
|
| 104 |
+
raise
|
| 105 |
+
|
| 106 |
+
# route logic: recognize request from client
|
| 107 |
+
def _route_message(self, msg: dict) -> dict:
|
| 108 |
+
"""
|
| 109 |
+
Route rules (fault-tolerant):
|
| 110 |
+
- Supports messages of form:
|
| 111 |
+
{"type": "ping|init|infer|reset", "request_id": "...", "payload": {...}}
|
| 112 |
+
or a flat dict (will be treated as payload).
|
| 113 |
+
- Does NOT raise inside this function: all exceptions are caught and encoded in response.
|
| 114 |
+
"""
|
| 115 |
+
req_id = msg.get("request_id", "default")
|
| 116 |
+
mtype = msg.get("type", "infer") # default = infer
|
| 117 |
+
msg # when no explicit payload, treat top-level as payload
|
| 118 |
+
|
| 119 |
+
# ping
|
| 120 |
+
if mtype == "ping":
|
| 121 |
+
return {"status": "ok", "ok": True, "type": "ping", "request_id": req_id}
|
| 122 |
+
|
| 123 |
+
# infer --> framework.predict_action
|
| 124 |
+
elif mtype == "infer" or mtype == "predict_action":
|
| 125 |
+
# Basic payload sanity
|
| 126 |
+
if not isinstance(msg, dict):
|
| 127 |
+
return {
|
| 128 |
+
"status": "error",
|
| 129 |
+
"ok": False,
|
| 130 |
+
"type": "inference_result",
|
| 131 |
+
"request_id": req_id,
|
| 132 |
+
"error": {"message": "Payload must be a dict", "payload_type": str(type(payload))}
|
| 133 |
+
}
|
| 134 |
+
try:
|
| 135 |
+
|
| 136 |
+
ouput_dict = self._policy.predict_action(**msg)
|
| 137 |
+
except Exception as e:
|
| 138 |
+
logging.exception("Policy inference error (request_id=%s)", req_id)
|
| 139 |
+
logging.exception(e)
|
| 140 |
+
|
| 141 |
+
return {
|
| 142 |
+
"status": "error",
|
| 143 |
+
"ok": False,
|
| 144 |
+
"type": "inference_result",
|
| 145 |
+
"request_id": req_id,
|
| 146 |
+
"error": {
|
| 147 |
+
"message": str(e),
|
| 148 |
+
# "traceback": traceback.format_exc(),
|
| 149 |
+
},
|
| 150 |
+
}
|
| 151 |
+
data = self._make_msgpack_safe(ouput_dict)
|
| 152 |
+
return {
|
| 153 |
+
"status": "ok",
|
| 154 |
+
"ok": True,
|
| 155 |
+
"type": "inference_result",
|
| 156 |
+
"request_id": req_id,
|
| 157 |
+
"data": data,
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
# unknow request type
|
| 161 |
+
else:
|
| 162 |
+
return {
|
| 163 |
+
"status": "error",
|
| 164 |
+
"ok": False,
|
| 165 |
+
"type": "unknown",
|
| 166 |
+
"request_id": req_id,
|
| 167 |
+
"error": {"message": f"Unsupported message type '{mtype}'"},
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
if __name__ == "__main__":
|
| 172 |
+
logging.basicConfig(level=logging.INFO, force=True)
|
| 173 |
+
# Example usage:
|
| 174 |
+
# policy = YourPolicyClass() # Replace with your actual policy class
|
| 175 |
+
# server = WebsocketPolicyServer(policy, host="localhost", port=10091)
|
| 176 |
+
# server.serve_forever()
|
| 177 |
+
raise NotImplementedError("This module is not intended to be run directly.")
|
| 178 |
+
#
|
| 179 |
+
# Instead, it should be imported and used in a server context.
|
deployment/readme-deployment.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
sudo ip addr add 172.16.0.100/24 dev enx207bd51a3217
|
| 2 |
+
sudo ip link set enx207bd51a3217 up
|
| 3 |
+
ping 172.16.0.2
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
python -m real_deployment.model_controller_del_ee
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
## install frankx
|
| 10 |
+
conda install frankx
|
| 11 |
+
unzip frankx.zip
|
deployment/real_infer/open_loop_eval.py
ADDED
|
@@ -0,0 +1,315 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import sys
|
| 3 |
+
import time
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
from dataclasses import dataclass, field
|
| 6 |
+
from typing import Dict, List, Optional
|
| 7 |
+
|
| 8 |
+
import numpy as np
|
| 9 |
+
import matplotlib.pyplot as plt
|
| 10 |
+
import torch
|
| 11 |
+
from omegaconf import OmegaConf
|
| 12 |
+
import tyro
|
| 13 |
+
|
| 14 |
+
# ====== 你项目里的 import(按你现有路径保留)======
|
| 15 |
+
from starVLA.dataloader.lerobot_datasets import get_vla_dataset, collate_fn
|
| 16 |
+
from starVLA.model.framework.base_framework import baseframework
|
| 17 |
+
from starVLA.model.framework.share_tools import read_mode_config
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
# -----------------------------
|
| 21 |
+
# 1) 你已有的归一化/反归一化逻辑(原封不动)
|
| 22 |
+
# -----------------------------
|
| 23 |
+
def _minmax_to_minus1_1(x: np.ndarray, stats: dict, eps: float = 1e-6) -> np.ndarray:
|
| 24 |
+
lo = np.asarray(stats["min"], dtype=np.float32)
|
| 25 |
+
hi = np.asarray(stats["max"], dtype=np.float32)
|
| 26 |
+
denom = np.maximum(hi - lo, eps)
|
| 27 |
+
x01 = (x - lo) / denom
|
| 28 |
+
xn = x01 * 2.0 - 1.0
|
| 29 |
+
return xn.astype(np.float32)
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def unnormalize_actions(normalized_actions: np.ndarray, action_norm_stats: Dict[str, np.ndarray]) -> np.ndarray:
|
| 33 |
+
mask = action_norm_stats.get("mask", np.ones_like(action_norm_stats["min"], dtype=bool))
|
| 34 |
+
action_high, action_low = np.array(action_norm_stats["max"]), np.array(action_norm_stats["min"])
|
| 35 |
+
normalized_actions = np.clip(normalized_actions, -1, 1)
|
| 36 |
+
actions = np.where(
|
| 37 |
+
mask,
|
| 38 |
+
(normalized_actions + 1) / 2 * (action_high - action_low) + action_low,
|
| 39 |
+
normalized_actions,
|
| 40 |
+
)
|
| 41 |
+
return actions
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
# -----------------------------
|
| 45 |
+
# 2) Args(按你 server 的 Args 简化必要项)
|
| 46 |
+
# -----------------------------
|
| 47 |
+
@dataclass
|
| 48 |
+
class Args:
|
| 49 |
+
ckpt_path: str = "outputs/suqian_post_train_w_state/checkpoints/steps_80000_pytorch_model.pt"
|
| 50 |
+
unnorm_key: str = "agibot_genie1"
|
| 51 |
+
gripper_threshold: float = 0.5
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
def _build_policy(args: Args):
|
| 55 |
+
vla = baseframework.from_pretrained(args.ckpt_path)
|
| 56 |
+
vla = vla.to("cuda").eval()
|
| 57 |
+
|
| 58 |
+
cfg, norm_stats = read_mode_config(Path(args.ckpt_path))
|
| 59 |
+
unnorm_key = args.unnorm_key
|
| 60 |
+
cfg = OmegaConf.create(cfg)
|
| 61 |
+
|
| 62 |
+
vla.action_norm_stats = norm_stats[unnorm_key]["action"]
|
| 63 |
+
vla.state_norm_stats = norm_stats[unnorm_key]["state"]
|
| 64 |
+
return vla, cfg
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
def _infer_single(policy, obs: Dict, args: Args, gripper_th: float) -> Dict:
|
| 68 |
+
prompt = obs.get("prompt", "")
|
| 69 |
+
|
| 70 |
+
state = np.asarray(obs["observation/state"], dtype=np.float32)
|
| 71 |
+
if state.ndim == 1:
|
| 72 |
+
state = state[None, :]
|
| 73 |
+
elif state.ndim != 2:
|
| 74 |
+
raise ValueError(f"Unexpected state shape: {state.shape}")
|
| 75 |
+
|
| 76 |
+
state_norm = _minmax_to_minus1_1(state, policy.state_norm_stats)
|
| 77 |
+
|
| 78 |
+
fake_data = {
|
| 79 |
+
"image": [
|
| 80 |
+
obs["observation/image"],
|
| 81 |
+
obs["observation/wrist_left_image"],
|
| 82 |
+
obs["observation/wrist_right_image"],
|
| 83 |
+
],
|
| 84 |
+
"lang": prompt,
|
| 85 |
+
"state": state_norm,
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
t0 = time.perf_counter()
|
| 89 |
+
with torch.inference_mode():
|
| 90 |
+
out = policy.predict_action(fake_data)
|
| 91 |
+
infer_ms = (time.perf_counter() - t0) * 1000
|
| 92 |
+
|
| 93 |
+
na = out["normalized_actions"] # (1, 16, D)
|
| 94 |
+
na2 = na[0] # (16, D)
|
| 95 |
+
|
| 96 |
+
raw2 = unnormalize_actions(na2, policy.action_norm_stats) # (16, D)
|
| 97 |
+
actions = raw2[None, ...] # (1, 16, D)
|
| 98 |
+
|
| 99 |
+
return {"actions": actions, "policy_timing": {"infer_ms": infer_ms}}
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
# -----------------------------
|
| 103 |
+
# 3) 从 single_ds.get_step_data 组装 obs / gt_chunk
|
| 104 |
+
# -----------------------------
|
| 105 |
+
def build_obs_from_step_data(step_data: dict, single_ds) -> dict:
|
| 106 |
+
"""
|
| 107 |
+
step_data: single_ds.get_step_data(traj_id, base_index) 的 RAW 输出
|
| 108 |
+
返回:_infer_single 所需的 obs dict
|
| 109 |
+
"""
|
| 110 |
+
video_keys = single_ds.modality_keys["video"]
|
| 111 |
+
if len(video_keys) < 3:
|
| 112 |
+
raise ValueError(f"Need 3 cameras, got video_keys={video_keys}")
|
| 113 |
+
|
| 114 |
+
head = step_data[video_keys[0]][0]
|
| 115 |
+
left = step_data[video_keys[1]][0]
|
| 116 |
+
right = step_data[video_keys[2]][0]
|
| 117 |
+
|
| 118 |
+
# state concat: (T, D_total) -> 取第 0 帧对应 base step
|
| 119 |
+
state_parts = [step_data[k] for k in single_ds.modality_keys["state"]]
|
| 120 |
+
state = np.concatenate(state_parts, axis=1)
|
| 121 |
+
state0 = state[0]
|
| 122 |
+
|
| 123 |
+
# language(通常是 annotation.xxx),get_language 返回 list[str]
|
| 124 |
+
lang_key = single_ds.modality_keys["language"][0]
|
| 125 |
+
lang = step_data[lang_key][0]
|
| 126 |
+
if isinstance(lang, list):
|
| 127 |
+
lang = lang[0]
|
| 128 |
+
|
| 129 |
+
obs = {
|
| 130 |
+
"observation/image": head,
|
| 131 |
+
"observation/wrist_left_image": left,
|
| 132 |
+
"observation/wrist_right_image": right,
|
| 133 |
+
"observation/state": state0,
|
| 134 |
+
"prompt": lang,
|
| 135 |
+
}
|
| 136 |
+
return obs
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
def get_gt_action_chunk(step_data: dict, single_ds) -> np.ndarray:
|
| 140 |
+
action_parts = [step_data[k] for k in single_ds.modality_keys["action"]]
|
| 141 |
+
gt = np.concatenate(action_parts, axis=1) # (H, D)
|
| 142 |
+
return gt
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
# -----------------------------
|
| 146 |
+
# 4) rollout:拼整段 pred/gt(像 gr00t open-loop eval)
|
| 147 |
+
# -----------------------------
|
| 148 |
+
def rollout_open_loop(
|
| 149 |
+
single_ds,
|
| 150 |
+
pi0_policy,
|
| 151 |
+
args: Args,
|
| 152 |
+
traj_id: int,
|
| 153 |
+
steps: int = 200,
|
| 154 |
+
action_horizon: int = 16,
|
| 155 |
+
):
|
| 156 |
+
"""
|
| 157 |
+
返回:
|
| 158 |
+
pred_action_across_time: (actual_steps, D)
|
| 159 |
+
gt_action_across_time: (actual_steps, D)
|
| 160 |
+
infer_ms_list: 每次推理耗时
|
| 161 |
+
"""
|
| 162 |
+
traj_len = int(single_ds.trajectory_lengths[single_ds.get_trajectory_index(traj_id)])
|
| 163 |
+
actual_steps = min(steps, traj_len)
|
| 164 |
+
|
| 165 |
+
pred_list = []
|
| 166 |
+
gt_list = []
|
| 167 |
+
infer_ms_list = []
|
| 168 |
+
|
| 169 |
+
# 每 action_horizon 步推理一次,把 chunk 展开 append
|
| 170 |
+
for t in range(0, actual_steps, action_horizon):
|
| 171 |
+
step_data = single_ds.get_step_data(traj_id, t)
|
| 172 |
+
|
| 173 |
+
obs = build_obs_from_step_data(step_data, single_ds)
|
| 174 |
+
pred = _infer_single(pi0_policy, obs, args, args.gripper_threshold)
|
| 175 |
+
|
| 176 |
+
pred_chunk = pred["actions"][0] # (H, D)
|
| 177 |
+
gt_chunk = get_gt_action_chunk(step_data, single_ds) # (H, D)
|
| 178 |
+
|
| 179 |
+
# 可能最后一段不足 action_horizon(如果 traj 尾巴短),这里裁一下
|
| 180 |
+
remain = actual_steps - t
|
| 181 |
+
pred_chunk = pred_chunk[:remain]
|
| 182 |
+
gt_chunk = gt_chunk[:remain]
|
| 183 |
+
|
| 184 |
+
pred_list.append(pred_chunk)
|
| 185 |
+
gt_list.append(gt_chunk)
|
| 186 |
+
infer_ms_list.append(pred["policy_timing"]["infer_ms"])
|
| 187 |
+
|
| 188 |
+
pred_action_across_time = np.concatenate(pred_list, axis=0)
|
| 189 |
+
gt_action_across_time = np.concatenate(gt_list, axis=0)
|
| 190 |
+
|
| 191 |
+
assert pred_action_across_time.shape == gt_action_across_time.shape, (
|
| 192 |
+
f"pred={pred_action_across_time.shape}, gt={gt_action_across_time.shape}"
|
| 193 |
+
)
|
| 194 |
+
return pred_action_across_time, gt_action_across_time, infer_ms_list
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
# -----------------------------
|
| 198 |
+
# 5) 画图(整段轨迹)
|
| 199 |
+
# -----------------------------
|
| 200 |
+
def plot_action_curves(
|
| 201 |
+
gt: np.ndarray,
|
| 202 |
+
pred: np.ndarray,
|
| 203 |
+
save_path: str,
|
| 204 |
+
dims: Optional[List[int]] = None,
|
| 205 |
+
title: str = "",
|
| 206 |
+
):
|
| 207 |
+
"""
|
| 208 |
+
画每个维度一张子图(很多维会很长,但 debug 很直观)
|
| 209 |
+
"""
|
| 210 |
+
T, D = gt.shape
|
| 211 |
+
if dims is None:
|
| 212 |
+
dims = list(range(D))
|
| 213 |
+
|
| 214 |
+
n = len(dims)
|
| 215 |
+
fig, axes = plt.subplots(nrows=n, ncols=1, figsize=(10, 2.2 * n))
|
| 216 |
+
if n == 1:
|
| 217 |
+
axes = [axes]
|
| 218 |
+
|
| 219 |
+
fig.suptitle(title, fontsize=14)
|
| 220 |
+
|
| 221 |
+
x = np.arange(T)
|
| 222 |
+
for i, d in enumerate(dims):
|
| 223 |
+
ax = axes[i]
|
| 224 |
+
ax.plot(x, gt[:, d], label="gt")
|
| 225 |
+
ax.plot(x, pred[:, d], label="pred")
|
| 226 |
+
ax.set_ylabel(f"dim {d}")
|
| 227 |
+
ax.legend(loc="upper right")
|
| 228 |
+
|
| 229 |
+
axes[-1].set_xlabel("time step")
|
| 230 |
+
plt.tight_layout()
|
| 231 |
+
Path(save_path).parent.mkdir(parents=True, exist_ok=True)
|
| 232 |
+
plt.savefig(save_path, dpi=150)
|
| 233 |
+
plt.close(fig)
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
def plot_error_over_time(gt: np.ndarray, pred: np.ndarray, save_path: str, title: str = ""):
|
| 237 |
+
"""
|
| 238 |
+
画每个时间步的 L2/MSE(按维度平均) 和 MAE(按维度平均)
|
| 239 |
+
"""
|
| 240 |
+
err = pred - gt
|
| 241 |
+
mse_t = np.mean(err**2, axis=1)
|
| 242 |
+
mae_t = np.mean(np.abs(err), axis=1)
|
| 243 |
+
|
| 244 |
+
x = np.arange(len(mse_t))
|
| 245 |
+
fig = plt.figure(figsize=(10, 4))
|
| 246 |
+
plt.plot(x, mse_t, label="MSE per step")
|
| 247 |
+
plt.plot(x, mae_t, label="MAE per step")
|
| 248 |
+
plt.title(title)
|
| 249 |
+
plt.xlabel("time step")
|
| 250 |
+
plt.ylabel("error")
|
| 251 |
+
plt.legend()
|
| 252 |
+
plt.tight_layout()
|
| 253 |
+
Path(save_path).parent.mkdir(parents=True, exist_ok=True)
|
| 254 |
+
plt.savefig(save_path, dpi=150)
|
| 255 |
+
plt.close(fig)
|
| 256 |
+
|
| 257 |
+
|
| 258 |
+
# -----------------------------
|
| 259 |
+
# 6) main:把 dataset + policy 接起来
|
| 260 |
+
# -----------------------------
|
| 261 |
+
def main(args: Args):
|
| 262 |
+
# ===== 2) load policy =====
|
| 263 |
+
pi0_policy, cfg = _build_policy(args)
|
| 264 |
+
print("policy loaded")
|
| 265 |
+
|
| 266 |
+
# ===== 1) 载入训练 yaml,复用你的 dataset 配置 =====
|
| 267 |
+
vla_dataset_cfg = cfg.datasets.vla_data
|
| 268 |
+
vla_dataset_cfg.task_id = "all" # 或者某个 task_id
|
| 269 |
+
# vla_dataset_cfg.data_mix = "suqian_test"
|
| 270 |
+
|
| 271 |
+
dataset = get_vla_dataset(data_cfg=vla_dataset_cfg)
|
| 272 |
+
|
| 273 |
+
# get_vla_dataset 可能返回 mixture(里面有 datasets 列表)
|
| 274 |
+
single_ds = dataset.datasets[0] if hasattr(dataset, "datasets") else dataset
|
| 275 |
+
|
| 276 |
+
# 选一条 traj
|
| 277 |
+
traj_id = int(single_ds.trajectory_ids[0])
|
| 278 |
+
print("Using traj_id:", traj_id)
|
| 279 |
+
|
| 280 |
+
# ===== 3) rollout open-loop =====
|
| 281 |
+
pred, gt, infer_ms_list = rollout_open_loop(
|
| 282 |
+
single_ds,
|
| 283 |
+
pi0_policy,
|
| 284 |
+
args,
|
| 285 |
+
traj_id=traj_id,
|
| 286 |
+
steps=200,
|
| 287 |
+
action_horizon=30,
|
| 288 |
+
)
|
| 289 |
+
|
| 290 |
+
mse = np.mean((pred - gt) ** 2)
|
| 291 |
+
mae = np.mean(np.abs(pred - gt))
|
| 292 |
+
print(f"Open-loop MSE={mse:.6f}, MAE={mae:.6f}")
|
| 293 |
+
print(f"Infer ms: mean={np.mean(infer_ms_list):.2f}, p95={np.percentile(infer_ms_list, 95):.2f}")
|
| 294 |
+
|
| 295 |
+
out_dir = Path("outputs/open_loop_eval")
|
| 296 |
+
out_dir.mkdir(parents=True, exist_ok=True)
|
| 297 |
+
|
| 298 |
+
# ===== 4) 画图 =====
|
| 299 |
+
plot_action_curves(
|
| 300 |
+
gt, pred,
|
| 301 |
+
save_path=str(out_dir / f"traj{traj_id}_action_curves.png"),
|
| 302 |
+
# dims=list(range(min(gt.shape[1], 18))), # 你想只看前 18 维就开这行
|
| 303 |
+
title=f"traj {traj_id} action curves (T={gt.shape[0]}, D={gt.shape[1]})",
|
| 304 |
+
)
|
| 305 |
+
plot_error_over_time(
|
| 306 |
+
gt, pred,
|
| 307 |
+
save_path=str(out_dir / f"traj{traj_id}_error.png"),
|
| 308 |
+
title=f"traj {traj_id} error over time",
|
| 309 |
+
)
|
| 310 |
+
|
| 311 |
+
print("Saved plots to:", out_dir)
|
| 312 |
+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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Pi0 WebSocket 推理服务端,兼容 openpi-client 客户端协议。
|
| 3 |
+
|
| 4 |
+
- 使用 websockets.asyncio.server,客户端用 WebsocketClientPolicy 连接。
|
| 5 |
+
- 首次连接发送 metadata(简单字典)。
|
| 6 |
+
- 收到 obs 后,调用 Pi0 推理并返回 {"actions": np.ndarray, "policy_timing": {"infer_ms": ...}}。
|
| 7 |
+
|
| 8 |
+
支持 joint_position 和 camera_position(通过 state 维度判断:16 -> joint,14 -> camera)。
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import asyncio
|
| 12 |
+
import http
|
| 13 |
+
import os
|
| 14 |
+
import sys
|
| 15 |
+
import time
|
| 16 |
+
import traceback
|
| 17 |
+
from dataclasses import dataclass, field
|
| 18 |
+
from pathlib import Path
|
| 19 |
+
from typing import Dict, List, Literal, Optional
|
| 20 |
+
|
| 21 |
+
import numpy as np
|
| 22 |
+
import tyro
|
| 23 |
+
import websockets.asyncio.server as ws_server
|
| 24 |
+
import websockets.frames
|
| 25 |
+
|
| 26 |
+
import torch
|
| 27 |
+
|
| 28 |
+
# 兼容 protobuf 版本
|
| 29 |
+
os.environ.setdefault("PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION", "python")
|
| 30 |
+
|
| 31 |
+
# 路径设置
|
| 32 |
+
_current_dir = Path(__file__).resolve().parent
|
| 33 |
+
_project_root = _current_dir.parent
|
| 34 |
+
if str(_project_root) not in sys.path:
|
| 35 |
+
sys.path.insert(0, str(_project_root))
|
| 36 |
+
|
| 37 |
+
_openpi_client_src = _project_root / "workspace" / "openpi-client" / "src"
|
| 38 |
+
if _openpi_client_src.exists() and str(_openpi_client_src) not in sys.path:
|
| 39 |
+
sys.path.insert(0, str(_openpi_client_src))
|
| 40 |
+
|
| 41 |
+
from starVLA.model.framework.base_framework import baseframework
|
| 42 |
+
from starVLA.model.framework.share_tools import read_mode_config
|
| 43 |
+
from openpi_client import msgpack_numpy
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
@dataclass
|
| 47 |
+
class Args:
|
| 48 |
+
host: str = "0.0.0.0"
|
| 49 |
+
port: int = 8000
|
| 50 |
+
|
| 51 |
+
ckpt_path: str = "/mnt/workspace/users/yuanzhihao/code/starVLA/outputs/suqian_post_train_no_pretrain/checkpoints/steps_15000_pytorch_model.pt"
|
| 52 |
+
data_statistics_path: str = "/workspace/niejunnan/VLAPipeline_RL_BY_Niejunnan/output_train/agibot/benchmark_pro_max/ds_stats.json"
|
| 53 |
+
language_tokenizer_path: Optional[str] = "/workspace/paligemma-3b-pt-224"
|
| 54 |
+
unnorm_key: Optional[str] = "agibot_genie1"
|
| 55 |
+
policy_setup: str = "agibot_genie1"
|
| 56 |
+
obs_camera_name: List[str] = field(default_factory=lambda: ["head_color", "hand_left", "hand_right"])
|
| 57 |
+
action_scale: float = 1.0
|
| 58 |
+
use_filter: bool = False
|
| 59 |
+
use_multi_action_head: str = "raw"
|
| 60 |
+
use_arm_pose_type: str = "euler"
|
| 61 |
+
use_paligemma_original_vocab_size: bool = True
|
| 62 |
+
n_action_steps: Optional[int] = None
|
| 63 |
+
inference_mode: str = "synchronous"
|
| 64 |
+
# 兼容 pi0inference 期望的其他开关
|
| 65 |
+
use_distillation_distribution: bool = False
|
| 66 |
+
use_embodiment_id: bool = False
|
| 67 |
+
use_vit_for_action_head: bool = False
|
| 68 |
+
use_distillation: bool = False
|
| 69 |
+
use_best_of_n: bool = False
|
| 70 |
+
best_of_n: int = 32
|
| 71 |
+
use_step_action_mask_for_q: bool = False
|
| 72 |
+
|
| 73 |
+
gripper_threshold: float = 0.5
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
# def _build_policy(args: Args) -> LerobotPiFastInference:
|
| 77 |
+
# if not args.data_statistics_path:
|
| 78 |
+
# raise ValueError("需要 --data_statistics_path")
|
| 79 |
+
|
| 80 |
+
# return LerobotPiFastInference(
|
| 81 |
+
# args=args,
|
| 82 |
+
# saved_model_path=args.ckpt_path,
|
| 83 |
+
# policy_setup=args.policy_setup,
|
| 84 |
+
# action_scale=args.action_scale,
|
| 85 |
+
# use_filter=args.use_filter,
|
| 86 |
+
# image_name_list=args.obs_camera_name,
|
| 87 |
+
# data_statistics_path=args.data_statistics_path,
|
| 88 |
+
# language_tokenlizer_path=args.language_tokenizer_path,
|
| 89 |
+
# unnorm_key=args.unnorm_key,
|
| 90 |
+
# use_multi_action_head=args.use_multi_action_head,
|
| 91 |
+
# use_arm_pose_type=args.use_arm_pose_type,
|
| 92 |
+
# inference_mode=args.inference_mode,
|
| 93 |
+
# )
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def _minmax_to_minus1_1(x: np.ndarray, stats: dict, eps: float = 1e-6) -> np.ndarray:
|
| 97 |
+
"""
|
| 98 |
+
x: (..., D)
|
| 99 |
+
stats: contains "min" and "max" (D,)
|
| 100 |
+
return: (..., D) in [-1, 1]
|
| 101 |
+
"""
|
| 102 |
+
lo = np.asarray(stats["min"], dtype=np.float32)
|
| 103 |
+
hi = np.asarray(stats["max"], dtype=np.float32)
|
| 104 |
+
denom = np.maximum(hi - lo, eps)
|
| 105 |
+
x01 = (x - lo) / denom
|
| 106 |
+
xn = x01 * 2.0 - 1.0
|
| 107 |
+
return xn.astype(np.float32)
|
| 108 |
+
|
| 109 |
+
def _sincos_state(x: np.ndarray) -> np.ndarray:
|
| 110 |
+
"""
|
| 111 |
+
x: (B, D) or (D,)
|
| 112 |
+
return: (B, 2D) in [-1, 1]
|
| 113 |
+
"""
|
| 114 |
+
x = np.asarray(x, dtype=np.float32)
|
| 115 |
+
if x.ndim == 1:
|
| 116 |
+
x = x[None, :] # (1, D)
|
| 117 |
+
elif x.ndim != 2:
|
| 118 |
+
raise ValueError(f"Unexpected state shape: {x.shape}")
|
| 119 |
+
|
| 120 |
+
sin_x = np.sin(x)
|
| 121 |
+
cos_x = np.cos(x)
|
| 122 |
+
return np.concatenate([sin_x, cos_x], axis=-1).astype(np.float32) # (B, 2D)
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
def unnormalize_actions(normalized_actions: np.ndarray, action_norm_stats: Dict[str, np.ndarray]) -> np.ndarray:
|
| 126 |
+
"""
|
| 127 |
+
Args:
|
| 128 |
+
normalized_actions: shape (B, chunk, D) (chunk, D)
|
| 129 |
+
action_norm_stats:
|
| 130 |
+
Returns:
|
| 131 |
+
actions
|
| 132 |
+
"""
|
| 133 |
+
mask = action_norm_stats.get("mask", np.ones_like(action_norm_stats["min"], dtype=bool))
|
| 134 |
+
action_high, action_low = np.array(action_norm_stats["max"]), np.array(action_norm_stats["min"])
|
| 135 |
+
|
| 136 |
+
normalized_actions = np.clip(normalized_actions, -1, 1)
|
| 137 |
+
|
| 138 |
+
actions = np.where(
|
| 139 |
+
mask,
|
| 140 |
+
(normalized_actions + 1) / 2 * (action_high - action_low) + action_low,
|
| 141 |
+
normalized_actions,
|
| 142 |
+
)
|
| 143 |
+
|
| 144 |
+
return actions
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
def _build_policy(args: Args):
|
| 148 |
+
vla = baseframework.from_pretrained(args.ckpt_path)
|
| 149 |
+
vla = vla.to("cuda").eval()
|
| 150 |
+
|
| 151 |
+
_, norm_stats = read_mode_config(Path(args.ckpt_path))
|
| 152 |
+
unnorm_key = args.unnorm_key
|
| 153 |
+
|
| 154 |
+
# ✅ action stats(你原来就有)
|
| 155 |
+
vla.action_norm_stats = norm_stats[unnorm_key]["action"]
|
| 156 |
+
|
| 157 |
+
# ✅ state stats(新增:用于输入归一化,训练一致)
|
| 158 |
+
vla.state_norm_stats = norm_stats[unnorm_key]["state"]
|
| 159 |
+
|
| 160 |
+
return vla
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
def _infer_single(policy, obs: Dict, args: Args, gripper_th: float) -> Dict:
|
| 164 |
+
prompt = obs.get("prompt", "")
|
| 165 |
+
print("prompt", prompt)
|
| 166 |
+
|
| 167 |
+
# -------- state: raw -> normalized (min_max to [-1,1]) --------
|
| 168 |
+
state = np.asarray(obs["observation/state"], dtype=np.float32)
|
| 169 |
+
print('state', state.shape, state)
|
| 170 |
+
if state.ndim == 1:
|
| 171 |
+
state = state[None, :] # (1, D)
|
| 172 |
+
elif state.ndim != 2:
|
| 173 |
+
raise ValueError(f"Unexpected state shape: {state.shape}")
|
| 174 |
+
|
| 175 |
+
# ✅ 训练一致:min_max 归一化
|
| 176 |
+
state_norm = _minmax_to_minus1_1(state, policy.state_norm_stats)
|
| 177 |
+
|
| 178 |
+
fake_data = {
|
| 179 |
+
"image": [
|
| 180 |
+
obs["observation/image"],
|
| 181 |
+
obs["observation/wrist_left_image"],
|
| 182 |
+
obs["observation/wrist_right_image"],
|
| 183 |
+
],
|
| 184 |
+
"lang": prompt,
|
| 185 |
+
"state": state_norm, # ✅ 用归一化后的 state
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
print('img', obs["observation/image"].shape)
|
| 189 |
+
raw = state
|
| 190 |
+
sn = state_norm
|
| 191 |
+
print("state raw min/max:", raw.min(), raw.max())
|
| 192 |
+
print("state_norm min/max:", sn.min(), sn.max(), "clip_ratio:", np.mean((sn <= -0.999) | (sn >= 0.999)))
|
| 193 |
+
|
| 194 |
+
t0 = time.perf_counter()
|
| 195 |
+
with torch.inference_mode():
|
| 196 |
+
out = policy.predict_action(fake_data)
|
| 197 |
+
infer_ms = (time.perf_counter() - t0) * 1000
|
| 198 |
+
|
| 199 |
+
# out 来自 predict_action
|
| 200 |
+
na = out["normalized_actions"] # (1, 16, 18) numpy
|
| 201 |
+
|
| 202 |
+
# 1️⃣ 去掉 batch 维
|
| 203 |
+
na2 = na[0] # (16, 18)
|
| 204 |
+
|
| 205 |
+
# 2️⃣ 用 numpy 版 unnormalize(CPU)
|
| 206 |
+
raw2 = unnormalize_actions(
|
| 207 |
+
na2,
|
| 208 |
+
policy.action_norm_stats,
|
| 209 |
+
) # (16, 18)
|
| 210 |
+
|
| 211 |
+
# 3️⃣ 如有需要再加回 batch 维
|
| 212 |
+
actions = raw2[None, ...] # (1, 16, 18)
|
| 213 |
+
print(actions[0, 0])
|
| 214 |
+
|
| 215 |
+
return {"actions": actions, "policy_timing": {"infer_ms": infer_ms}}
|
| 216 |
+
|
| 217 |
+
def _health_check(connection: ws_server.ServerConnection, request: ws_server.Request):
|
| 218 |
+
"""健康检查端点"""
|
| 219 |
+
if request.path == "/healthz":
|
| 220 |
+
return connection.respond(http.HTTPStatus.OK, "OK\n")
|
| 221 |
+
return None
|
| 222 |
+
|
| 223 |
+
|
| 224 |
+
class Pi0PolicyServer:
|
| 225 |
+
"""Pi0 WebSocket 推理服务端"""
|
| 226 |
+
|
| 227 |
+
def __init__(self, pi0_policy, args: Args):
|
| 228 |
+
self._policy = pi0_policy
|
| 229 |
+
self._args = args
|
| 230 |
+
self._metadata = {
|
| 231 |
+
"status": "ok",
|
| 232 |
+
"policy": "pi0",
|
| 233 |
+
"obs_cameras": args.obs_camera_name,
|
| 234 |
+
"action_dim": 14,
|
| 235 |
+
}
|
| 236 |
+
self._packer = msgpack_numpy.Packer()
|
| 237 |
+
|
| 238 |
+
def serve_forever(self) -> None:
|
| 239 |
+
"""阻塞式启动服务"""
|
| 240 |
+
asyncio.run(self._run())
|
| 241 |
+
|
| 242 |
+
async def _run(self):
|
| 243 |
+
"""异步运行服务"""
|
| 244 |
+
async with ws_server.serve(
|
| 245 |
+
self._handler,
|
| 246 |
+
self._args.host,
|
| 247 |
+
self._args.port,
|
| 248 |
+
compression=None,
|
| 249 |
+
max_size=None,
|
| 250 |
+
process_request=_health_check,
|
| 251 |
+
) as server:
|
| 252 |
+
print("✓ 服务已启动,等待客户端连接...")
|
| 253 |
+
await server.serve_forever()
|
| 254 |
+
|
| 255 |
+
async def _handler(self, websocket: ws_server.ServerConnection):
|
| 256 |
+
"""处理单个客户端连接"""
|
| 257 |
+
print(f"[连接] 客户端 {websocket.remote_address} 已连接")
|
| 258 |
+
|
| 259 |
+
# 发送 metadata
|
| 260 |
+
await websocket.send(self._packer.pack(self._metadata))
|
| 261 |
+
|
| 262 |
+
while True:
|
| 263 |
+
try:
|
| 264 |
+
data = await websocket.recv()
|
| 265 |
+
if isinstance(data, str):
|
| 266 |
+
await websocket.send(f"Invalid data type: {type(data)}")
|
| 267 |
+
continue
|
| 268 |
+
|
| 269 |
+
obs = msgpack_numpy.unpackb(data)
|
| 270 |
+
result = _infer_single(self._policy, obs, self._args, self._args.gripper_threshold)
|
| 271 |
+
await websocket.send(self._packer.pack(result))
|
| 272 |
+
|
| 273 |
+
except websockets.ConnectionClosed:
|
| 274 |
+
print(f"[断开] 客户端 {websocket.remote_address} 已断开")
|
| 275 |
+
break
|
| 276 |
+
except Exception:
|
| 277 |
+
error_msg = traceback.format_exc()
|
| 278 |
+
print(f"[错误] {error_msg}")
|
| 279 |
+
await websocket.send(error_msg)
|
| 280 |
+
await websocket.close(
|
| 281 |
+
code=websockets.frames.CloseCode.INTERNAL_ERROR,
|
| 282 |
+
reason="Internal server error",
|
| 283 |
+
)
|
| 284 |
+
raise
|
| 285 |
+
|
| 286 |
+
|
| 287 |
+
def serve(args: Args):
|
| 288 |
+
print("=" * 60)
|
| 289 |
+
print("Pi0 WebSocket 推理服务端 (openpi-client 兼容)")
|
| 290 |
+
print("=" * 60)
|
| 291 |
+
print(f" 监听: ws://{args.host}:{args.port}")
|
| 292 |
+
print(f" 权重: {args.ckpt_path}")
|
| 293 |
+
print(f" 数据统计: {args.data_statistics_path}")
|
| 294 |
+
print(f" 相机键: {args.obs_camera_name}")
|
| 295 |
+
print(f" unnorm_key: {args.unnorm_key}")
|
| 296 |
+
print(f" tokenizer: {args.language_tokenizer_path}")
|
| 297 |
+
print("=" * 60)
|
| 298 |
+
|
| 299 |
+
print("[1/2] 初始化模型...")
|
| 300 |
+
pi0_policy = _build_policy(args)
|
| 301 |
+
print("✓ 模型就绪")
|
| 302 |
+
|
| 303 |
+
|
| 304 |
+
# ===== 在这里加 =====
|
| 305 |
+
print("Has predict_action:", hasattr(pi0_policy, "predict_action"))
|
| 306 |
+
print("Has __call__:", callable(pi0_policy))
|
| 307 |
+
print("Action-related methods:",
|
| 308 |
+
[m for m in dir(pi0_policy) if "action" in m.lower()])
|
| 309 |
+
|
| 310 |
+
am = pi0_policy.action_model
|
| 311 |
+
print("past_action_window_size:", getattr(pi0_policy, "past_action_window_size", None))
|
| 312 |
+
print("future_action_window_size:", getattr(pi0_policy, "future_action_window_size", None))
|
| 313 |
+
print("action_model:", type(am))
|
| 314 |
+
print("action_model attrs (state):", [x for x in dir(am) if "state" in x.lower()])
|
| 315 |
+
|
| 316 |
+
# ===================
|
| 317 |
+
|
| 318 |
+
print("[2/2] 启动 WebSocket 服务...")
|
| 319 |
+
server = Pi0PolicyServer(pi0_policy, args)
|
| 320 |
+
|
| 321 |
+
try:
|
| 322 |
+
server.serve_forever()
|
| 323 |
+
except KeyboardInterrupt:
|
| 324 |
+
print("\n[退出] 收到中断信号,正在关闭服务...")
|
| 325 |
+
|
| 326 |
+
|
| 327 |
+
def main():
|
| 328 |
+
serve(tyro.cli(Args))
|
| 329 |
+
|
| 330 |
+
|
| 331 |
+
if __name__ == "__main__":
|
| 332 |
+
main()
|
deployment/upload/push_model_to_hf.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from huggingface_hub import create_repo, HfApi
|
| 2 |
+
|
| 3 |
+
# 1. create repository
|
| 4 |
+
hf_name = "StarVLA/Qwen3-VL-OFT-LIBERO-4in1"
|
| 5 |
+
create_repo(hf_name, repo_type="model", exist_ok=True)
|
| 6 |
+
|
| 7 |
+
# 2. initialize API
|
| 8 |
+
api = HfApi()
|
| 9 |
+
|
| 10 |
+
# 3. upload large folder
|
| 11 |
+
folder_path = "/mnt/petrelfs/yejinhui/Projects/starVLA/results/Checkpoints/1_need/Qwen3-VL-OFT-LIBERO-4in1"
|
| 12 |
+
api.upload_large_folder(folder_path=folder_path, repo_id=hf_name, repo_type="model")
|
deployment_robotwin/__init__.py
ADDED
|
File without changes
|
deployment_robotwin/model_server/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# start policy server
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
```bash
|
| 6 |
+
|
| 7 |
+
your_ckpt=./results/Checkpoints/1003_qwenfast/checkpoints/steps_50000_pytorch_model.pt
|
| 8 |
+
|
| 9 |
+
python deployment/model_server/server_policy.py \
|
| 10 |
+
--ckpt_path ${your_ckpt} \
|
| 11 |
+
--port 10093 \
|
| 12 |
+
--use_bf16
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
# connect to policy server for debug
|
| 17 |
+
|
| 18 |
+
```bash
|
| 19 |
+
python deployment/model_server/debug_server_policy.py
|
| 20 |
+
|
| 21 |
+
# plus server_policy.py into your vla controler by ref to debug_server_policy.py
|
| 22 |
+
```
|
deployment_robotwin/model_server/__init__.py
ADDED
|
File without changes
|
deployment_robotwin/model_server/server_policy.py
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2025 starVLA community. All rights reserved.
|
| 2 |
+
# Licensed under the MIT License, Version 1.0 (the "License");
|
| 3 |
+
# Implemented by [Jinhui YE / HKUST University] in [2025].
|
| 4 |
+
|
| 5 |
+
import logging
|
| 6 |
+
import socket
|
| 7 |
+
import argparse
|
| 8 |
+
import random
|
| 9 |
+
import numpy as np
|
| 10 |
+
from deployment_robotwin.model_server.tools.websocket_policy_server import WebsocketPolicyServer
|
| 11 |
+
from starVLA.model.framework.base_framework import baseframework
|
| 12 |
+
import torch, os
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def set_seed(seed: int) -> None:
|
| 16 |
+
"""Fix all possible random seeds for reproducibility.
|
| 17 |
+
|
| 18 |
+
Args:
|
| 19 |
+
seed: Random seed to use.
|
| 20 |
+
"""
|
| 21 |
+
random.seed(seed)
|
| 22 |
+
np.random.seed(seed)
|
| 23 |
+
torch.manual_seed(seed)
|
| 24 |
+
torch.cuda.manual_seed(seed)
|
| 25 |
+
torch.cuda.manual_seed_all(seed)
|
| 26 |
+
torch.backends.cudnn.deterministic = True
|
| 27 |
+
torch.backends.cudnn.benchmark = False
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def main(args) -> None:
|
| 31 |
+
# Set random seeds for reproducibility
|
| 32 |
+
set_seed(args.seed)
|
| 33 |
+
|
| 34 |
+
# Example usage:
|
| 35 |
+
# policy = YourPolicyClass() # Replace with your actual policy class
|
| 36 |
+
# server = WebsocketPolicyServer(policy, host="localhost", port=10091)
|
| 37 |
+
# server.serve_forever()
|
| 38 |
+
|
| 39 |
+
vla = baseframework.from_pretrained( # TODO should auto detect framework from model path
|
| 40 |
+
args.ckpt_path,
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
+
if args.use_bf16: # False
|
| 44 |
+
vla = vla.to(torch.bfloat16)
|
| 45 |
+
vla = vla.to("cuda").eval()
|
| 46 |
+
|
| 47 |
+
hostname = socket.gethostname()
|
| 48 |
+
local_ip = socket.gethostbyname(hostname)
|
| 49 |
+
logging.info("Creating server (host: %s, ip: %s)", hostname, local_ip)
|
| 50 |
+
|
| 51 |
+
# start websocket server
|
| 52 |
+
server = WebsocketPolicyServer(
|
| 53 |
+
policy=vla,
|
| 54 |
+
host="0.0.0.0",
|
| 55 |
+
port=args.port,
|
| 56 |
+
idle_timeout=args.idle_timeout,
|
| 57 |
+
metadata={"env": "simpler_env"},
|
| 58 |
+
)
|
| 59 |
+
logging.info("server running ...")
|
| 60 |
+
server.serve_forever()
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def build_argparser():
|
| 64 |
+
parser = argparse.ArgumentParser()
|
| 65 |
+
parser.add_argument("--ckpt_path", type=str, default="Qwen/Qwen2.5-VL-3B-Instruct")
|
| 66 |
+
parser.add_argument("--port", type=int, default=10093)
|
| 67 |
+
parser.add_argument("--use_bf16", action="store_true")
|
| 68 |
+
parser.add_argument("--idle_timeout" , type=int, default=1800, help="Idle timeout in seconds, -1 means never close")
|
| 69 |
+
parser.add_argument("--seed", type=int, default=42, help="Random seed for reproducibility")
|
| 70 |
+
return parser
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def start_debugpy_once():
|
| 74 |
+
"""start debugpy once"""
|
| 75 |
+
import debugpy
|
| 76 |
+
if getattr(start_debugpy_once, "_started", False):
|
| 77 |
+
return
|
| 78 |
+
debugpy.listen(("0.0.0.0", 10095))
|
| 79 |
+
print("🔍 Waiting for VSCode attach on 0.0.0.0:10095 ...")
|
| 80 |
+
debugpy.wait_for_client()
|
| 81 |
+
start_debugpy_once._started = True
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
if __name__ == "__main__":
|
| 85 |
+
logging.basicConfig(level=logging.INFO, force=True)
|
| 86 |
+
parser = build_argparser()
|
| 87 |
+
args = parser.parse_args()
|
| 88 |
+
if os.getenv("DEBUG", False):
|
| 89 |
+
print("🔍 DEBUGPY is enabled")
|
| 90 |
+
start_debugpy_once()
|
| 91 |
+
main(args)
|
deployment_robotwin/model_server/tools/.ipynb_checkpoints/websocket_policy_client-checkpoint.py
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2025 starVLA community. All rights reserved.
|
| 2 |
+
# Licensed under the MIT License, Version 1.0 (the "License");
|
| 3 |
+
# Implemented by [Jinhui YE / HKUST University] in [2025].
|
| 4 |
+
|
| 5 |
+
import logging
|
| 6 |
+
import os
|
| 7 |
+
import time
|
| 8 |
+
from typing import Dict, Optional, Tuple, Any
|
| 9 |
+
|
| 10 |
+
from typing_extensions import override
|
| 11 |
+
import websockets
|
| 12 |
+
import websockets.sync.client
|
| 13 |
+
|
| 14 |
+
from . import msgpack_numpy
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class WebsocketClientPolicy:
|
| 18 |
+
"""Implements the Policy interface by communicating with a server over websocket.
|
| 19 |
+
|
| 20 |
+
See WebsocketPolicyServer for a corresponding server implementation.
|
| 21 |
+
"""
|
| 22 |
+
|
| 23 |
+
def __init__(
|
| 24 |
+
self,
|
| 25 |
+
host: str = "127.0.0.1",
|
| 26 |
+
port: Optional[int] = 10093,
|
| 27 |
+
api_key: Optional[str] = None,
|
| 28 |
+
connect_timeout: float = 300.0,
|
| 29 |
+
open_timeout: float = 150.0,
|
| 30 |
+
ping_interval: Optional[float] = 30.0,
|
| 31 |
+
ping_timeout: Optional[float] = 300.0,
|
| 32 |
+
reconnect_max_attempts: int = 5,
|
| 33 |
+
) -> None:
|
| 34 |
+
# 0.0.0.0 cannot be used as a connection target, here default 127.0.0.1
|
| 35 |
+
self._uri = f"ws://{host}"
|
| 36 |
+
if port is not None:
|
| 37 |
+
self._uri += f":{port}"
|
| 38 |
+
|
| 39 |
+
self._packer = msgpack_numpy.Packer()
|
| 40 |
+
self._api_key = api_key
|
| 41 |
+
|
| 42 |
+
self._connect_timeout = connect_timeout
|
| 43 |
+
self._open_timeout = open_timeout
|
| 44 |
+
self._ping_interval = ping_interval
|
| 45 |
+
self._ping_timeout = ping_timeout
|
| 46 |
+
self._reconnect_max_attempts = reconnect_max_attempts
|
| 47 |
+
|
| 48 |
+
self._ws, self._server_metadata = self._wait_for_server(timeout=self._connect_timeout)
|
| 49 |
+
|
| 50 |
+
def get_server_metadata(self) -> Dict:
|
| 51 |
+
return self._server_metadata
|
| 52 |
+
|
| 53 |
+
def close(self) -> None:
|
| 54 |
+
try:
|
| 55 |
+
if getattr(self, "_ws", None) is not None:
|
| 56 |
+
self._ws.close()
|
| 57 |
+
except Exception:
|
| 58 |
+
pass
|
| 59 |
+
|
| 60 |
+
def _drop_proxy_env(self) -> None:
|
| 61 |
+
# Some environments set proxies that break ws://127.0.0.1
|
| 62 |
+
for k in ("HTTP_PROXY", "http_proxy", "HTTPS_PROXY", "https_proxy", "ALL_PROXY", "all_proxy"):
|
| 63 |
+
os.environ.pop(k, None)
|
| 64 |
+
|
| 65 |
+
def _connect_once(self) -> Tuple[websockets.sync.client.ClientConnection, Dict[str, Any]]:
|
| 66 |
+
headers = {"Authorization": f"Api-Key {self._api_key}"} if self._api_key else None
|
| 67 |
+
conn = websockets.sync.client.connect(
|
| 68 |
+
self._uri,
|
| 69 |
+
compression=None,
|
| 70 |
+
max_size=None,
|
| 71 |
+
additional_headers=headers,
|
| 72 |
+
open_timeout=self._open_timeout,
|
| 73 |
+
ping_interval=self._ping_interval,
|
| 74 |
+
ping_timeout=self._ping_timeout,
|
| 75 |
+
close_timeout=10,
|
| 76 |
+
)
|
| 77 |
+
# First frame: metadata
|
| 78 |
+
metadata = msgpack_numpy.unpackb(conn.recv())
|
| 79 |
+
if not isinstance(metadata, dict):
|
| 80 |
+
raise RuntimeError(f"Server metadata must be dict, got: {type(metadata)}")
|
| 81 |
+
return conn, metadata
|
| 82 |
+
|
| 83 |
+
def _wait_for_server(self, timeout: float = 300.0) -> Tuple[websockets.sync.client.ClientConnection, Dict]:
|
| 84 |
+
logging.info(f"Waiting for server at {self._uri}...")
|
| 85 |
+
start_time = time.time()
|
| 86 |
+
|
| 87 |
+
self._drop_proxy_env()
|
| 88 |
+
|
| 89 |
+
backoff = 0.5 # seconds
|
| 90 |
+
while True:
|
| 91 |
+
if time.time() - start_time > timeout:
|
| 92 |
+
raise TimeoutError(f"Failed to connect to server within {timeout} seconds")
|
| 93 |
+
|
| 94 |
+
try:
|
| 95 |
+
conn, metadata = self._connect_once()
|
| 96 |
+
return conn, metadata
|
| 97 |
+
except ConnectionRefusedError:
|
| 98 |
+
logging.info(f"Still waiting for server {self._uri} ...")
|
| 99 |
+
except Exception as e:
|
| 100 |
+
logging.warning(f"Connect failed: {repr(e)}")
|
| 101 |
+
|
| 102 |
+
time.sleep(backoff)
|
| 103 |
+
backoff = min(backoff * 1.5, 5.0)
|
| 104 |
+
|
| 105 |
+
def _reconnect(self) -> None:
|
| 106 |
+
"""Reconnect with limited attempts. Keeps it synchronous and simple."""
|
| 107 |
+
self.close()
|
| 108 |
+
last_err = None
|
| 109 |
+
for attempt in range(1, self._reconnect_max_attempts + 1):
|
| 110 |
+
try:
|
| 111 |
+
self._ws, self._server_metadata = self._wait_for_server(timeout=60.0)
|
| 112 |
+
return
|
| 113 |
+
except Exception as e:
|
| 114 |
+
last_err = e
|
| 115 |
+
logging.warning(f"Reconnect attempt {attempt}/{self._reconnect_max_attempts} failed: {repr(e)}")
|
| 116 |
+
raise RuntimeError(f"Failed to reconnect after {self._reconnect_max_attempts} attempts") from last_err
|
| 117 |
+
|
| 118 |
+
@override
|
| 119 |
+
def predict_action(self, query_info: Dict) -> Dict:
|
| 120 |
+
"""
|
| 121 |
+
Sends a request to server. Supports both:
|
| 122 |
+
- legacy payload dict (query_info)
|
| 123 |
+
- or query_info already containing {type, request_id, payload}
|
| 124 |
+
"""
|
| 125 |
+
data = self._packer.pack(query_info)
|
| 126 |
+
|
| 127 |
+
try:
|
| 128 |
+
self._ws.send(data)
|
| 129 |
+
response = self._ws.recv()
|
| 130 |
+
except websockets.exceptions.ConnectionClosedError as e:
|
| 131 |
+
logging.warning(f"WebSocket closed, reconnecting once... ({e})")
|
| 132 |
+
self._reconnect()
|
| 133 |
+
self._ws.send(data)
|
| 134 |
+
response = self._ws.recv()
|
| 135 |
+
|
| 136 |
+
if isinstance(response, str):
|
| 137 |
+
# server sent traceback text frame
|
| 138 |
+
raise RuntimeError(f"Error in inference server:\n{response}")
|
| 139 |
+
|
| 140 |
+
ret = msgpack_numpy.unpackb(response)
|
| 141 |
+
if not isinstance(ret, dict):
|
| 142 |
+
raise RuntimeError(f"Invalid response type: {type(ret)}")
|
| 143 |
+
|
| 144 |
+
# Optional: normalize error replies
|
| 145 |
+
if ret.get("ok") is False and ret.get("status") == "error":
|
| 146 |
+
err = ret.get("error", {})
|
| 147 |
+
raise RuntimeError(f"Server error: {err}")
|
| 148 |
+
|
| 149 |
+
return ret
|
deployment_robotwin/model_server/tools/.ipynb_checkpoints/websocket_policy_server-checkpoint.py
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2025 starVLA community. All rights reserved.
|
| 2 |
+
# Licensed under the MIT License, Version 1.0 (the "License");
|
| 3 |
+
# Implemented by [Jinhui YE / HKUST University] in [2025].
|
| 4 |
+
|
| 5 |
+
import asyncio
|
| 6 |
+
import logging
|
| 7 |
+
import threading
|
| 8 |
+
import time
|
| 9 |
+
import traceback
|
| 10 |
+
from typing import Any, Dict, Optional
|
| 11 |
+
|
| 12 |
+
import numpy as np
|
| 13 |
+
import websockets
|
| 14 |
+
import websockets.asyncio.server
|
| 15 |
+
import websockets.frames
|
| 16 |
+
|
| 17 |
+
from . import msgpack_numpy
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def _to_serializable(obj: Any) -> Any:
|
| 21 |
+
"""Recursively convert non-serializable objects (e.g. PIL Image) into
|
| 22 |
+
msgpack-friendly types so the response can be packed by msgpack_numpy.
|
| 23 |
+
|
| 24 |
+
PIL Image objects are converted to numpy arrays (which msgpack_numpy
|
| 25 |
+
supports) and the downstream client uses ``np.asarray`` on them anyway.
|
| 26 |
+
"""
|
| 27 |
+
# Lazy import to avoid a hard dependency if PIL is unavailable.
|
| 28 |
+
try:
|
| 29 |
+
from PIL import Image as _PILImage
|
| 30 |
+
except Exception: # pragma: no cover - PIL should be available
|
| 31 |
+
_PILImage = None
|
| 32 |
+
|
| 33 |
+
if _PILImage is not None and isinstance(obj, _PILImage.Image):
|
| 34 |
+
return np.asarray(obj)
|
| 35 |
+
if isinstance(obj, dict):
|
| 36 |
+
return {key: _to_serializable(value) for key, value in obj.items()}
|
| 37 |
+
if isinstance(obj, (list, tuple)):
|
| 38 |
+
return [_to_serializable(item) for item in obj]
|
| 39 |
+
return obj
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
class WebsocketPolicyServer:
|
| 43 |
+
"""Serves a policy using the websocket protocol. See websocket_client_policy.py for a client implementation.
|
| 44 |
+
|
| 45 |
+
Currently only implements the `load` and `infer` methods.
|
| 46 |
+
"""
|
| 47 |
+
|
| 48 |
+
def __init__(
|
| 49 |
+
self,
|
| 50 |
+
policy,
|
| 51 |
+
host: str = "0.0.0.0",
|
| 52 |
+
port: int = 10093,
|
| 53 |
+
idle_timeout: int = -1, # seconds; -1 means never shutdown
|
| 54 |
+
metadata: Optional[dict] = None,
|
| 55 |
+
ping_interval: Optional[float] = 30.0,
|
| 56 |
+
ping_timeout: Optional[float] = 300.0,
|
| 57 |
+
) -> None:
|
| 58 |
+
self._policy = policy
|
| 59 |
+
self._host = host
|
| 60 |
+
self._port = port
|
| 61 |
+
self._metadata = metadata or {}
|
| 62 |
+
self._idle_timeout = idle_timeout
|
| 63 |
+
self._last_active = time.time()
|
| 64 |
+
|
| 65 |
+
# WebSocket keepalive tuning (server side!)
|
| 66 |
+
self._ping_interval = ping_interval
|
| 67 |
+
self._ping_timeout = ping_timeout
|
| 68 |
+
|
| 69 |
+
# Thread lock for concurrent inference protection
|
| 70 |
+
self._inference_lock = threading.Lock()
|
| 71 |
+
|
| 72 |
+
logging.getLogger("websockets.server").setLevel(logging.INFO)
|
| 73 |
+
|
| 74 |
+
def serve_forever(self) -> None:
|
| 75 |
+
asyncio.run(self.run())
|
| 76 |
+
|
| 77 |
+
async def run(self) -> None:
|
| 78 |
+
async with websockets.asyncio.server.serve(
|
| 79 |
+
self._handler,
|
| 80 |
+
self._host,
|
| 81 |
+
self._port,
|
| 82 |
+
compression=None,
|
| 83 |
+
max_size=None,
|
| 84 |
+
ping_interval=self._ping_interval,
|
| 85 |
+
ping_timeout=self._ping_timeout,
|
| 86 |
+
close_timeout=10,
|
| 87 |
+
) as server:
|
| 88 |
+
if self._idle_timeout > 0:
|
| 89 |
+
await self._idle_watchdog(server)
|
| 90 |
+
else:
|
| 91 |
+
await server.serve_forever()
|
| 92 |
+
|
| 93 |
+
async def _idle_watchdog(self, server: websockets.asyncio.server.Server) -> None:
|
| 94 |
+
"""Monitor server-level idle time; if no requests for idle_timeout seconds, shut down server."""
|
| 95 |
+
while True:
|
| 96 |
+
await asyncio.sleep(5)
|
| 97 |
+
if time.time() - self._last_active > self._idle_timeout:
|
| 98 |
+
logging.info(f"Idle timeout ({self._idle_timeout}s) reached, shutting down server.")
|
| 99 |
+
server.close()
|
| 100 |
+
await server.wait_closed()
|
| 101 |
+
break
|
| 102 |
+
|
| 103 |
+
async def _handler(self, websocket: websockets.asyncio.server.ServerConnection) -> None:
|
| 104 |
+
logging.info(f"Connection from {websocket.remote_address} opened")
|
| 105 |
+
packer = msgpack_numpy.Packer()
|
| 106 |
+
|
| 107 |
+
# Send metadata as first binary frame
|
| 108 |
+
await websocket.send(packer.pack(self._metadata))
|
| 109 |
+
|
| 110 |
+
while True:
|
| 111 |
+
try:
|
| 112 |
+
raw = await websocket.recv()
|
| 113 |
+
msg = msgpack_numpy.unpackb(raw)
|
| 114 |
+
self._last_active = time.time()
|
| 115 |
+
|
| 116 |
+
# ★ CRITICAL: do NOT block event loop with inference
|
| 117 |
+
ret = await asyncio.to_thread(self._route_message, msg)
|
| 118 |
+
|
| 119 |
+
await websocket.send(packer.pack(ret))
|
| 120 |
+
except websockets.ConnectionClosed:
|
| 121 |
+
logging.info(f"Connection from {websocket.remote_address} closed")
|
| 122 |
+
break
|
| 123 |
+
except Exception:
|
| 124 |
+
# Send traceback as text, then close with 1011
|
| 125 |
+
tb = traceback.format_exc()
|
| 126 |
+
try:
|
| 127 |
+
await websocket.send(tb)
|
| 128 |
+
except Exception:
|
| 129 |
+
pass
|
| 130 |
+
try:
|
| 131 |
+
await websocket.close(
|
| 132 |
+
code=websockets.frames.CloseCode.INTERNAL_ERROR,
|
| 133 |
+
reason="Internal server error. Traceback included in previous frame.",
|
| 134 |
+
)
|
| 135 |
+
except Exception:
|
| 136 |
+
pass
|
| 137 |
+
raise
|
| 138 |
+
|
| 139 |
+
def _route_message(self, msg: Any) -> Dict[str, Any]:
|
| 140 |
+
"""
|
| 141 |
+
Fault-tolerant routing:
|
| 142 |
+
Accepts either:
|
| 143 |
+
1) protocol envelope:
|
| 144 |
+
{"type": "ping|infer|reset|...", "request_id": "...", "payload": {...}}
|
| 145 |
+
2) legacy style:
|
| 146 |
+
{ ...payload... } (treated as infer)
|
| 147 |
+
"""
|
| 148 |
+
# Normalize
|
| 149 |
+
if isinstance(msg, dict):
|
| 150 |
+
req_id = msg.get("request_id", "default")
|
| 151 |
+
mtype = msg.get("type", "infer")
|
| 152 |
+
payload = msg.get("payload", msg) # if no payload wrapper, treat whole dict as payload
|
| 153 |
+
else:
|
| 154 |
+
req_id = "default"
|
| 155 |
+
mtype = "infer"
|
| 156 |
+
payload = msg
|
| 157 |
+
|
| 158 |
+
# ping
|
| 159 |
+
if mtype == "ping":
|
| 160 |
+
return {"status": "ok", "ok": True, "type": "ping", "request_id": req_id}
|
| 161 |
+
|
| 162 |
+
# infer / predict_action
|
| 163 |
+
if mtype in ("infer", "predict_action"):
|
| 164 |
+
if not isinstance(payload, dict):
|
| 165 |
+
return {
|
| 166 |
+
"status": "error",
|
| 167 |
+
"ok": False,
|
| 168 |
+
"type": "inference_result",
|
| 169 |
+
"request_id": req_id,
|
| 170 |
+
"error": {"message": "Payload must be a dict", "payload_type": str(type(payload))},
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
try:
|
| 174 |
+
# IMPORTANT: only pass payload into policy, not control fields
|
| 175 |
+
# Use lock to ensure thread-safe concurrent inference
|
| 176 |
+
with self._inference_lock:
|
| 177 |
+
output_dict = self._policy.predict_action(**payload, is_run_parallel_eval_mxk=True)
|
| 178 |
+
return {
|
| 179 |
+
"status": "ok",
|
| 180 |
+
"ok": True,
|
| 181 |
+
"type": "inference_result",
|
| 182 |
+
"request_id": req_id,
|
| 183 |
+
"data": _to_serializable(output_dict),
|
| 184 |
+
}
|
| 185 |
+
except Exception as e:
|
| 186 |
+
logging.exception("Policy inference error (request_id=%s)", req_id)
|
| 187 |
+
return {
|
| 188 |
+
"status": "error",
|
| 189 |
+
"ok": False,
|
| 190 |
+
"type": "inference_result",
|
| 191 |
+
"request_id": req_id,
|
| 192 |
+
"error": {"message": str(e)},
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
# unknown request type
|
| 196 |
+
return {
|
| 197 |
+
"status": "error",
|
| 198 |
+
"ok": False,
|
| 199 |
+
"type": "unknown",
|
| 200 |
+
"request_id": req_id,
|
| 201 |
+
"error": {"message": f"Unsupported message type '{mtype}'"},
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
if __name__ == "__main__":
|
| 206 |
+
logging.basicConfig(level=logging.INFO, force=True)
|
| 207 |
+
raise NotImplementedError("This module is not intended to be run directly.")
|
deployment_robotwin/model_server/tools/__init__.py
ADDED
|
File without changes
|
deployment_robotwin/model_server/tools/debug_server_policy.py
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Debug / smoke-test client for deployment_robotwin/model_server/server_policy.py.
|
| 3 |
+
|
| 4 |
+
Purpose:
|
| 5 |
+
- Establish a WebSocket connection to the policy server.
|
| 6 |
+
- Initialize device on the server side.
|
| 7 |
+
- Optionally run a very simple inference request to verify end-to-end transport
|
| 8 |
+
(serialization + server handling).
|
| 9 |
+
|
| 10 |
+
Usage example:
|
| 11 |
+
python debug_server_policy.py --host 127.0.0.1 --port 10093 --device cuda --test infer
|
| 12 |
+
|
| 13 |
+
Notes:
|
| 14 |
+
- The random observation is synthetic and only meant to validate the interface.
|
| 15 |
+
- Adjust keys (e.g. 'images', 'task_description') to match the server's expected schema.
|
| 16 |
+
"""
|
| 17 |
+
|
| 18 |
+
import argparse
|
| 19 |
+
import logging
|
| 20 |
+
import numpy as np
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
from tools.websocket_policy_client import WebsocketClientPolicy
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def _build_argparser() -> argparse.ArgumentParser:
|
| 27 |
+
ap = argparse.ArgumentParser(description="WebSocket policy client smoke test (msgpack protocol)")
|
| 28 |
+
ap.add_argument("--host", default="127.0.0.1", help="server hostname/IP (do not use 0.0.0.0)")
|
| 29 |
+
ap.add_argument("--port", type=int, default=10093, help="server port")
|
| 30 |
+
ap.add_argument("--api_key", default="", help="optional: API key for authentication")
|
| 31 |
+
ap.add_argument("--device", default="cuda", choices=["cuda", "cpu"], help="initialize device")
|
| 32 |
+
ap.add_argument(
|
| 33 |
+
"--test", choices=["init", "infer"], default="infer", help="test mode: only initialize, or try simple inference"
|
| 34 |
+
)
|
| 35 |
+
ap.add_argument("--log_level", default="INFO")
|
| 36 |
+
return ap
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def _main():
|
| 40 |
+
args = _build_argparser().parse_args()
|
| 41 |
+
logging.basicConfig(level=getattr(logging, args.log_level.upper(), logging.INFO), force=True)
|
| 42 |
+
|
| 43 |
+
client = WebsocketClientPolicy(host=args.host, port=args.port, api_key=(args.api_key or None))
|
| 44 |
+
logging.info("Connected. Server metadata: %s", client.get_server_metadata())
|
| 45 |
+
|
| 46 |
+
# 1) device initialization
|
| 47 |
+
init_ret = client.init_device(args.device) # here to set some things on the server
|
| 48 |
+
logging.info("Init device resp: %s", init_ret)
|
| 49 |
+
|
| 50 |
+
# 2) optional: try one simple inference
|
| 51 |
+
if args.test == "infer":
|
| 52 |
+
try:
|
| 53 |
+
# build observation aligned with model API
|
| 54 |
+
H, W = 224, 224
|
| 55 |
+
img = np.random.randint(0, 256, (H, W, 3), dtype=np.uint8)
|
| 56 |
+
wrist_img = np.random.randint(0, 256, (H, W, 3), dtype=np.uint8)
|
| 57 |
+
state = np.zeros((7,), dtype=np.float32) # [x,y,z, ax,ay,az, gripper]
|
| 58 |
+
|
| 59 |
+
observation = { # key to align with model API
|
| 60 |
+
"request_id": "smoke-test",
|
| 61 |
+
"observation.primary": np.expand_dims(img, axis=0), # (1,H,W,C), uint8 0-255
|
| 62 |
+
"observation.wrist_image": np.expand_dims(wrist_img, axis=0), # (1,H,W,C)
|
| 63 |
+
"observation.state": np.expand_dims(state, axis=0), # (1,7), float32
|
| 64 |
+
"instruction": ["debug: pick up the red block"], # single element list
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
image_path = "assets/table.jpeg"
|
| 68 |
+
# read image as PIL
|
| 69 |
+
from PIL import Image
|
| 70 |
+
image_primary = Image.open(image_path).convert("RGB")
|
| 71 |
+
# Convert PIL -> numpy uint8 (H,W,3)
|
| 72 |
+
image_primary_np = np.asarray(image_primary, dtype=np.uint8)
|
| 73 |
+
|
| 74 |
+
instruction_lang="pick up the red block"
|
| 75 |
+
obs = {
|
| 76 |
+
"request_id": "smoke-test",
|
| 77 |
+
"batch_images": [[image_primary_np]],
|
| 78 |
+
"instructions": [instruction_lang], # assume batch task description
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
infer_ret = client.infer(obs)
|
| 82 |
+
logging.info("Infer resp: %s", infer_ret)
|
| 83 |
+
except Exception as e:
|
| 84 |
+
logging.error("Infer error (this still proves transport OK): %s", e)
|
| 85 |
+
|
| 86 |
+
client.close()
|
| 87 |
+
logging.info("Smoke test done.")
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
if __name__ == "__main__":
|
| 91 |
+
_main()
|
deployment_robotwin/model_server/tools/image_tools.py
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
from PIL import Image
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def convert_to_uint8(img: np.ndarray) -> np.ndarray:
|
| 6 |
+
"""Converts an image to uint8 if it is a float image.
|
| 7 |
+
|
| 8 |
+
This is important for reducing the size of the image when sending it over the network.
|
| 9 |
+
"""
|
| 10 |
+
if np.issubdtype(img.dtype, np.floating):
|
| 11 |
+
img = (255 * img).astype(np.uint8)
|
| 12 |
+
return img
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def resize_with_pad(images: np.ndarray, height: int, width: int, method=Image.BILINEAR) -> np.ndarray:
|
| 16 |
+
"""Replicates tf.image.resize_with_pad for multiple images using PIL. Resizes a batch of images to a target height.
|
| 17 |
+
|
| 18 |
+
Args:
|
| 19 |
+
images: A batch of images in [..., height, width, channel] format.
|
| 20 |
+
height: The target height of the image.
|
| 21 |
+
width: The target width of the image.
|
| 22 |
+
method: The interpolation method to use. Default is bilinear.
|
| 23 |
+
|
| 24 |
+
Returns:
|
| 25 |
+
The resized images in [..., height, width, channel].
|
| 26 |
+
"""
|
| 27 |
+
# If the images are already the correct size, return them as is.
|
| 28 |
+
if images.shape[-3:-1] == (height, width):
|
| 29 |
+
return images
|
| 30 |
+
|
| 31 |
+
original_shape = images.shape
|
| 32 |
+
|
| 33 |
+
images = images.reshape(-1, *original_shape[-3:])
|
| 34 |
+
resized = np.stack([_resize_with_pad_pil(Image.fromarray(im), height, width, method=method) for im in images])
|
| 35 |
+
return resized.reshape(*original_shape[:-3], *resized.shape[-3:])
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def _resize_with_pad_pil(image: Image.Image, height: int, width: int, method: int) -> Image.Image:
|
| 39 |
+
"""Replicates tf.image.resize_with_pad for one image using PIL. Resizes an image to a target height and
|
| 40 |
+
width without distortion by padding with zeros.
|
| 41 |
+
|
| 42 |
+
Unlike the jax version, note that PIL uses [width, height, channel] ordering instead of [batch, h, w, c].
|
| 43 |
+
"""
|
| 44 |
+
cur_width, cur_height = image.size
|
| 45 |
+
if cur_width == width and cur_height == height:
|
| 46 |
+
return image # No need to resize if the image is already the correct size.
|
| 47 |
+
|
| 48 |
+
ratio = max(cur_width / width, cur_height / height)
|
| 49 |
+
resized_height = int(cur_height / ratio)
|
| 50 |
+
resized_width = int(cur_width / ratio)
|
| 51 |
+
resized_image = image.resize((resized_width, resized_height), resample=method)
|
| 52 |
+
|
| 53 |
+
zero_image = Image.new(resized_image.mode, (width, height), 0)
|
| 54 |
+
pad_height = max(0, int((height - resized_height) / 2))
|
| 55 |
+
pad_width = max(0, int((width - resized_width) / 2))
|
| 56 |
+
zero_image.paste(resized_image, (pad_width, pad_height))
|
| 57 |
+
assert zero_image.size == (width, height)
|
| 58 |
+
return zero_image
|
| 59 |
+
|
| 60 |
+
from typing import Sequence, Union, List, Tuple, Any
|
| 61 |
+
def to_pil_preserve(images: Any, scale_float: bool = True):
|
| 62 |
+
"""
|
| 63 |
+
Convert (possibly nested) numpy image arrays back to PIL.Image WITHOUT changing spatial shape
|
| 64 |
+
or nesting structure.
|
| 65 |
+
|
| 66 |
+
Accepts:
|
| 67 |
+
- np.ndarray with shape (H, W, C), C in {1,3,4}, dtype uint8 or float
|
| 68 |
+
- PIL.Image.Image (returned as-is)
|
| 69 |
+
- Nested list / tuple structures containing the above
|
| 70 |
+
|
| 71 |
+
Guarantees:
|
| 72 |
+
- No resize / pad / crop performed
|
| 73 |
+
- Returns an object with the SAME nesting layout (list -> list, tuple -> tuple)
|
| 74 |
+
- Only dtype (float -> uint8) and channel-mode adaptation may happen
|
| 75 |
+
* float arrays assumed in [0,1] if scale_float=True (scaled *255 + clip)
|
| 76 |
+
Args:
|
| 77 |
+
images: input object / sequence
|
| 78 |
+
scale_float: whether to scale float images in [0,1] to uint8
|
| 79 |
+
Returns:
|
| 80 |
+
Mirrored structure with all leaf nodes as PIL.Image.Image
|
| 81 |
+
"""
|
| 82 |
+
def _convert(obj):
|
| 83 |
+
# Nested containers
|
| 84 |
+
if isinstance(obj, list):
|
| 85 |
+
return [ _convert(x) for x in obj ]
|
| 86 |
+
if isinstance(obj, tuple):
|
| 87 |
+
return tuple(_convert(x) for x in obj)
|
| 88 |
+
|
| 89 |
+
# PIL stays
|
| 90 |
+
if isinstance(obj, Image.Image):
|
| 91 |
+
return obj
|
| 92 |
+
|
| 93 |
+
# numpy -> PIL
|
| 94 |
+
if isinstance(obj, np.ndarray):
|
| 95 |
+
arr = obj
|
| 96 |
+
if arr.ndim != 3:
|
| 97 |
+
raise ValueError(f"Expected 3D array (H,W,C), got shape={arr.shape}")
|
| 98 |
+
if arr.shape[2] not in (1,3,4):
|
| 99 |
+
raise ValueError(f"Channel count must be 1/3/4, got {arr.shape[2]}")
|
| 100 |
+
if np.issubdtype(arr.dtype, np.floating):
|
| 101 |
+
if scale_float:
|
| 102 |
+
arr = np.clip(arr, 0.0, 1.0)
|
| 103 |
+
arr = (arr * 255.0 + 0.5).astype(np.uint8)
|
| 104 |
+
else:
|
| 105 |
+
raise TypeError("Float array provided but scale_float=False")
|
| 106 |
+
elif arr.dtype != np.uint8:
|
| 107 |
+
arr = arr.astype(np.uint8)
|
| 108 |
+
|
| 109 |
+
# Single channel -> 'L'
|
| 110 |
+
if arr.shape[2] == 1:
|
| 111 |
+
arr = arr[:, :, 0]
|
| 112 |
+
return Image.fromarray(arr, mode="L")
|
| 113 |
+
# 3 channels -> RGB, 4 -> RGBA
|
| 114 |
+
mode = "RGB" if arr.shape[2] == 3 else "RGBA"
|
| 115 |
+
return Image.fromarray(arr, mode=mode)
|
| 116 |
+
|
| 117 |
+
raise TypeError(f"Unsupported element type: {type(obj)}")
|
| 118 |
+
|
| 119 |
+
return _convert(images)
|
deployment_robotwin/model_server/tools/msgpack_numpy.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Adds NumPy array support to msgpack.
|
| 2 |
+
|
| 3 |
+
msgpack is good for (de)serializing data over a network for multiple reasons:
|
| 4 |
+
- msgpack is secure (as opposed to pickle/dill/etc which allow for arbitrary code execution)
|
| 5 |
+
- msgpack is widely used and has good cross-language support
|
| 6 |
+
- msgpack does not require a schema (as opposed to protobuf/flatbuffers/etc) which is convenient in dynamically typed
|
| 7 |
+
languages like Python and JavaScript
|
| 8 |
+
- msgpack is fast and efficient (as opposed to readable formats like JSON/YAML/etc); I found that msgpack was ~4x faster
|
| 9 |
+
than pickle for serializing large arrays using the below strategy
|
| 10 |
+
|
| 11 |
+
The code below is adapted from https://github.com/lebedov/msgpack-numpy. The reason not to use that library directly is
|
| 12 |
+
that it falls back to pickle for object arrays.
|
| 13 |
+
"""
|
| 14 |
+
|
| 15 |
+
import functools
|
| 16 |
+
|
| 17 |
+
import msgpack
|
| 18 |
+
import numpy as np
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def pack_array(obj):
|
| 22 |
+
if (isinstance(obj, (np.ndarray, np.generic))) and obj.dtype.kind in ("V", "O", "c"):
|
| 23 |
+
raise ValueError(f"Unsupported dtype: {obj.dtype}")
|
| 24 |
+
|
| 25 |
+
if isinstance(obj, np.ndarray):
|
| 26 |
+
return {
|
| 27 |
+
b"__ndarray__": True,
|
| 28 |
+
b"data": obj.tobytes(),
|
| 29 |
+
b"dtype": obj.dtype.str,
|
| 30 |
+
b"shape": obj.shape,
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
if isinstance(obj, np.generic):
|
| 34 |
+
return {
|
| 35 |
+
b"__npgeneric__": True,
|
| 36 |
+
b"data": obj.item(),
|
| 37 |
+
b"dtype": obj.dtype.str,
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
return obj
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def unpack_array(obj):
|
| 44 |
+
if b"__ndarray__" in obj:
|
| 45 |
+
return np.ndarray(buffer=obj[b"data"], dtype=np.dtype(obj[b"dtype"]), shape=obj[b"shape"])
|
| 46 |
+
|
| 47 |
+
if b"__npgeneric__" in obj:
|
| 48 |
+
return np.dtype(obj[b"dtype"]).type(obj[b"data"])
|
| 49 |
+
|
| 50 |
+
return obj
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
Packer = functools.partial(msgpack.Packer, default=pack_array)
|
| 54 |
+
packb = functools.partial(msgpack.packb, default=pack_array)
|
| 55 |
+
|
| 56 |
+
Unpacker = functools.partial(msgpack.Unpacker, object_hook=unpack_array)
|
| 57 |
+
unpackb = functools.partial(msgpack.unpackb, object_hook=unpack_array)
|
deployment_robotwin/model_server/tools/websocket_policy_client.py
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2025 starVLA community. All rights reserved.
|
| 2 |
+
# Licensed under the MIT License, Version 1.0 (the "License");
|
| 3 |
+
# Implemented by [Jinhui YE / HKUST University] in [2025].
|
| 4 |
+
|
| 5 |
+
import logging
|
| 6 |
+
import os
|
| 7 |
+
import time
|
| 8 |
+
from typing import Dict, Optional, Tuple, Any
|
| 9 |
+
|
| 10 |
+
from typing_extensions import override
|
| 11 |
+
import websockets
|
| 12 |
+
import websockets.sync.client
|
| 13 |
+
|
| 14 |
+
from . import msgpack_numpy
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class WebsocketClientPolicy:
|
| 18 |
+
"""Implements the Policy interface by communicating with a server over websocket.
|
| 19 |
+
|
| 20 |
+
See WebsocketPolicyServer for a corresponding server implementation.
|
| 21 |
+
"""
|
| 22 |
+
|
| 23 |
+
def __init__(
|
| 24 |
+
self,
|
| 25 |
+
host: str = "127.0.0.1",
|
| 26 |
+
port: Optional[int] = 10093,
|
| 27 |
+
api_key: Optional[str] = None,
|
| 28 |
+
connect_timeout: float = 300.0,
|
| 29 |
+
open_timeout: float = 150.0,
|
| 30 |
+
ping_interval: Optional[float] = 30.0,
|
| 31 |
+
ping_timeout: Optional[float] = 300.0,
|
| 32 |
+
reconnect_max_attempts: int = 5,
|
| 33 |
+
) -> None:
|
| 34 |
+
# 0.0.0.0 cannot be used as a connection target, here default 127.0.0.1
|
| 35 |
+
self._uri = f"ws://{host}"
|
| 36 |
+
if port is not None:
|
| 37 |
+
self._uri += f":{port}"
|
| 38 |
+
|
| 39 |
+
self._packer = msgpack_numpy.Packer()
|
| 40 |
+
self._api_key = api_key
|
| 41 |
+
|
| 42 |
+
self._connect_timeout = connect_timeout
|
| 43 |
+
self._open_timeout = open_timeout
|
| 44 |
+
self._ping_interval = ping_interval
|
| 45 |
+
self._ping_timeout = ping_timeout
|
| 46 |
+
self._reconnect_max_attempts = reconnect_max_attempts
|
| 47 |
+
|
| 48 |
+
self._ws, self._server_metadata = self._wait_for_server(timeout=self._connect_timeout)
|
| 49 |
+
|
| 50 |
+
def get_server_metadata(self) -> Dict:
|
| 51 |
+
return self._server_metadata
|
| 52 |
+
|
| 53 |
+
def close(self) -> None:
|
| 54 |
+
try:
|
| 55 |
+
if getattr(self, "_ws", None) is not None:
|
| 56 |
+
self._ws.close()
|
| 57 |
+
except Exception:
|
| 58 |
+
pass
|
| 59 |
+
|
| 60 |
+
def _drop_proxy_env(self) -> None:
|
| 61 |
+
# Some environments set proxies that break ws://127.0.0.1
|
| 62 |
+
for k in ("HTTP_PROXY", "http_proxy", "HTTPS_PROXY", "https_proxy", "ALL_PROXY", "all_proxy"):
|
| 63 |
+
os.environ.pop(k, None)
|
| 64 |
+
|
| 65 |
+
def _connect_once(self) -> Tuple[websockets.sync.client.ClientConnection, Dict[str, Any]]:
|
| 66 |
+
headers = {"Authorization": f"Api-Key {self._api_key}"} if self._api_key else None
|
| 67 |
+
conn = websockets.sync.client.connect(
|
| 68 |
+
self._uri,
|
| 69 |
+
compression=None,
|
| 70 |
+
max_size=None,
|
| 71 |
+
additional_headers=headers,
|
| 72 |
+
open_timeout=self._open_timeout,
|
| 73 |
+
ping_interval=self._ping_interval,
|
| 74 |
+
ping_timeout=self._ping_timeout,
|
| 75 |
+
close_timeout=10,
|
| 76 |
+
)
|
| 77 |
+
# First frame: metadata
|
| 78 |
+
metadata = msgpack_numpy.unpackb(conn.recv())
|
| 79 |
+
if not isinstance(metadata, dict):
|
| 80 |
+
raise RuntimeError(f"Server metadata must be dict, got: {type(metadata)}")
|
| 81 |
+
return conn, metadata
|
| 82 |
+
|
| 83 |
+
def _wait_for_server(self, timeout: float = 300.0) -> Tuple[websockets.sync.client.ClientConnection, Dict]:
|
| 84 |
+
logging.info(f"Waiting for server at {self._uri}...")
|
| 85 |
+
start_time = time.time()
|
| 86 |
+
|
| 87 |
+
self._drop_proxy_env()
|
| 88 |
+
|
| 89 |
+
backoff = 0.5 # seconds
|
| 90 |
+
while True:
|
| 91 |
+
if time.time() - start_time > timeout:
|
| 92 |
+
raise TimeoutError(f"Failed to connect to server within {timeout} seconds")
|
| 93 |
+
|
| 94 |
+
try:
|
| 95 |
+
conn, metadata = self._connect_once()
|
| 96 |
+
return conn, metadata
|
| 97 |
+
except ConnectionRefusedError:
|
| 98 |
+
logging.info(f"Still waiting for server {self._uri} ...")
|
| 99 |
+
except Exception as e:
|
| 100 |
+
logging.warning(f"Connect failed: {repr(e)}")
|
| 101 |
+
|
| 102 |
+
time.sleep(backoff)
|
| 103 |
+
backoff = min(backoff * 1.5, 5.0)
|
| 104 |
+
|
| 105 |
+
def _reconnect(self) -> None:
|
| 106 |
+
"""Reconnect with limited attempts. Keeps it synchronous and simple."""
|
| 107 |
+
self.close()
|
| 108 |
+
last_err = None
|
| 109 |
+
for attempt in range(1, self._reconnect_max_attempts + 1):
|
| 110 |
+
try:
|
| 111 |
+
self._ws, self._server_metadata = self._wait_for_server(timeout=60.0)
|
| 112 |
+
return
|
| 113 |
+
except Exception as e:
|
| 114 |
+
last_err = e
|
| 115 |
+
logging.warning(f"Reconnect attempt {attempt}/{self._reconnect_max_attempts} failed: {repr(e)}")
|
| 116 |
+
raise RuntimeError(f"Failed to reconnect after {self._reconnect_max_attempts} attempts") from last_err
|
| 117 |
+
|
| 118 |
+
@override
|
| 119 |
+
def predict_action(self, query_info: Dict) -> Dict:
|
| 120 |
+
"""
|
| 121 |
+
Sends a request to server. Supports both:
|
| 122 |
+
- legacy payload dict (query_info)
|
| 123 |
+
- or query_info already containing {type, request_id, payload}
|
| 124 |
+
"""
|
| 125 |
+
data = self._packer.pack(query_info)
|
| 126 |
+
|
| 127 |
+
try:
|
| 128 |
+
self._ws.send(data)
|
| 129 |
+
response = self._ws.recv()
|
| 130 |
+
except websockets.exceptions.ConnectionClosedError as e:
|
| 131 |
+
logging.warning(f"WebSocket closed, reconnecting once... ({e})")
|
| 132 |
+
self._reconnect()
|
| 133 |
+
self._ws.send(data)
|
| 134 |
+
response = self._ws.recv()
|
| 135 |
+
|
| 136 |
+
if isinstance(response, str):
|
| 137 |
+
# server sent traceback text frame
|
| 138 |
+
raise RuntimeError(f"Error in inference server:\n{response}")
|
| 139 |
+
|
| 140 |
+
ret = msgpack_numpy.unpackb(response)
|
| 141 |
+
if not isinstance(ret, dict):
|
| 142 |
+
raise RuntimeError(f"Invalid response type: {type(ret)}")
|
| 143 |
+
|
| 144 |
+
# Optional: normalize error replies
|
| 145 |
+
if ret.get("ok") is False and ret.get("status") == "error":
|
| 146 |
+
err = ret.get("error", {})
|
| 147 |
+
raise RuntimeError(f"Server error: {err}")
|
| 148 |
+
|
| 149 |
+
return ret
|
deployment_robotwin/model_server/tools/websocket_policy_server.py
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2025 starVLA community. All rights reserved.
|
| 2 |
+
# Licensed under the MIT License, Version 1.0 (the "License");
|
| 3 |
+
# Implemented by [Jinhui YE / HKUST University] in [2025].
|
| 4 |
+
|
| 5 |
+
import asyncio
|
| 6 |
+
import logging
|
| 7 |
+
import threading
|
| 8 |
+
import time
|
| 9 |
+
import traceback
|
| 10 |
+
from typing import Any, Dict, Optional
|
| 11 |
+
|
| 12 |
+
import numpy as np
|
| 13 |
+
import websockets
|
| 14 |
+
import websockets.asyncio.server
|
| 15 |
+
import websockets.frames
|
| 16 |
+
|
| 17 |
+
from . import msgpack_numpy
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def _to_serializable(obj: Any) -> Any:
|
| 21 |
+
"""Recursively convert non-serializable objects (e.g. PIL Image) into
|
| 22 |
+
msgpack-friendly types so the response can be packed by msgpack_numpy.
|
| 23 |
+
|
| 24 |
+
PIL Image objects are converted to numpy arrays (which msgpack_numpy
|
| 25 |
+
supports) and the downstream client uses ``np.asarray`` on them anyway.
|
| 26 |
+
"""
|
| 27 |
+
# Lazy import to avoid a hard dependency if PIL is unavailable.
|
| 28 |
+
try:
|
| 29 |
+
from PIL import Image as _PILImage
|
| 30 |
+
except Exception: # pragma: no cover - PIL should be available
|
| 31 |
+
_PILImage = None
|
| 32 |
+
|
| 33 |
+
if _PILImage is not None and isinstance(obj, _PILImage.Image):
|
| 34 |
+
return np.asarray(obj)
|
| 35 |
+
if isinstance(obj, dict):
|
| 36 |
+
return {key: _to_serializable(value) for key, value in obj.items()}
|
| 37 |
+
if isinstance(obj, (list, tuple)):
|
| 38 |
+
return [_to_serializable(item) for item in obj]
|
| 39 |
+
return obj
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
class WebsocketPolicyServer:
|
| 43 |
+
"""Serves a policy using the websocket protocol. See websocket_client_policy.py for a client implementation.
|
| 44 |
+
|
| 45 |
+
Currently only implements the `load` and `infer` methods.
|
| 46 |
+
"""
|
| 47 |
+
|
| 48 |
+
def __init__(
|
| 49 |
+
self,
|
| 50 |
+
policy,
|
| 51 |
+
host: str = "0.0.0.0",
|
| 52 |
+
port: int = 10093,
|
| 53 |
+
idle_timeout: int = -1, # seconds; -1 means never shutdown
|
| 54 |
+
metadata: Optional[dict] = None,
|
| 55 |
+
ping_interval: Optional[float] = 30.0,
|
| 56 |
+
ping_timeout: Optional[float] = 300.0,
|
| 57 |
+
) -> None:
|
| 58 |
+
self._policy = policy
|
| 59 |
+
self._host = host
|
| 60 |
+
self._port = port
|
| 61 |
+
self._metadata = metadata or {}
|
| 62 |
+
self._idle_timeout = idle_timeout
|
| 63 |
+
self._last_active = time.time()
|
| 64 |
+
|
| 65 |
+
# WebSocket keepalive tuning (server side!)
|
| 66 |
+
self._ping_interval = ping_interval
|
| 67 |
+
self._ping_timeout = ping_timeout
|
| 68 |
+
|
| 69 |
+
# Thread lock for concurrent inference protection
|
| 70 |
+
self._inference_lock = threading.Lock()
|
| 71 |
+
|
| 72 |
+
logging.getLogger("websockets.server").setLevel(logging.INFO)
|
| 73 |
+
|
| 74 |
+
def serve_forever(self) -> None:
|
| 75 |
+
asyncio.run(self.run())
|
| 76 |
+
|
| 77 |
+
async def run(self) -> None:
|
| 78 |
+
async with websockets.asyncio.server.serve(
|
| 79 |
+
self._handler,
|
| 80 |
+
self._host,
|
| 81 |
+
self._port,
|
| 82 |
+
compression=None,
|
| 83 |
+
max_size=None,
|
| 84 |
+
ping_interval=self._ping_interval,
|
| 85 |
+
ping_timeout=self._ping_timeout,
|
| 86 |
+
close_timeout=10,
|
| 87 |
+
) as server:
|
| 88 |
+
if self._idle_timeout > 0:
|
| 89 |
+
await self._idle_watchdog(server)
|
| 90 |
+
else:
|
| 91 |
+
await server.serve_forever()
|
| 92 |
+
|
| 93 |
+
async def _idle_watchdog(self, server: websockets.asyncio.server.Server) -> None:
|
| 94 |
+
"""Monitor server-level idle time; if no requests for idle_timeout seconds, shut down server."""
|
| 95 |
+
while True:
|
| 96 |
+
await asyncio.sleep(5)
|
| 97 |
+
if time.time() - self._last_active > self._idle_timeout:
|
| 98 |
+
logging.info(f"Idle timeout ({self._idle_timeout}s) reached, shutting down server.")
|
| 99 |
+
server.close()
|
| 100 |
+
await server.wait_closed()
|
| 101 |
+
break
|
| 102 |
+
|
| 103 |
+
async def _handler(self, websocket: websockets.asyncio.server.ServerConnection) -> None:
|
| 104 |
+
logging.info(f"Connection from {websocket.remote_address} opened")
|
| 105 |
+
packer = msgpack_numpy.Packer()
|
| 106 |
+
|
| 107 |
+
# Send metadata as first binary frame
|
| 108 |
+
await websocket.send(packer.pack(self._metadata))
|
| 109 |
+
|
| 110 |
+
while True:
|
| 111 |
+
try:
|
| 112 |
+
raw = await websocket.recv()
|
| 113 |
+
msg = msgpack_numpy.unpackb(raw)
|
| 114 |
+
self._last_active = time.time()
|
| 115 |
+
|
| 116 |
+
# ★ CRITICAL: do NOT block event loop with inference
|
| 117 |
+
ret = await asyncio.to_thread(self._route_message, msg)
|
| 118 |
+
|
| 119 |
+
await websocket.send(packer.pack(ret))
|
| 120 |
+
except websockets.ConnectionClosed:
|
| 121 |
+
logging.info(f"Connection from {websocket.remote_address} closed")
|
| 122 |
+
break
|
| 123 |
+
except Exception:
|
| 124 |
+
# Send traceback as text, then close with 1011
|
| 125 |
+
tb = traceback.format_exc()
|
| 126 |
+
try:
|
| 127 |
+
await websocket.send(tb)
|
| 128 |
+
except Exception:
|
| 129 |
+
pass
|
| 130 |
+
try:
|
| 131 |
+
await websocket.close(
|
| 132 |
+
code=websockets.frames.CloseCode.INTERNAL_ERROR,
|
| 133 |
+
reason="Internal server error. Traceback included in previous frame.",
|
| 134 |
+
)
|
| 135 |
+
except Exception:
|
| 136 |
+
pass
|
| 137 |
+
raise
|
| 138 |
+
|
| 139 |
+
def _route_message(self, msg: Any) -> Dict[str, Any]:
|
| 140 |
+
"""
|
| 141 |
+
Fault-tolerant routing:
|
| 142 |
+
Accepts either:
|
| 143 |
+
1) protocol envelope:
|
| 144 |
+
{"type": "ping|infer|reset|...", "request_id": "...", "payload": {...}}
|
| 145 |
+
2) legacy style:
|
| 146 |
+
{ ...payload... } (treated as infer)
|
| 147 |
+
"""
|
| 148 |
+
# Normalize
|
| 149 |
+
if isinstance(msg, dict):
|
| 150 |
+
req_id = msg.get("request_id", "default")
|
| 151 |
+
mtype = msg.get("type", "infer")
|
| 152 |
+
payload = msg.get("payload", msg) # if no payload wrapper, treat whole dict as payload
|
| 153 |
+
else:
|
| 154 |
+
req_id = "default"
|
| 155 |
+
mtype = "infer"
|
| 156 |
+
payload = msg
|
| 157 |
+
|
| 158 |
+
# ping
|
| 159 |
+
if mtype == "ping":
|
| 160 |
+
return {"status": "ok", "ok": True, "type": "ping", "request_id": req_id}
|
| 161 |
+
|
| 162 |
+
# infer / predict_action
|
| 163 |
+
if mtype in ("infer", "predict_action"):
|
| 164 |
+
if not isinstance(payload, dict):
|
| 165 |
+
return {
|
| 166 |
+
"status": "error",
|
| 167 |
+
"ok": False,
|
| 168 |
+
"type": "inference_result",
|
| 169 |
+
"request_id": req_id,
|
| 170 |
+
"error": {"message": "Payload must be a dict", "payload_type": str(type(payload))},
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
try:
|
| 174 |
+
# IMPORTANT: only pass payload into policy, not control fields
|
| 175 |
+
# Use lock to ensure thread-safe concurrent inference
|
| 176 |
+
with self._inference_lock:
|
| 177 |
+
output_dict = self._policy.predict_action(**payload, is_run_parallel_eval_mxk=True)
|
| 178 |
+
return {
|
| 179 |
+
"status": "ok",
|
| 180 |
+
"ok": True,
|
| 181 |
+
"type": "inference_result",
|
| 182 |
+
"request_id": req_id,
|
| 183 |
+
"data": _to_serializable(output_dict),
|
| 184 |
+
}
|
| 185 |
+
except Exception as e:
|
| 186 |
+
logging.exception("Policy inference error (request_id=%s)", req_id)
|
| 187 |
+
return {
|
| 188 |
+
"status": "error",
|
| 189 |
+
"ok": False,
|
| 190 |
+
"type": "inference_result",
|
| 191 |
+
"request_id": req_id,
|
| 192 |
+
"error": {"message": str(e)},
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
# unknown request type
|
| 196 |
+
return {
|
| 197 |
+
"status": "error",
|
| 198 |
+
"ok": False,
|
| 199 |
+
"type": "unknown",
|
| 200 |
+
"request_id": req_id,
|
| 201 |
+
"error": {"message": f"Unsupported message type '{mtype}'"},
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
if __name__ == "__main__":
|
| 206 |
+
logging.basicConfig(level=logging.INFO, force=True)
|
| 207 |
+
raise NotImplementedError("This module is not intended to be run directly.")
|
deployment_robotwin/readme-deployment.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
sudo ip addr add 172.16.0.100/24 dev enx207bd51a3217
|
| 2 |
+
sudo ip link set enx207bd51a3217 up
|
| 3 |
+
ping 172.16.0.2
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
python -m real_deployment.model_controller_del_ee
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
## install frankx
|
| 10 |
+
conda install frankx
|
| 11 |
+
unzip frankx.zip
|
deployment_robotwin/real_infer/open_loop_eval.py
ADDED
|
@@ -0,0 +1,418 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import sys
|
| 3 |
+
import time
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
from dataclasses import dataclass
|
| 6 |
+
from typing import Dict, List, Optional
|
| 7 |
+
|
| 8 |
+
import numpy as np
|
| 9 |
+
import matplotlib.pyplot as plt
|
| 10 |
+
import torch
|
| 11 |
+
from omegaconf import OmegaConf
|
| 12 |
+
import tyro
|
| 13 |
+
|
| 14 |
+
# ====== 你项目里的 import(按你现有路径保留)======
|
| 15 |
+
from starVLA.dataloader.lerobot_datasets import get_vla_dataset
|
| 16 |
+
from starVLA.model.framework.base_framework import baseframework
|
| 17 |
+
from starVLA.model.framework.share_tools import read_mode_config
|
| 18 |
+
|
| 19 |
+
# ✅ 关键:导入你训练用的 VideoResizePad(按你项目实际路径改这里)
|
| 20 |
+
from starVLA.dataloader.gr00t_lerobot.transform.video import VideoResizePad
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
# -----------------------------
|
| 24 |
+
# 0) 图像:单张图复用 VideoResizePad(resize longest edge -> pad 到 224)
|
| 25 |
+
# -----------------------------
|
| 26 |
+
def _img_to_torch_nchw(img) -> torch.Tensor:
|
| 27 |
+
"""
|
| 28 |
+
Convert input image to torch float tensor [1,C,H,W] in [0,1].
|
| 29 |
+
Supports: np.ndarray(H,W,C) uint8/float, torch.Tensor, PIL.Image
|
| 30 |
+
"""
|
| 31 |
+
if isinstance(img, torch.Tensor):
|
| 32 |
+
x = img
|
| 33 |
+
if x.ndim == 3 and x.shape[-1] in (1, 3, 4) and x.shape[0] not in (1, 3, 4):
|
| 34 |
+
x = x.permute(2, 0, 1) # HWC -> CHW
|
| 35 |
+
if x.ndim == 2:
|
| 36 |
+
x = x.unsqueeze(0)
|
| 37 |
+
if x.ndim != 3:
|
| 38 |
+
raise ValueError(f"Unexpected torch image shape: {x.shape}")
|
| 39 |
+
x = x.float()
|
| 40 |
+
if x.max() > 1.5:
|
| 41 |
+
x = x / 255.0
|
| 42 |
+
return x.unsqueeze(0) # [1,C,H,W]
|
| 43 |
+
|
| 44 |
+
if isinstance(img, np.ndarray):
|
| 45 |
+
x = torch.from_numpy(img)
|
| 46 |
+
if x.ndim == 3 and x.shape[-1] in (1, 3, 4): # HWC
|
| 47 |
+
x = x.permute(2, 0, 1) # -> CHW
|
| 48 |
+
elif x.ndim == 2:
|
| 49 |
+
x = x.unsqueeze(0)
|
| 50 |
+
if x.ndim != 3:
|
| 51 |
+
raise ValueError(f"Unexpected numpy image shape: {img.shape}")
|
| 52 |
+
x = x.float()
|
| 53 |
+
if x.max() > 1.5:
|
| 54 |
+
x = x / 255.0
|
| 55 |
+
return x.unsqueeze(0)
|
| 56 |
+
|
| 57 |
+
# 避免强依赖 PIL:只有你真的传 PIL.Image 才需要
|
| 58 |
+
try:
|
| 59 |
+
from PIL import Image
|
| 60 |
+
if isinstance(img, Image.Image):
|
| 61 |
+
x = torch.from_numpy(np.array(img))
|
| 62 |
+
if x.ndim == 2:
|
| 63 |
+
x = x.unsqueeze(-1)
|
| 64 |
+
x = x.permute(2, 0, 1).float()
|
| 65 |
+
if x.max() > 1.5:
|
| 66 |
+
x = x / 255.0
|
| 67 |
+
return x.unsqueeze(0)
|
| 68 |
+
except Exception:
|
| 69 |
+
pass
|
| 70 |
+
|
| 71 |
+
raise TypeError(f"Unsupported image type: {type(img)}")
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
def _torch_chw_to_uint8_hwc(x: torch.Tensor) -> np.ndarray:
|
| 75 |
+
"""
|
| 76 |
+
x: torch.Tensor [C,H,W] float [0,1]
|
| 77 |
+
return: np.uint8 [H,W,C]
|
| 78 |
+
"""
|
| 79 |
+
x = (x.clamp(0, 1) * 255.0).to(torch.uint8)
|
| 80 |
+
x = x.permute(1, 2, 0).cpu().numpy()
|
| 81 |
+
return x
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
class OpenLoopVideoResizePadWrapper:
|
| 85 |
+
"""
|
| 86 |
+
复用训练同款 VideoResizePad 的 torchvision resize+pad 逻辑,
|
| 87 |
+
但输入/输出是“单张图”。
|
| 88 |
+
"""
|
| 89 |
+
|
| 90 |
+
def __init__(self, resize_pad_transform: VideoResizePad, return_numpy_uint8_hwc: bool = True):
|
| 91 |
+
self.t = resize_pad_transform
|
| 92 |
+
self.return_numpy_uint8_hwc = return_numpy_uint8_hwc
|
| 93 |
+
|
| 94 |
+
def __call__(self, img):
|
| 95 |
+
# 单图 -> [1,C,H,W]
|
| 96 |
+
x = _img_to_torch_nchw(img)
|
| 97 |
+
# 复用类内部 torchvision resize+pad
|
| 98 |
+
y = self.t._torchvision_resize_pad(x) # [1,C,S,S]
|
| 99 |
+
y = y.squeeze(0) # [C,S,S]
|
| 100 |
+
if self.return_numpy_uint8_hwc:
|
| 101 |
+
return _torch_chw_to_uint8_hwc(y) # [S,S,C] uint8,最保险(兼容你现有 predict_action)
|
| 102 |
+
return y # torch [C,S,S]
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
# -----------------------------
|
| 106 |
+
# 1) 你已有的归一化/反归一化逻辑(原封不动)
|
| 107 |
+
# -----------------------------
|
| 108 |
+
def _minmax_to_minus1_1(x: np.ndarray, stats: dict, eps: float = 1e-6) -> np.ndarray:
|
| 109 |
+
lo = np.asarray(stats["min"], dtype=np.float32)
|
| 110 |
+
hi = np.asarray(stats["max"], dtype=np.float32)
|
| 111 |
+
denom = np.maximum(hi - lo, eps)
|
| 112 |
+
x01 = (x - lo) / denom
|
| 113 |
+
xn = x01 * 2.0 - 1.0
|
| 114 |
+
return xn.astype(np.float32)
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
def unnormalize_actions(normalized_actions: np.ndarray, action_norm_stats: Dict[str, np.ndarray]) -> np.ndarray:
|
| 118 |
+
mask = action_norm_stats.get("mask", np.ones_like(action_norm_stats["min"], dtype=bool))
|
| 119 |
+
action_high, action_low = np.array(action_norm_stats["max"]), np.array(action_norm_stats["min"])
|
| 120 |
+
normalized_actions = np.clip(normalized_actions, -1, 1)
|
| 121 |
+
actions = np.where(
|
| 122 |
+
mask,
|
| 123 |
+
(normalized_actions + 1) / 2 * (action_high - action_low) + action_low,
|
| 124 |
+
normalized_actions,
|
| 125 |
+
)
|
| 126 |
+
return actions
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
# -----------------------------
|
| 130 |
+
# 2) Args(按你 server 的 Args 简化必要项)
|
| 131 |
+
# -----------------------------
|
| 132 |
+
@dataclass
|
| 133 |
+
class Args:
|
| 134 |
+
ckpt_path: str = "outputs/suqian_post_train_w_state/checkpoints/steps_80000_pytorch_model.pt"
|
| 135 |
+
unnorm_key: str = "agibot_genie1"
|
| 136 |
+
gripper_threshold: float = 0.5
|
| 137 |
+
|
| 138 |
+
# ✅ 关键:对齐训练图像预处理
|
| 139 |
+
image_size: int = 224
|
| 140 |
+
image_interpolation: str = "linear"
|
| 141 |
+
image_fill_value: float = 0.0
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
def _build_policy(args: Args):
|
| 145 |
+
vla = baseframework.from_pretrained(args.ckpt_path)
|
| 146 |
+
vla = vla.to("cuda").eval()
|
| 147 |
+
|
| 148 |
+
cfg, norm_stats = read_mode_config(Path(args.ckpt_path))
|
| 149 |
+
unnorm_key = args.unnorm_key
|
| 150 |
+
cfg = OmegaConf.create(cfg)
|
| 151 |
+
|
| 152 |
+
vla.action_norm_stats = norm_stats[unnorm_key]["action"]
|
| 153 |
+
vla.state_norm_stats = norm_stats[unnorm_key]["state"]
|
| 154 |
+
return vla, cfg
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
def _infer_single(policy, obs: Dict, args: Args, gripper_th: float) -> Dict:
|
| 158 |
+
prompt = obs.get("prompt", "")
|
| 159 |
+
|
| 160 |
+
state = np.asarray(obs["observation/state"], dtype=np.float32)
|
| 161 |
+
if state.ndim == 1:
|
| 162 |
+
state = state[None, :]
|
| 163 |
+
elif state.ndim != 2:
|
| 164 |
+
raise ValueError(f"Unexpected state shape: {state.shape}")
|
| 165 |
+
|
| 166 |
+
state_norm = _minmax_to_minus1_1(state, policy.state_norm_stats)
|
| 167 |
+
|
| 168 |
+
# padding 到 64
|
| 169 |
+
cur_dim = state_norm.shape[-1]
|
| 170 |
+
if cur_dim < 64:
|
| 171 |
+
pad_width = 64 - cur_dim
|
| 172 |
+
state_norm = np.pad(
|
| 173 |
+
state_norm,
|
| 174 |
+
pad_width=((0, 0), (0, pad_width)),
|
| 175 |
+
mode="constant",
|
| 176 |
+
constant_values=0.0,
|
| 177 |
+
)
|
| 178 |
+
|
| 179 |
+
fake_data = {
|
| 180 |
+
"image": [
|
| 181 |
+
obs["observation/image"],
|
| 182 |
+
obs["observation/wrist_left_image"],
|
| 183 |
+
obs["observation/wrist_right_image"],
|
| 184 |
+
],
|
| 185 |
+
"lang": prompt,
|
| 186 |
+
"state": state_norm,
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
t0 = time.perf_counter()
|
| 190 |
+
with torch.inference_mode():
|
| 191 |
+
out = policy.predict_action(fake_data)
|
| 192 |
+
infer_ms = (time.perf_counter() - t0) * 1000
|
| 193 |
+
|
| 194 |
+
na = out["normalized_actions"] # (1, H, D)
|
| 195 |
+
na2 = na[0, :, :18] # (H, D) 你原逻辑保留
|
| 196 |
+
|
| 197 |
+
raw2 = unnormalize_actions(na2, policy.action_norm_stats) # (H, D)
|
| 198 |
+
actions = raw2[None, ...] # (1, H, D)
|
| 199 |
+
|
| 200 |
+
return {"actions": actions, "policy_timing": {"infer_ms": infer_ms}}
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
# -----------------------------
|
| 204 |
+
# 3) 从 single_ds.get_step_data 组装 obs / gt_chunk
|
| 205 |
+
# -----------------------------
|
| 206 |
+
def build_obs_from_step_data(step_data: dict, single_ds, img_proc: Optional[callable] = None) -> dict:
|
| 207 |
+
"""
|
| 208 |
+
step_data: single_ds.get_step_data(traj_id, base_index) 的 RAW 输出
|
| 209 |
+
返回:_infer_single 所需的 obs dict
|
| 210 |
+
"""
|
| 211 |
+
video_keys = single_ds.modality_keys["video"]
|
| 212 |
+
if len(video_keys) < 3:
|
| 213 |
+
raise ValueError(f"Need 3 cameras, got video_keys={video_keys}")
|
| 214 |
+
|
| 215 |
+
head = step_data[video_keys[0]][0]
|
| 216 |
+
left = step_data[video_keys[1]][0]
|
| 217 |
+
right = step_data[video_keys[2]][0]
|
| 218 |
+
|
| 219 |
+
# ✅ 对齐训练:resize+pad 到 224(或 args.image_size)
|
| 220 |
+
if img_proc is not None:
|
| 221 |
+
head = img_proc(head)
|
| 222 |
+
left = img_proc(left)
|
| 223 |
+
right = img_proc(right)
|
| 224 |
+
|
| 225 |
+
# state concat: (T, D_total) -> 取第 0 帧对应 base step
|
| 226 |
+
state_parts = [step_data[k] for k in single_ds.modality_keys["state"]]
|
| 227 |
+
state = np.concatenate(state_parts, axis=1)
|
| 228 |
+
state0 = state[0]
|
| 229 |
+
|
| 230 |
+
# language
|
| 231 |
+
lang_key = single_ds.modality_keys["language"][0]
|
| 232 |
+
lang = step_data[lang_key][0]
|
| 233 |
+
if isinstance(lang, list):
|
| 234 |
+
lang = lang[0]
|
| 235 |
+
|
| 236 |
+
obs = {
|
| 237 |
+
"observation/image": head,
|
| 238 |
+
"observation/wrist_left_image": left,
|
| 239 |
+
"observation/wrist_right_image": right,
|
| 240 |
+
"observation/state": state0,
|
| 241 |
+
"prompt": lang,
|
| 242 |
+
}
|
| 243 |
+
return obs
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
def get_gt_action_chunk(step_data: dict, single_ds) -> np.ndarray:
|
| 247 |
+
action_parts = [step_data[k] for k in single_ds.modality_keys["action"]]
|
| 248 |
+
gt = np.concatenate(action_parts, axis=1) # (H, D)
|
| 249 |
+
return gt
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
# -----------------------------
|
| 253 |
+
# 4) rollout:拼整段 pred/gt(像 gr00t open-loop eval)
|
| 254 |
+
# -----------------------------
|
| 255 |
+
def rollout_open_loop(
|
| 256 |
+
single_ds,
|
| 257 |
+
pi0_policy,
|
| 258 |
+
args: Args,
|
| 259 |
+
traj_id: int,
|
| 260 |
+
steps: int = 200,
|
| 261 |
+
action_horizon: int = 16,
|
| 262 |
+
img_proc: Optional[callable] = None,
|
| 263 |
+
):
|
| 264 |
+
traj_len = int(single_ds.trajectory_lengths[single_ds.get_trajectory_index(traj_id)])
|
| 265 |
+
actual_steps = min(steps, traj_len)
|
| 266 |
+
|
| 267 |
+
pred_list = []
|
| 268 |
+
gt_list = []
|
| 269 |
+
infer_ms_list = []
|
| 270 |
+
|
| 271 |
+
for t in range(0, actual_steps, action_horizon):
|
| 272 |
+
step_data = single_ds.get_step_data(traj_id, t)
|
| 273 |
+
|
| 274 |
+
obs = build_obs_from_step_data(step_data, single_ds, img_proc=img_proc)
|
| 275 |
+
pred = _infer_single(pi0_policy, obs, args, args.gripper_threshold)
|
| 276 |
+
|
| 277 |
+
pred_chunk = pred["actions"][0] # (H, D)
|
| 278 |
+
gt_chunk = get_gt_action_chunk(step_data, single_ds) # (H, D)
|
| 279 |
+
|
| 280 |
+
remain = actual_steps - t
|
| 281 |
+
pred_chunk = pred_chunk[:remain]
|
| 282 |
+
gt_chunk = gt_chunk[:remain]
|
| 283 |
+
|
| 284 |
+
pred_list.append(pred_chunk)
|
| 285 |
+
gt_list.append(gt_chunk)
|
| 286 |
+
infer_ms_list.append(pred["policy_timing"]["infer_ms"])
|
| 287 |
+
|
| 288 |
+
pred_action_across_time = np.concatenate(pred_list, axis=0)
|
| 289 |
+
gt_action_across_time = np.concatenate(gt_list, axis=0)
|
| 290 |
+
|
| 291 |
+
assert pred_action_across_time.shape == gt_action_across_time.shape, (
|
| 292 |
+
f"pred={pred_action_across_time.shape}, gt={gt_action_across_time.shape}")
|
| 293 |
+
return pred_action_across_time, gt_action_across_time, infer_ms_list
|
| 294 |
+
|
| 295 |
+
|
| 296 |
+
# -----------------------------
|
| 297 |
+
# 5) 画图(整段轨迹)
|
| 298 |
+
# -----------------------------
|
| 299 |
+
def plot_action_curves(
|
| 300 |
+
gt: np.ndarray,
|
| 301 |
+
pred: np.ndarray,
|
| 302 |
+
save_path: str,
|
| 303 |
+
dims: Optional[List[int]] = None,
|
| 304 |
+
title: str = "",
|
| 305 |
+
):
|
| 306 |
+
T, D = gt.shape
|
| 307 |
+
if dims is None:
|
| 308 |
+
dims = list(range(D))
|
| 309 |
+
|
| 310 |
+
n = len(dims)
|
| 311 |
+
fig, axes = plt.subplots(nrows=n, ncols=1, figsize=(10, 2.2 * n))
|
| 312 |
+
if n == 1:
|
| 313 |
+
axes = [axes]
|
| 314 |
+
|
| 315 |
+
fig.suptitle(title, fontsize=14)
|
| 316 |
+
|
| 317 |
+
x = np.arange(T)
|
| 318 |
+
for i, d in enumerate(dims):
|
| 319 |
+
ax = axes[i]
|
| 320 |
+
ax.plot(x, gt[:, d], label="gt")
|
| 321 |
+
ax.plot(x, pred[:, d], label="pred")
|
| 322 |
+
ax.set_ylabel(f"dim {d}")
|
| 323 |
+
ax.legend(loc="upper right")
|
| 324 |
+
|
| 325 |
+
axes[-1].set_xlabel("time step")
|
| 326 |
+
plt.tight_layout()
|
| 327 |
+
Path(save_path).parent.mkdir(parents=True, exist_ok=True)
|
| 328 |
+
plt.savefig(save_path, dpi=150)
|
| 329 |
+
plt.close(fig)
|
| 330 |
+
|
| 331 |
+
|
| 332 |
+
def plot_error_over_time(gt: np.ndarray, pred: np.ndarray, save_path: str, title: str = ""):
|
| 333 |
+
err = pred - gt
|
| 334 |
+
mse_t = np.mean(err**2, axis=1)
|
| 335 |
+
mae_t = np.mean(np.abs(err), axis=1)
|
| 336 |
+
|
| 337 |
+
x = np.arange(len(mse_t))
|
| 338 |
+
fig = plt.figure(figsize=(10, 4))
|
| 339 |
+
plt.plot(x, mse_t, label="MSE per step")
|
| 340 |
+
plt.plot(x, mae_t, label="MAE per step")
|
| 341 |
+
plt.title(title)
|
| 342 |
+
plt.xlabel("time step")
|
| 343 |
+
plt.ylabel("error")
|
| 344 |
+
plt.legend()
|
| 345 |
+
plt.tight_layout()
|
| 346 |
+
Path(save_path).parent.mkdir(parents=True, exist_ok=True)
|
| 347 |
+
plt.savefig(save_path, dpi=150)
|
| 348 |
+
plt.close(fig)
|
| 349 |
+
|
| 350 |
+
|
| 351 |
+
# -----------------------------
|
| 352 |
+
# 6) main:把 dataset + policy 接起来
|
| 353 |
+
# -----------------------------
|
| 354 |
+
def main(args: Args):
|
| 355 |
+
# ===== load policy =====
|
| 356 |
+
pi0_policy, cfg = _build_policy(args)
|
| 357 |
+
print("policy loaded")
|
| 358 |
+
|
| 359 |
+
# ===== 构造与训练一致的 VideoResizePad =====
|
| 360 |
+
# 训练时写的是 VideoResizePad(apply_to=[video_key], size=224, interpolation="linear", fill_value=0.0)
|
| 361 |
+
# 这里我们直接复用其内部 torchvision resize+pad 实现
|
| 362 |
+
resize_pad = VideoResizePad(
|
| 363 |
+
apply_to=["video"], # 占位即可
|
| 364 |
+
size=args.image_size,
|
| 365 |
+
interpolation=args.image_interpolation,
|
| 366 |
+
fill_value=args.image_fill_value,
|
| 367 |
+
backend="torchvision", # 确保走 torchvision
|
| 368 |
+
)
|
| 369 |
+
img_proc = OpenLoopVideoResizePadWrapper(resize_pad, return_numpy_uint8_hwc=True)
|
| 370 |
+
|
| 371 |
+
# ===== 载入训练 yaml 的 dataset 配置 =====
|
| 372 |
+
vla_dataset_cfg = cfg.datasets.vla_data
|
| 373 |
+
vla_dataset_cfg.task_id = "all"
|
| 374 |
+
dataset = get_vla_dataset(data_cfg=vla_dataset_cfg)
|
| 375 |
+
single_ds = dataset.datasets[0] if hasattr(dataset, "datasets") else dataset
|
| 376 |
+
|
| 377 |
+
# 选一条 traj
|
| 378 |
+
traj_id = int(single_ds.trajectory_ids[0])
|
| 379 |
+
print("Using traj_id:", traj_id)
|
| 380 |
+
|
| 381 |
+
# ===== rollout open-loop =====
|
| 382 |
+
pred, gt, infer_ms_list = rollout_open_loop(
|
| 383 |
+
single_ds,
|
| 384 |
+
pi0_policy,
|
| 385 |
+
args,
|
| 386 |
+
traj_id=traj_id,
|
| 387 |
+
steps=200,
|
| 388 |
+
action_horizon=30,
|
| 389 |
+
img_proc=img_proc, # ✅ 关键:评测也做 resize+pad
|
| 390 |
+
)
|
| 391 |
+
|
| 392 |
+
mse = np.mean((pred - gt)**2)
|
| 393 |
+
mae = np.mean(np.abs(pred - gt))
|
| 394 |
+
print(f"Open-loop MSE={mse:.6f}, MAE={mae:.6f}")
|
| 395 |
+
print(f"Infer ms: mean={np.mean(infer_ms_list):.2f}, p95={np.percentile(infer_ms_list, 95):.2f}")
|
| 396 |
+
|
| 397 |
+
out_dir = Path("outputs/open_loop_eval")
|
| 398 |
+
out_dir.mkdir(parents=True, exist_ok=True)
|
| 399 |
+
|
| 400 |
+
plot_action_curves(
|
| 401 |
+
gt,
|
| 402 |
+
pred,
|
| 403 |
+
save_path=str(out_dir / f"traj{traj_id}_action_curves.png"),
|
| 404 |
+
# dims=list(range(min(gt.shape[1], 18))), # 只看前 18 维就打开
|
| 405 |
+
title=f"traj {traj_id} action curves (T={gt.shape[0]}, D={gt.shape[1]})",
|
| 406 |
+
)
|
| 407 |
+
plot_error_over_time(
|
| 408 |
+
gt,
|
| 409 |
+
pred,
|
| 410 |
+
save_path=str(out_dir / f"traj{traj_id}_error.png"),
|
| 411 |
+
title=f"traj {traj_id} error over time",
|
| 412 |
+
)
|
| 413 |
+
|
| 414 |
+
print("Saved plots to:", out_dir)
|
| 415 |
+
|
| 416 |
+
|
| 417 |
+
if __name__ == "__main__":
|
| 418 |
+
main(tyro.cli(Args))
|
deployment_robotwin/real_infer/server.py
ADDED
|
@@ -0,0 +1,375 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Pi0 WebSocket 推理服务端,兼容 openpi-client 客户端协议。
|
| 3 |
+
|
| 4 |
+
- 使用 websockets.asyncio.server,客户端用 WebsocketClientPolicy 连接。
|
| 5 |
+
- 首次连接发送 metadata(简单字典)。
|
| 6 |
+
- 收到 obs 后,调用 Pi0 推理并返回 {"actions": np.ndarray, "policy_timing": {"infer_ms": ...}}。
|
| 7 |
+
|
| 8 |
+
支持 joint_position 和 camera_position(通过 state 维度判断:16 -> joint,14 -> camera)。
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import asyncio
|
| 12 |
+
import http
|
| 13 |
+
import os
|
| 14 |
+
import sys
|
| 15 |
+
import time
|
| 16 |
+
import traceback
|
| 17 |
+
from dataclasses import dataclass, field
|
| 18 |
+
from pathlib import Path
|
| 19 |
+
from typing import Dict, List, Literal, Optional
|
| 20 |
+
|
| 21 |
+
import numpy as np
|
| 22 |
+
import tyro
|
| 23 |
+
import websockets.asyncio.server as ws_server
|
| 24 |
+
import websockets.frames
|
| 25 |
+
|
| 26 |
+
import torch
|
| 27 |
+
import cv2 as cv
|
| 28 |
+
|
| 29 |
+
# 兼容 protobuf 版本
|
| 30 |
+
os.environ.setdefault("PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION", "python")
|
| 31 |
+
|
| 32 |
+
# 路径设置
|
| 33 |
+
_current_dir = Path(__file__).resolve().parent
|
| 34 |
+
_project_root = _current_dir.parent
|
| 35 |
+
if str(_project_root) not in sys.path:
|
| 36 |
+
sys.path.insert(0, str(_project_root))
|
| 37 |
+
|
| 38 |
+
# openpi-client 在当前目录下
|
| 39 |
+
_openpi_client_src = _current_dir / "openpi-client" / "src"
|
| 40 |
+
if _openpi_client_src.exists() and str(_openpi_client_src) not in sys.path:
|
| 41 |
+
sys.path.insert(0, str(_openpi_client_src))
|
| 42 |
+
|
| 43 |
+
from starVLA.model.framework.base_framework import baseframework
|
| 44 |
+
from starVLA.model.framework.share_tools import read_mode_config
|
| 45 |
+
from openpi_client import msgpack_numpy
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
@dataclass
|
| 49 |
+
class Args:
|
| 50 |
+
host: str = "0.0.0.0"
|
| 51 |
+
port: int = 8000
|
| 52 |
+
ckpt_path: str = "/mnt/workspace/users/yuanzhihao/code/starVLA/outputs/suqian_post_train_no_pretrain/checkpoints/steps_15000_pytorch_model.pt"
|
| 53 |
+
data_statistics_path: str = "/workspace/niejunnan/VLAPipeline_RL_BY_Niejunnan/output_train/agibot/benchmark_pro_max/ds_stats.json"
|
| 54 |
+
language_tokenizer_path: Optional[str] = "/workspace/paligemma-3b-pt-224"
|
| 55 |
+
unnorm_key: Optional[str] = "agibot_genie1"
|
| 56 |
+
policy_setup: str = "agibot_genie1"
|
| 57 |
+
obs_camera_name: List[str] = field(default_factory=lambda: ["head_color", "hand_left", "hand_right"])
|
| 58 |
+
action_scale: float = 1.0
|
| 59 |
+
use_filter: bool = False
|
| 60 |
+
use_multi_action_head: str = "raw"
|
| 61 |
+
use_arm_pose_type: str = "euler"
|
| 62 |
+
use_paligemma_original_vocab_size: bool = True
|
| 63 |
+
n_action_steps: Optional[int] = None
|
| 64 |
+
inference_mode: str = "synchronous"
|
| 65 |
+
# 兼容 pi0inference 期望的其他开关
|
| 66 |
+
use_distillation_distribution: bool = False
|
| 67 |
+
use_embodiment_id: bool = False
|
| 68 |
+
use_vit_for_action_head: bool = False
|
| 69 |
+
use_distillation: bool = False
|
| 70 |
+
use_best_of_n: bool = False
|
| 71 |
+
best_of_n: int = 32
|
| 72 |
+
use_step_action_mask_for_q: bool = False
|
| 73 |
+
image_size: int = 224
|
| 74 |
+
gripper_threshold: float = 0.5
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
def resizepad_longest_edge_cv2(
|
| 78 |
+
image: np.ndarray,
|
| 79 |
+
target_size: int = 224,
|
| 80 |
+
fill_value: int = 0,
|
| 81 |
+
) -> np.ndarray:
|
| 82 |
+
"""
|
| 83 |
+
Resize longest edge to target_size, keep aspect ratio, then center-pad to (target_size, target_size).
|
| 84 |
+
Input: image HWC (H,W,C) or HW (H,W)
|
| 85 |
+
Output: uint8 HWC (target_size,target_size,C) or (target_size,target_size) for grayscale
|
| 86 |
+
"""
|
| 87 |
+
if not isinstance(image, np.ndarray):
|
| 88 |
+
image = np.asarray(image)
|
| 89 |
+
|
| 90 |
+
if image.ndim == 2:
|
| 91 |
+
H, W = image.shape
|
| 92 |
+
C = None
|
| 93 |
+
elif image.ndim == 3:
|
| 94 |
+
H, W, C = image.shape
|
| 95 |
+
else:
|
| 96 |
+
raise ValueError(f"Unexpected image shape: {image.shape}")
|
| 97 |
+
|
| 98 |
+
# Avoid degenerate
|
| 99 |
+
if H <= 0 or W <= 0:
|
| 100 |
+
raise ValueError(f"Invalid image size: H={H}, W={W}")
|
| 101 |
+
|
| 102 |
+
# scale longest edge -> target_size
|
| 103 |
+
scale = target_size / float(max(H, W))
|
| 104 |
+
new_h = max(1, int(round(H * scale)))
|
| 105 |
+
new_w = max(1, int(round(W * scale)))
|
| 106 |
+
|
| 107 |
+
# choose interpolation
|
| 108 |
+
interp = cv.INTER_AREA if scale < 1.0 else cv.INTER_LINEAR
|
| 109 |
+
|
| 110 |
+
resized = cv.resize(image, (new_w, new_h), interpolation=interp)
|
| 111 |
+
|
| 112 |
+
pad_h = target_size - new_h
|
| 113 |
+
pad_w = target_size - new_w
|
| 114 |
+
pad_top = pad_h // 2
|
| 115 |
+
pad_bottom = pad_h - pad_top
|
| 116 |
+
pad_left = pad_w // 2
|
| 117 |
+
pad_right = pad_w - pad_left
|
| 118 |
+
|
| 119 |
+
# padding value
|
| 120 |
+
if resized.ndim == 2:
|
| 121 |
+
border_value = fill_value
|
| 122 |
+
else:
|
| 123 |
+
# OpenCV expects scalar or tuple; tuple is safer for multi-channel
|
| 124 |
+
border_value = (fill_value,) * resized.shape[2]
|
| 125 |
+
|
| 126 |
+
padded = cv.copyMakeBorder(
|
| 127 |
+
resized,
|
| 128 |
+
pad_top,
|
| 129 |
+
pad_bottom,
|
| 130 |
+
pad_left,
|
| 131 |
+
pad_right,
|
| 132 |
+
borderType=cv.BORDER_CONSTANT,
|
| 133 |
+
value=border_value,
|
| 134 |
+
)
|
| 135 |
+
|
| 136 |
+
# safety: enforce exact target size
|
| 137 |
+
if padded.shape[0] != target_size or padded.shape[1] != target_size:
|
| 138 |
+
padded = padded[:target_size, :target_size]
|
| 139 |
+
|
| 140 |
+
return padded
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
def _minmax_to_minus1_1(x: np.ndarray, stats: dict, eps: float = 1e-6) -> np.ndarray:
|
| 144 |
+
"""
|
| 145 |
+
x: (..., D)
|
| 146 |
+
stats: contains "min" and "max" (D,)
|
| 147 |
+
return: (..., D) in [-1, 1]
|
| 148 |
+
"""
|
| 149 |
+
lo = np.asarray(stats["min"], dtype=np.float32)
|
| 150 |
+
hi = np.asarray(stats["max"], dtype=np.float32)
|
| 151 |
+
denom = np.maximum(hi - lo, eps)
|
| 152 |
+
x01 = (x - lo) / denom
|
| 153 |
+
xn = x01 * 2.0 - 1.0
|
| 154 |
+
return xn.astype(np.float32)
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
def unnormalize_actions(normalized_actions: np.ndarray, action_norm_stats: Dict[str, np.ndarray]) -> np.ndarray:
|
| 158 |
+
"""
|
| 159 |
+
Args:
|
| 160 |
+
normalized_actions: shape (B, chunk, D) (chunk, D)
|
| 161 |
+
action_norm_stats:
|
| 162 |
+
Returns:
|
| 163 |
+
actions
|
| 164 |
+
"""
|
| 165 |
+
mask = action_norm_stats.get("mask", np.ones_like(action_norm_stats["min"], dtype=bool))
|
| 166 |
+
action_high, action_low = np.array(action_norm_stats["max"]), np.array(action_norm_stats["min"])
|
| 167 |
+
|
| 168 |
+
normalized_actions = np.clip(normalized_actions, -1, 1)
|
| 169 |
+
|
| 170 |
+
actions = np.where(
|
| 171 |
+
mask,
|
| 172 |
+
(normalized_actions + 1) / 2 * (action_high - action_low) + action_low,
|
| 173 |
+
normalized_actions,
|
| 174 |
+
)
|
| 175 |
+
|
| 176 |
+
return actions
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
def _build_policy(args: Args):
|
| 180 |
+
vla = baseframework.from_pretrained(args.ckpt_path)
|
| 181 |
+
vla = vla.to("cuda").eval()
|
| 182 |
+
|
| 183 |
+
_, norm_stats = read_mode_config(Path(args.ckpt_path))
|
| 184 |
+
unnorm_key = args.unnorm_key
|
| 185 |
+
|
| 186 |
+
# ✅ action stats(你原来就有)
|
| 187 |
+
vla.action_norm_stats = norm_stats[unnorm_key]["action"]
|
| 188 |
+
|
| 189 |
+
# ✅ state stats(新增:用于输入归一化,训练一致)
|
| 190 |
+
vla.state_norm_stats = norm_stats[unnorm_key]["state"]
|
| 191 |
+
|
| 192 |
+
return vla
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
def _infer_single(policy, obs: Dict, args: Args, gripper_th: float) -> Dict:
|
| 196 |
+
prompt = obs.get("prompt", "")
|
| 197 |
+
print("prompt", prompt)
|
| 198 |
+
|
| 199 |
+
# -------- state: raw -> normalized (min_max to [-1,1]) --------
|
| 200 |
+
state = np.asarray(obs["observation/state"], dtype=np.float32)
|
| 201 |
+
# print('state', state.shape, state)
|
| 202 |
+
if state.ndim == 1:
|
| 203 |
+
state = state[None, :] # (1, D)
|
| 204 |
+
elif state.ndim != 2:
|
| 205 |
+
raise ValueError(f"Unexpected state shape: {state.shape}")
|
| 206 |
+
|
| 207 |
+
# ✅ 训练一致:min_max 归一化
|
| 208 |
+
state_norm = _minmax_to_minus1_1(state, policy.state_norm_stats)
|
| 209 |
+
|
| 210 |
+
# padding 到 58
|
| 211 |
+
cur_dim = state_norm.shape[-1]
|
| 212 |
+
if cur_dim < 64:
|
| 213 |
+
pad_width = 64 - cur_dim
|
| 214 |
+
state_norm = np.pad(
|
| 215 |
+
state_norm,
|
| 216 |
+
pad_width=((0, 0), (0, pad_width)),
|
| 217 |
+
mode="constant",
|
| 218 |
+
constant_values=0.0,
|
| 219 |
+
)
|
| 220 |
+
|
| 221 |
+
head = resizepad_longest_edge_cv2(obs["observation/image"], target_size=args.image_size, fill_value=0)
|
| 222 |
+
left = resizepad_longest_edge_cv2(obs["observation/wrist_left_image"], target_size=args.image_size, fill_value=0)
|
| 223 |
+
right = resizepad_longest_edge_cv2(obs["observation/wrist_right_image"], target_size=args.image_size, fill_value=0)
|
| 224 |
+
|
| 225 |
+
fake_data = {
|
| 226 |
+
"image": [head, left, right],
|
| 227 |
+
"lang": prompt,
|
| 228 |
+
"state": state_norm,
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
print('img', obs["observation/image"].shape)
|
| 232 |
+
# raw = state
|
| 233 |
+
# sn = state_norm
|
| 234 |
+
# print("state raw min/max:", raw.min(), raw.max())
|
| 235 |
+
# print("state_norm min/max:", sn.min(), sn.max(), "clip_ratio:", np.mean((sn <= -0.999) | (sn >= 0.999)))
|
| 236 |
+
|
| 237 |
+
t0 = time.perf_counter()
|
| 238 |
+
with torch.inference_mode():
|
| 239 |
+
out = policy.predict_action(fake_data)
|
| 240 |
+
infer_ms = (time.perf_counter() - t0) * 1000
|
| 241 |
+
|
| 242 |
+
# out 来自 predict_action
|
| 243 |
+
na = out["normalized_actions"] # (1, 16, 18) numpy
|
| 244 |
+
|
| 245 |
+
# 1️⃣ 去掉 batch 维
|
| 246 |
+
na2 = na[0, :, :18] # (H, D) 你原逻辑保留
|
| 247 |
+
|
| 248 |
+
# 2️⃣ 用 numpy 版 unnormalize(CPU)
|
| 249 |
+
raw2 = unnormalize_actions(
|
| 250 |
+
na2,
|
| 251 |
+
policy.action_norm_stats,
|
| 252 |
+
) # (16, 18)
|
| 253 |
+
|
| 254 |
+
# 3️⃣ 如有需要再加回 batch 维
|
| 255 |
+
actions = raw2[None, ...] # (1, 16, 18)
|
| 256 |
+
actions = raw2
|
| 257 |
+
print(actions[0, 0])
|
| 258 |
+
|
| 259 |
+
return {"actions": actions, "policy_timing": {"infer_ms": infer_ms}}
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
def _health_check(connection: ws_server.ServerConnection, request: ws_server.Request):
|
| 263 |
+
"""健康检查端点"""
|
| 264 |
+
if request.path == "/healthz":
|
| 265 |
+
return connection.respond(http.HTTPStatus.OK, "OK\n")
|
| 266 |
+
return None
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
class Pi0PolicyServer:
|
| 270 |
+
"""Pi0 WebSocket 推理服务端"""
|
| 271 |
+
|
| 272 |
+
def __init__(self, pi0_policy, args: Args):
|
| 273 |
+
self._policy = pi0_policy
|
| 274 |
+
self._args = args
|
| 275 |
+
self._metadata = {
|
| 276 |
+
"status": "ok",
|
| 277 |
+
"policy": "pi0",
|
| 278 |
+
"obs_cameras": args.obs_camera_name,
|
| 279 |
+
"action_dim": 14,
|
| 280 |
+
}
|
| 281 |
+
self._packer = msgpack_numpy.Packer()
|
| 282 |
+
|
| 283 |
+
def serve_forever(self) -> None:
|
| 284 |
+
"""阻塞式启动服务"""
|
| 285 |
+
asyncio.run(self._run())
|
| 286 |
+
|
| 287 |
+
async def _run(self):
|
| 288 |
+
"""异步运行服务"""
|
| 289 |
+
async with ws_server.serve(
|
| 290 |
+
self._handler,
|
| 291 |
+
self._args.host,
|
| 292 |
+
self._args.port,
|
| 293 |
+
compression=None,
|
| 294 |
+
max_size=None,
|
| 295 |
+
process_request=_health_check,
|
| 296 |
+
) as server:
|
| 297 |
+
print("✓ 服务已启动,等待客户端连接...")
|
| 298 |
+
await server.serve_forever()
|
| 299 |
+
|
| 300 |
+
async def _handler(self, websocket: ws_server.ServerConnection):
|
| 301 |
+
"""处理单个客户端连接"""
|
| 302 |
+
print(f"[连接] 客户端 {websocket.remote_address} 已连接")
|
| 303 |
+
|
| 304 |
+
# 发送 metadata
|
| 305 |
+
await websocket.send(self._packer.pack(self._metadata))
|
| 306 |
+
|
| 307 |
+
while True:
|
| 308 |
+
try:
|
| 309 |
+
data = await websocket.recv()
|
| 310 |
+
if isinstance(data, str):
|
| 311 |
+
await websocket.send(f"Invalid data type: {type(data)}")
|
| 312 |
+
continue
|
| 313 |
+
|
| 314 |
+
obs = msgpack_numpy.unpackb(data)
|
| 315 |
+
result = _infer_single(self._policy, obs, self._args, self._args.gripper_threshold)
|
| 316 |
+
await websocket.send(self._packer.pack(result))
|
| 317 |
+
|
| 318 |
+
except websockets.ConnectionClosed:
|
| 319 |
+
print(f"[断开] 客户端 {websocket.remote_address} 已断开")
|
| 320 |
+
break
|
| 321 |
+
except Exception:
|
| 322 |
+
error_msg = traceback.format_exc()
|
| 323 |
+
print(f"[错误] {error_msg}")
|
| 324 |
+
await websocket.send(error_msg)
|
| 325 |
+
await websocket.close(
|
| 326 |
+
code=websockets.frames.CloseCode.INTERNAL_ERROR,
|
| 327 |
+
reason="Internal server error",
|
| 328 |
+
)
|
| 329 |
+
raise
|
| 330 |
+
|
| 331 |
+
|
| 332 |
+
def serve(args: Args):
|
| 333 |
+
print("=" * 60)
|
| 334 |
+
print("Pi0 WebSocket 推理服务端 (openpi-client 兼容)")
|
| 335 |
+
print("=" * 60)
|
| 336 |
+
print(f" 监听: ws://{args.host}:{args.port}")
|
| 337 |
+
print(f" 权重: {args.ckpt_path}")
|
| 338 |
+
print(f" 数据统计: {args.data_statistics_path}")
|
| 339 |
+
print(f" 相机键: {args.obs_camera_name}")
|
| 340 |
+
print(f" unnorm_key: {args.unnorm_key}")
|
| 341 |
+
print(f" tokenizer: {args.language_tokenizer_path}")
|
| 342 |
+
print("=" * 60)
|
| 343 |
+
|
| 344 |
+
print("[1/2] 初始化模型...")
|
| 345 |
+
pi0_policy = _build_policy(args)
|
| 346 |
+
print("✓ 模型就绪")
|
| 347 |
+
|
| 348 |
+
# ===== 在这里加 =====
|
| 349 |
+
print("Has predict_action:", hasattr(pi0_policy, "predict_action"))
|
| 350 |
+
print("Has __call__:", callable(pi0_policy))
|
| 351 |
+
print("Action-related methods:", [m for m in dir(pi0_policy) if "action" in m.lower()])
|
| 352 |
+
|
| 353 |
+
am = pi0_policy.action_model
|
| 354 |
+
print("past_action_window_size:", getattr(pi0_policy, "past_action_window_size", None))
|
| 355 |
+
print("future_action_window_size:", getattr(pi0_policy, "future_action_window_size", None))
|
| 356 |
+
print("action_model:", type(am))
|
| 357 |
+
print("action_model attrs (state):", [x for x in dir(am) if "state" in x.lower()])
|
| 358 |
+
|
| 359 |
+
# ===================
|
| 360 |
+
|
| 361 |
+
print("[2/2] 启动 WebSocket 服务...")
|
| 362 |
+
server = Pi0PolicyServer(pi0_policy, args)
|
| 363 |
+
|
| 364 |
+
try:
|
| 365 |
+
server.serve_forever()
|
| 366 |
+
except KeyboardInterrupt:
|
| 367 |
+
print("\n[退出] 收到中断信号,正在关闭服务...")
|
| 368 |
+
|
| 369 |
+
|
| 370 |
+
def main():
|
| 371 |
+
serve(tyro.cli(Args))
|
| 372 |
+
|
| 373 |
+
|
| 374 |
+
if __name__ == "__main__":
|
| 375 |
+
main()
|
deployment_robotwin/upload/push_model_to_hf.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from huggingface_hub import create_repo, HfApi
|
| 2 |
+
|
| 3 |
+
# 1. create repository
|
| 4 |
+
hf_name = "StarVLA/Qwen3-VL-OFT-LIBERO-4in1"
|
| 5 |
+
create_repo(hf_name, repo_type="model", exist_ok=True)
|
| 6 |
+
|
| 7 |
+
# 2. initialize API
|
| 8 |
+
api = HfApi()
|
| 9 |
+
|
| 10 |
+
# 3. upload large folder
|
| 11 |
+
folder_path = "/mnt/petrelfs/yejinhui/Projects/starVLA/results/Checkpoints/1_need/Qwen3-VL-OFT-LIBERO-4in1"
|
| 12 |
+
api.upload_large_folder(folder_path=folder_path, repo_id=hf_name, repo_type="model")
|
docs/WM4A.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# WM4A: World Model for Action
|
| 2 |
+
|
| 3 |
+
WM4A repurposes **pretrained video-generation world models** as visual encoders for
|
| 4 |
+
robot action prediction. Instead of using a Vision-Language Model (VLM) backbone,
|
| 5 |
+
WM4A feeds images through a **Diffusion Transformer (DiT)** — the same architecture
|
| 6 |
+
used for video prediction — and attaches a lightweight action head on top of its
|
| 7 |
+
intermediate representations.
|
| 8 |
+
|
| 9 |
+
## Motivation
|
| 10 |
+
|
| 11 |
+
Video prediction models learn rich spatiotemporal representations of physics,
|
| 12 |
+
object permanence, and dynamics. WM4A exploits these representations directly:
|
| 13 |
+
|
| 14 |
+
```
|
| 15 |
+
VLM approach: Image → VLM encoder → language-aligned features → Action Head
|
| 16 |
+
WM4A approach: Image → Video DiT encoder → physics-aligned features → Action Head
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
## Supported Backbones
|
| 20 |
+
|
| 21 |
+
| Backbone | Params | Layers | Hidden Dim | Source |
|
| 22 |
+
|----------|--------|--------|------------|--------|
|
| 23 |
+
| **Cosmos-Predict2-2B** | 2B | 28 | 2048 | NVIDIA Cosmos |
|
| 24 |
+
| **Wan2.2-T2V** | 5B | 30 | 3072 | Alibaba Wan |
|
| 25 |
+
|
| 26 |
+
## Architecture
|
| 27 |
+
|
| 28 |
+
```
|
| 29 |
+
Input: {images: [PIL], instruction: str, actions: [T, action_dim]}
|
| 30 |
+
│
|
| 31 |
+
├─ Text Encoder (T5 / UMT5)
|
| 32 |
+
│ instruction → [B, L_text, text_hidden]
|
| 33 |
+
│
|
| 34 |
+
├─ VAE Encoder
|
| 35 |
+
│ images → latents [B, 16, T_latent, H/8, W/8]
|
| 36 |
+
│
|
| 37 |
+
└─ DiT Transformer (frozen or fine-tuned)
|
| 38 |
+
latents + text_embeds → hidden_states [B, N_tokens, hidden_dim]
|
| 39 |
+
│
|
| 40 |
+
└─ Action Head (one of three variants below)
|
| 41 |
+
→ predicted actions [B, chunk_len, action_dim]
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
## Action Head Variants
|
| 45 |
+
|
| 46 |
+
Each backbone can be paired with three action head types:
|
| 47 |
+
|
| 48 |
+
| Variant | Action Head | What it uses | Speed | Frameworks |
|
| 49 |
+
|---------|------------|--------------|-------|------------|
|
| 50 |
+
| **OFT** | MLP regression | Last layer only | Fastest | `CosmoPredict2OFT`, `WanOFT` |
|
| 51 |
+
| **GR00T** | Flow-matching diffusion (single-layer) | Last layer only | Medium | `CosmoPredict2GR00T`, `WanGR00T` |
|
| 52 |
+
| **PI** | Layer-wise cross-attention DiT | All transformer layers | Slowest | `CosmoPredict2PI`, `WanPI` |
|
| 53 |
+
|
| 54 |
+
This gives **7 framework combinations** (including a generic `WM4A_OFT`).
|
| 55 |
+
|
| 56 |
+
## Quick Start: Inspect the Data Flow
|
| 57 |
+
|
| 58 |
+
Run the built-in demo to see the full forward pass (training + inference):
|
| 59 |
+
|
| 60 |
+
```bash
|
| 61 |
+
python starVLA/model/framework/WM4A/CosmoPredict2GR00T.py
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
This script:
|
| 65 |
+
1. Loads a config and instantiates the `CosmoPredict2_GR00T` model
|
| 66 |
+
2. Creates a synthetic batch with multi-view images and random actions
|
| 67 |
+
3. Runs the **training forward** and prints the action loss
|
| 68 |
+
4. Runs the **inference forward** and prints the predicted actions
|
| 69 |
+
|
| 70 |
+
> **Note:** You need the Cosmos-Predict2-2B weights downloaded locally.
|
| 71 |
+
> Set the path in the script or download via:
|
| 72 |
+
> ```bash
|
| 73 |
+
> huggingface-cli download nvidia/Cosmos-Predict2-2B-Video2World \
|
| 74 |
+
> --local-dir ./playground/Pretrained_models/nvidia/Cosmos-Predict2-2B-Video2World
|
| 75 |
+
> ```
|
| 76 |
+
|
| 77 |
+
## Training
|
| 78 |
+
|
| 79 |
+
### Recommended: LIBERO with CosmoPredict2OFT
|
| 80 |
+
|
| 81 |
+
The simplest way to train a WM4A model is with the OFT (MLP) action head on
|
| 82 |
+
the LIBERO benchmark:
|
| 83 |
+
|
| 84 |
+
```bash
|
| 85 |
+
# From the starVLA project root
|
| 86 |
+
bash examples/LIBERO/train_files/run_libero_train.sh
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
Before running, edit the script to set your local paths:
|
| 90 |
+
|
| 91 |
+
```bash
|
| 92 |
+
Framework_name=CosmoPredict2OFT # or CosmoPredict2GR00T, WanOFT, etc.
|
| 93 |
+
base_wm=nvidia/Cosmos-Predict2-2B-Video2World> # still needed for tokenizer/processor
|
| 94 |
+
config_yaml=./examples/LIBERO/train_files/starvla_cotrain_libero.yaml
|
| 95 |
+
libero_data_root=<path_to_LIBERO_dataset>
|
| 96 |
+
data_mix=libero_all # or libero_goal
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
Key training arguments:
|
| 100 |
+
|
| 101 |
+
| Argument | Description | Recommended |
|
| 102 |
+
|----------|-------------|-------------|
|
| 103 |
+
| `--framework.name` | Framework class name | `CosmoPredict2OFT` |
|
| 104 |
+
| `--framework.action_model.future_action_window_size` | Action prediction horizon | 7 |
|
| 105 |
+
| `--datasets.vla_data.per_device_batch_size` | Per-GPU batch size | 16 (OFT) / 8 (GR00T) |
|
| 106 |
+
| `--trainer.max_train_steps` | Total training steps | 80000 |
|
| 107 |
+
| `--trainer.save_interval` | Checkpoint save frequency | 10000 |
|
| 108 |
+
|
| 109 |
+
### Switching Backbones
|
| 110 |
+
|
| 111 |
+
To use Wan instead of Cosmos, simply change the framework name:
|
| 112 |
+
|
| 113 |
+
```bash
|
| 114 |
+
Framework_name=WanOFT # or WanGR00T, WanPI
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
The config YAML remains the same — the framework class handles backbone loading
|
| 118 |
+
automatically based on its registered name.
|
| 119 |
+
|
| 120 |
+
## Code Structure
|
| 121 |
+
|
| 122 |
+
```
|
| 123 |
+
starVLA/model/
|
| 124 |
+
├── framework/
|
| 125 |
+
│ └── WM4A/
|
| 126 |
+
│ ├── CosmoPredict2GR00T.py # Cosmos + flow-matching head
|
| 127 |
+
│ ├── CosmoPredict2OFT.py # Cosmos + MLP head
|
| 128 |
+
│ ├── CosmoPredict2PI.py # Cosmos + layer-wise cross-DiT head
|
| 129 |
+
│ ├── WanGR00T.py # Wan + flow-matching head
|
| 130 |
+
│ ├── WanOFT.py # Wan + MLP head
|
| 131 |
+
│ ├── WanPI.py # Wan + layer-wise cross-DiT head
|
| 132 |
+
│ └── WM4A_OFT.py # Generic WM backend + MLP head
|
| 133 |
+
└── modules/
|
| 134 |
+
├── world_model/
|
| 135 |
+
│ └── CosmoPredict2.py # Cosmos backbone wrapper (VAE + T5 + DiT)
|
| 136 |
+
└── action_model/
|
| 137 |
+
├── MLP_ActionHeader.py # OFT action head
|
| 138 |
+
├── flow_matching_head/ # GR00T action head (single-layer FM)
|
| 139 |
+
└── LayerwiseFM_ActionHeader.py # PI action head (layer-wise FM)
|
| 140 |
+
```
|
| 141 |
+
|
| 142 |
+
## Key Implementation Details
|
| 143 |
+
|
| 144 |
+
- **Precision**: DiT forward runs in `bfloat16` for speed; action head runs in
|
| 145 |
+
`float32` for numerical stability.
|
| 146 |
+
- **Feature extraction**: Uses PyTorch hooks on selected DiT blocks to capture
|
| 147 |
+
intermediate hidden states without modifying the backbone code.
|
| 148 |
+
- **Timestep trick**: Sets `timestep=0` during feature extraction — this extracts
|
| 149 |
+
representations at the near-clean noise level rather than denoising.
|
| 150 |
+
- **Shape reshaping**: DiT outputs `[B, C, T, H, W]` video tensors, which are
|
| 151 |
+
reshaped to `[B, T*H*W, C]` token sequences for the action head.
|
| 152 |
+
- **Framework registry**: All WM4A classes register themselves via
|
| 153 |
+
`@FRAMEWORK_REGISTRY.register("FrameworkName")` and are auto-discovered at
|
| 154 |
+
import time — no manual imports needed.
|
environment/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Evaluation Environments
|
| 2 |
+
|
| 3 |
+
The Mac contains portable source, model metadata, and simulation assets, not a
|
| 4 |
+
native macOS policy runtime. Run evaluation on a Linux x86_64 NVIDIA GPU machine.
|
| 5 |
+
Policy inference and simulation use separate Python 3.10 environments, as in
|
| 6 |
+
the historical evaluation.
|
| 7 |
+
|
| 8 |
+
## Validated Source Selection
|
| 9 |
+
|
| 10 |
+
The launcher prepends only this repository and its vendored packages to
|
| 11 |
+
`PYTHONPATH`. It disables user-site imports and online model downloads.
|
| 12 |
+
Do not use the machine's editable RoboCasa installation: it can point to
|
| 13 |
+
another user's modified checkout.
|
| 14 |
+
|
| 15 |
+
- RoboCasa: historical `liao` checkout, Git base
|
| 16 |
+
`4840e671596f93ca03651524b9f72ffb1aadfeff`, including its modified `tabletop.py`.
|
| 17 |
+
- RoboSuite: version 1.5.1 source and matching assets are vendored.
|
| 18 |
+
- GR1 kinematics: exact historical URDF and `gr1_pos_transform_new.py`.
|
| 19 |
+
- `pykdl_utils` and `hrl_geom`: local source copies, not unresolved editable paths.
|
| 20 |
+
- Orocos KDL / PyKDL 1.5.4: vendored source at
|
| 21 |
+
`third_party/orocos_kinematics_dynamics`, Git commit
|
| 22 |
+
`fb840b0edb3e9905c354276d6513dddf4fd4ac1b`. The setup recipe builds this
|
| 23 |
+
version rather than substituting a Conda KDL 1.5.1 package.
|
| 24 |
+
- No new GR00T policy or newer RoboCasa task set is substituted.
|
| 25 |
+
|
| 26 |
+
## Environment Recreation
|
| 27 |
+
|
| 28 |
+
Run `bash environment/create_linux_envs.sh /absolute/empty/environment/prefix`.
|
| 29 |
+
This creates new environments and refuses to overwrite existing ones.
|
| 30 |
+
The setup script is a recreation recipe; clean-machine installation is a
|
| 31 |
+
separate validation from tests using the original server's environments.
|
| 32 |
+
|
| 33 |
+
The NVIDIA driver and an EGL-capable rendering installation must be supplied
|
| 34 |
+
by the host/container. FlashAttention compilation additionally requires an
|
| 35 |
+
appropriate CUDA toolkit and C++ compiler. The launcher accepts
|
| 36 |
+
`EGL_LIBRARY_PATH` when the host's EGL driver libraries need an explicit path;
|
| 37 |
+
it does not embed the original server's library directory.
|
| 38 |
+
|
| 39 |
+
Important runtime versions:
|
| 40 |
+
|
| 41 |
+
| Component | Policy | Simulation |
|
| 42 |
+
| --- | --- | --- |
|
| 43 |
+
| Python | 3.10.19 | 3.10.18 |
|
| 44 |
+
| PyTorch | 2.8.0 + CUDA 12.8 | 2.5.1 + CUDA 12.4 |
|
| 45 |
+
| TorchVision | 0.23.0 | 0.20.1 |
|
| 46 |
+
| NumPy | 2.2.6 | 1.26.4 |
|
| 47 |
+
| Gymnasium | not used for simulation | 1.0.0 |
|
| 48 |
+
| MuJoCo | not used for simulation | 3.2.6 |
|
| 49 |
+
| Transformers | 5.8.1 | not needed by the portable simulation entry |
|
| 50 |
+
| Diffusers | 0.38.0 | not needed by the portable simulation entry |
|
| 51 |
+
| FlashAttention | 2.8.3 | not needed |
|
| 52 |
+
| PyKDL | not used | 1.5.4 |
|
| 53 |
+
| PyAV | 12.3.0 | 12.3.0 |
|
| 54 |
+
|
| 55 |
+
`*.observed.json` retains all installed distribution metadata as found during
|
| 56 |
+
migration. The old simulation environment contains duplicate distribution
|
| 57 |
+
metadata, including Torch 2.5.1/2.8.0 and Gymnasium 1.0.0/1.2.1. Actual imported
|
| 58 |
+
runtime versions take precedence over those stale metadata entries.
|
| 59 |
+
|
| 60 |
+
The simulation client uses a lightweight metadata reader with the same YAML
|
| 61 |
+
and statistics semantics as the original helper; it no longer imports the
|
| 62 |
+
entire model registry just to read normalization values.
|
| 63 |
+
|
| 64 |
+
Clean-install validation was attempted on September 25, 2026 but the authorized
|
| 65 |
+
server could not reach `conda.anaconda.org:443` (network unreachable). The setup
|
| 66 |
+
recipe must not be described as clean-install validated. Forward tests using
|
| 67 |
+
the preserved environments are recorded separately in `../VALIDATION.md`.
|
environment/build_kdl.sh
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
|
| 4 |
+
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
| 5 |
+
PYTHON="${1:?Pass the absolute simulation Python path}"
|
| 6 |
+
PREFIX="${2:?Pass an installation prefix owned by this release setup}"
|
| 7 |
+
SOURCE="$ROOT/third_party/orocos_kinematics_dynamics"
|
| 8 |
+
BUILD="$PREFIX/.kdl-build"
|
| 9 |
+
[[ "$PREFIX" = /* && "$PYTHON" = /* ]] || { echo "Use absolute paths." >&2; exit 2; }
|
| 10 |
+
[[ ! -e "$BUILD" ]] || { echo "Refusing to overwrite an existing KDL build." >&2; exit 2; }
|
| 11 |
+
VERSION="$("$PYTHON" -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')"
|
| 12 |
+
[[ "$VERSION" = 3.10 ]] || { echo "Use the pinned Python 3.10 interpreter." >&2; exit 2; }
|
| 13 |
+
export PATH="$PREFIX/bin:$PATH"
|
| 14 |
+
cmake -S "$SOURCE/orocos_kdl" -B "$BUILD/core" \
|
| 15 |
+
-DCMAKE_INSTALL_PREFIX="$PREFIX" -DCMAKE_BUILD_TYPE=Release \
|
| 16 |
+
-DCMAKE_PREFIX_PATH="$PREFIX" -DBUILD_TESTING=OFF
|
| 17 |
+
cmake --build "$BUILD/core" --parallel "${MAX_JOBS:-2}"
|
| 18 |
+
cmake --install "$BUILD/core"
|
| 19 |
+
cmake -S "$SOURCE/python_orocos_kdl" -B "$BUILD/python" \
|
| 20 |
+
-DCMAKE_INSTALL_PREFIX="$PREFIX" -DCMAKE_BUILD_TYPE=Release \
|
| 21 |
+
-DCMAKE_PREFIX_PATH="$PREFIX" -DPython3_EXECUTABLE="$PYTHON" \
|
| 22 |
+
-DPYTHON_SITE_PACKAGES_INSTALL_DIR="$PREFIX/lib/python3.10/site-packages" \
|
| 23 |
+
-DCMAKE_INSTALL_RPATH="$PREFIX/lib"
|
| 24 |
+
cmake --build "$BUILD/python" --parallel "${MAX_JOBS:-2}"
|
| 25 |
+
cmake --install "$BUILD/python"
|
| 26 |
+
PYTHONPATH="$PREFIX/lib/python3.10/site-packages" "$PYTHON" -c \
|
| 27 |
+
'import PyKDL; assert PyKDL.__version__ == "1.5.4"; print(PyKDL.__file__, PyKDL.__version__)'
|
environment/create_linux_envs.sh
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
|
| 4 |
+
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
| 5 |
+
if [[ "$(uname -s)" != Linux || "$(uname -m)" != x86_64 ]]; then
|
| 6 |
+
echo "Evaluation requires a Linux x86_64 NVIDIA CUDA host. The Mac copy is the portable source archive." >&2
|
| 7 |
+
exit 2
|
| 8 |
+
fi
|
| 9 |
+
command -v conda >/dev/null || { echo "Install Miniforge/Conda first." >&2; exit 2; }
|
| 10 |
+
PREFIX="${1:-$ROOT/.runtime/envs}"
|
| 11 |
+
POLICY="$PREFIX/policy"
|
| 12 |
+
SIM="$PREFIX/simulation"
|
| 13 |
+
if [[ -e "$POLICY" || -e "$SIM" ]]; then
|
| 14 |
+
echo "Refusing to alter existing environments. Choose a new empty prefix." >&2
|
| 15 |
+
exit 2
|
| 16 |
+
fi
|
| 17 |
+
conda create -y -p "$POLICY" -c conda-forge python=3.10.19 pip
|
| 18 |
+
"$POLICY/bin/python" -m pip install torch==2.8.0 torchvision==0.23.0 \
|
| 19 |
+
--index-url https://download.pytorch.org/whl/cu128
|
| 20 |
+
"$POLICY/bin/python" -m pip install -r "$ROOT/environment/policy.requirements.txt"
|
| 21 |
+
"$POLICY/bin/python" -m pip install packaging ninja
|
| 22 |
+
MAX_JOBS="${MAX_JOBS:-4}" "$POLICY/bin/python" -m pip install flash-attn==2.8.3 --no-build-isolation
|
| 23 |
+
|
| 24 |
+
conda create -y -p "$SIM" -c conda-forge python=3.10.18 pip cmake eigen cxx-compiler
|
| 25 |
+
"$SIM/bin/python" -m pip install torch==2.5.1 torchvision==0.20.1 \
|
| 26 |
+
--index-url https://download.pytorch.org/whl/cu124
|
| 27 |
+
"$SIM/bin/python" -m pip install -r "$ROOT/environment/simulation.requirements.txt"
|
| 28 |
+
bash "$ROOT/environment/build_kdl.sh" "$SIM/bin/python" "$SIM"
|
| 29 |
+
echo "POLICY_PYTHON=$POLICY/bin/python"
|
| 30 |
+
echo "SIM_PYTHON=$SIM/bin/python"
|
| 31 |
+
echo "Source packages are selected through release.evaluate's isolated PYTHONPATH."
|
environment/policy.requirements.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
accelerate==1.5.2
|
| 2 |
+
av==12.3.0
|
| 3 |
+
diffusers==0.38.0
|
| 4 |
+
einops==0.8.1
|
| 5 |
+
easydict==1.13
|
| 6 |
+
huggingface-hub==1.15.0
|
| 7 |
+
matplotlib==3.10.8
|
| 8 |
+
msgpack==1.1.2
|
| 9 |
+
msgpack-numpy==0.4.8
|
| 10 |
+
numpy==2.2.6
|
| 11 |
+
omegaconf==2.3.0
|
| 12 |
+
opencv-python-headless==4.11.0.86
|
| 13 |
+
pillow==12.0.0
|
| 14 |
+
pydantic==2.10.6
|
| 15 |
+
qwen-vl-utils==0.0.14
|
| 16 |
+
rich==14.2.0
|
| 17 |
+
safetensors==0.8.0rc0
|
| 18 |
+
scipy==1.15.3
|
| 19 |
+
sentencepiece==0.2.1
|
| 20 |
+
setuptools==80.9.0
|
| 21 |
+
timm==1.0.22
|
| 22 |
+
transformers==5.8.1
|
| 23 |
+
tyro==1.0.3
|
| 24 |
+
websockets==15.0.1
|
environment/robocasa.observed.json
ADDED
|
@@ -0,0 +1,1288 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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-forge | (main, Jun 4 2025, 14:45:41) [GCC 13.3.0]",
|
| 3 |
+
"packages": [
|
| 4 |
+
{
|
| 5 |
+
"name": "Farama-Notifications",
|
| 6 |
+
"version": "0.0.4",
|
| 7 |
+
"direct_url": null
|
| 8 |
+
},
|
| 9 |
+
{
|
| 10 |
+
"name": "PyOpenGL",
|
| 11 |
+
"version": "3.1.7",
|
| 12 |
+
"direct_url": null
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"name": "PyOpenGL-accelerate",
|
| 16 |
+
"version": "3.1.7",
|
| 17 |
+
"direct_url": null
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"name": "PyYAML",
|
| 21 |
+
"version": "6.0.2",
|
| 22 |
+
"direct_url": null
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"name": "PyYAML",
|
| 26 |
+
"version": "6.0.3",
|
| 27 |
+
"direct_url": null
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
"name": "TorchCodec",
|
| 31 |
+
"version": "0.1.0",
|
| 32 |
+
"direct_url": null
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"name": "absl-py",
|
| 36 |
+
"version": "2.3.1",
|
| 37 |
+
"direct_url": null
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"name": "accelerate",
|
| 41 |
+
"version": "1.2.1",
|
| 42 |
+
"direct_url": null
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"name": "aiosignal",
|
| 46 |
+
"version": "1.4.0",
|
| 47 |
+
"direct_url": null
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"name": "albucore",
|
| 51 |
+
"version": "0.0.17",
|
| 52 |
+
"direct_url": null
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"name": "albumentations",
|
| 56 |
+
"version": "1.4.18",
|
| 57 |
+
"direct_url": null
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"name": "annotated-types",
|
| 61 |
+
"version": "0.7.0",
|
| 62 |
+
"direct_url": null
|
| 63 |
+
},
|
| 64 |
+
{
|
| 65 |
+
"name": "antlr4-python3-runtime",
|
| 66 |
+
"version": "4.9.3",
|
| 67 |
+
"direct_url": null
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
"name": "anytree",
|
| 71 |
+
"version": "2.13.0",
|
| 72 |
+
"direct_url": null
|
| 73 |
+
},
|
| 74 |
+
{
|
| 75 |
+
"name": "astunparse",
|
| 76 |
+
"version": "1.6.3",
|
| 77 |
+
"direct_url": null
|
| 78 |
+
},
|
| 79 |
+
{
|
| 80 |
+
"name": "attrs",
|
| 81 |
+
"version": "25.4.0",
|
| 82 |
+
"direct_url": null
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"name": "av",
|
| 86 |
+
"version": "12.3.0",
|
| 87 |
+
"direct_url": null
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"name": "blessings",
|
| 91 |
+
"version": "1.7",
|
| 92 |
+
"direct_url": null
|
| 93 |
+
},
|
| 94 |
+
{
|
| 95 |
+
"name": "cachetools",
|
| 96 |
+
"version": "6.2.0",
|
| 97 |
+
"direct_url": null
|
| 98 |
+
},
|
| 99 |
+
{
|
| 100 |
+
"name": "catkin-pkg",
|
| 101 |
+
"version": "1.1.0",
|
| 102 |
+
"direct_url": null
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"name": "certifi",
|
| 106 |
+
"version": "2025.10.5",
|
| 107 |
+
"direct_url": null
|
| 108 |
+
},
|
| 109 |
+
{
|
| 110 |
+
"name": "charset-normalizer",
|
| 111 |
+
"version": "3.4.3",
|
| 112 |
+
"direct_url": null
|
| 113 |
+
},
|
| 114 |
+
{
|
| 115 |
+
"name": "click",
|
| 116 |
+
"version": "8.3.0",
|
| 117 |
+
"direct_url": null
|
| 118 |
+
},
|
| 119 |
+
{
|
| 120 |
+
"name": "cloudpickle",
|
| 121 |
+
"version": "3.1.1",
|
| 122 |
+
"direct_url": null
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
"name": "cmeel",
|
| 126 |
+
"version": "0.59.0",
|
| 127 |
+
"direct_url": null
|
| 128 |
+
},
|
| 129 |
+
{
|
| 130 |
+
"name": "cmeel-assimp",
|
| 131 |
+
"version": "6.0.2",
|
| 132 |
+
"direct_url": null
|
| 133 |
+
},
|
| 134 |
+
{
|
| 135 |
+
"name": "cmeel-boost",
|
| 136 |
+
"version": "1.89.0",
|
| 137 |
+
"direct_url": null
|
| 138 |
+
},
|
| 139 |
+
{
|
| 140 |
+
"name": "cmeel-console-bridge",
|
| 141 |
+
"version": "1.0.2.3",
|
| 142 |
+
"direct_url": null
|
| 143 |
+
},
|
| 144 |
+
{
|
| 145 |
+
"name": "cmeel-octomap",
|
| 146 |
+
"version": "1.10.0",
|
| 147 |
+
"direct_url": null
|
| 148 |
+
},
|
| 149 |
+
{
|
| 150 |
+
"name": "cmeel-qhull",
|
| 151 |
+
"version": "8.0.2.1",
|
| 152 |
+
"direct_url": null
|
| 153 |
+
},
|
| 154 |
+
{
|
| 155 |
+
"name": "cmeel-tinyxml2",
|
| 156 |
+
"version": "10.0.0",
|
| 157 |
+
"direct_url": null
|
| 158 |
+
},
|
| 159 |
+
{
|
| 160 |
+
"name": "cmeel-urdfdom",
|
| 161 |
+
"version": "4.0.1",
|
| 162 |
+
"direct_url": null
|
| 163 |
+
},
|
| 164 |
+
{
|
| 165 |
+
"name": "cmeel-zlib",
|
| 166 |
+
"version": "1.3.1",
|
| 167 |
+
"direct_url": null
|
| 168 |
+
},
|
| 169 |
+
{
|
| 170 |
+
"name": "coal",
|
| 171 |
+
"version": "3.0.2",
|
| 172 |
+
"direct_url": null
|
| 173 |
+
},
|
| 174 |
+
{
|
| 175 |
+
"name": "contourpy",
|
| 176 |
+
"version": "1.3.2",
|
| 177 |
+
"direct_url": null
|
| 178 |
+
},
|
| 179 |
+
{
|
| 180 |
+
"name": "cramjam",
|
| 181 |
+
"version": "2.11.0",
|
| 182 |
+
"direct_url": null
|
| 183 |
+
},
|
| 184 |
+
{
|
| 185 |
+
"name": "cycler",
|
| 186 |
+
"version": "0.12.1",
|
| 187 |
+
"direct_url": null
|
| 188 |
+
},
|
| 189 |
+
{
|
| 190 |
+
"name": "datasets",
|
| 191 |
+
"version": "4.8.4",
|
| 192 |
+
"direct_url": null
|
| 193 |
+
},
|
| 194 |
+
{
|
| 195 |
+
"name": "debugpy",
|
| 196 |
+
"version": "1.8.19",
|
| 197 |
+
"direct_url": null
|
| 198 |
+
},
|
| 199 |
+
{
|
| 200 |
+
"name": "decord",
|
| 201 |
+
"version": "0.6.0",
|
| 202 |
+
"direct_url": null
|
| 203 |
+
},
|
| 204 |
+
{
|
| 205 |
+
"name": "diffusers",
|
| 206 |
+
"version": "0.30.2",
|
| 207 |
+
"direct_url": null
|
| 208 |
+
},
|
| 209 |
+
{
|
| 210 |
+
"name": "dill",
|
| 211 |
+
"version": "0.4.1",
|
| 212 |
+
"direct_url": null
|
| 213 |
+
},
|
| 214 |
+
{
|
| 215 |
+
"name": "dm-tree",
|
| 216 |
+
"version": "0.1.8",
|
| 217 |
+
"direct_url": null
|
| 218 |
+
},
|
| 219 |
+
{
|
| 220 |
+
"name": "docker-pycreds",
|
| 221 |
+
"version": "0.4.0",
|
| 222 |
+
"direct_url": null
|
| 223 |
+
},
|
| 224 |
+
{
|
| 225 |
+
"name": "docstring_parser",
|
| 226 |
+
"version": "0.17.0",
|
| 227 |
+
"direct_url": null
|
| 228 |
+
},
|
| 229 |
+
{
|
| 230 |
+
"name": "docutils",
|
| 231 |
+
"version": "0.22.3",
|
| 232 |
+
"direct_url": null
|
| 233 |
+
},
|
| 234 |
+
{
|
| 235 |
+
"name": "eigenpy",
|
| 236 |
+
"version": "3.12.0",
|
| 237 |
+
"direct_url": null
|
| 238 |
+
},
|
| 239 |
+
{
|
| 240 |
+
"name": "einops",
|
| 241 |
+
"version": "0.8.1",
|
| 242 |
+
"direct_url": null
|
| 243 |
+
},
|
| 244 |
+
{
|
| 245 |
+
"name": "etils",
|
| 246 |
+
"version": "1.13.0",
|
| 247 |
+
"direct_url": null
|
| 248 |
+
},
|
| 249 |
+
{
|
| 250 |
+
"name": "eval_type_backport",
|
| 251 |
+
"version": "0.2.2",
|
| 252 |
+
"direct_url": null
|
| 253 |
+
},
|
| 254 |
+
{
|
| 255 |
+
"name": "evdev",
|
| 256 |
+
"version": "1.9.2",
|
| 257 |
+
"direct_url": null
|
| 258 |
+
},
|
| 259 |
+
{
|
| 260 |
+
"name": "exceptiongroup",
|
| 261 |
+
"version": "1.3.0",
|
| 262 |
+
"direct_url": null
|
| 263 |
+
},
|
| 264 |
+
{
|
| 265 |
+
"name": "fastparquet",
|
| 266 |
+
"version": "2024.11.0",
|
| 267 |
+
"direct_url": null
|
| 268 |
+
},
|
| 269 |
+
{
|
| 270 |
+
"name": "filelock",
|
| 271 |
+
"version": "3.20.0",
|
| 272 |
+
"direct_url": null
|
| 273 |
+
},
|
| 274 |
+
{
|
| 275 |
+
"name": "flatbuffers",
|
| 276 |
+
"version": "25.9.23",
|
| 277 |
+
"direct_url": null
|
| 278 |
+
},
|
| 279 |
+
{
|
| 280 |
+
"name": "fonttools",
|
| 281 |
+
"version": "4.60.1",
|
| 282 |
+
"direct_url": null
|
| 283 |
+
},
|
| 284 |
+
{
|
| 285 |
+
"name": "frozenlist",
|
| 286 |
+
"version": "1.8.0",
|
| 287 |
+
"direct_url": null
|
| 288 |
+
},
|
| 289 |
+
{
|
| 290 |
+
"name": "fsspec",
|
| 291 |
+
"version": "2025.9.0",
|
| 292 |
+
"direct_url": null
|
| 293 |
+
},
|
| 294 |
+
{
|
| 295 |
+
"name": "fvcore",
|
| 296 |
+
"version": "0.1.5.post20221221",
|
| 297 |
+
"direct_url": null
|
| 298 |
+
},
|
| 299 |
+
{
|
| 300 |
+
"name": "gast",
|
| 301 |
+
"version": "0.6.0",
|
| 302 |
+
"direct_url": null
|
| 303 |
+
},
|
| 304 |
+
{
|
| 305 |
+
"name": "gitdb",
|
| 306 |
+
"version": "4.0.12",
|
| 307 |
+
"direct_url": null
|
| 308 |
+
},
|
| 309 |
+
{
|
| 310 |
+
"name": "GitPython",
|
| 311 |
+
"version": "3.1.45",
|
| 312 |
+
"direct_url": null
|
| 313 |
+
},
|
| 314 |
+
{
|
| 315 |
+
"name": "glfw",
|
| 316 |
+
"version": "2.10.0",
|
| 317 |
+
"direct_url": null
|
| 318 |
+
},
|
| 319 |
+
{
|
| 320 |
+
"name": "google-auth",
|
| 321 |
+
"version": "2.41.1",
|
| 322 |
+
"direct_url": null
|
| 323 |
+
},
|
| 324 |
+
{
|
| 325 |
+
"name": "google-auth-oauthlib",
|
| 326 |
+
"version": "1.2.2",
|
| 327 |
+
"direct_url": null
|
| 328 |
+
},
|
| 329 |
+
{
|
| 330 |
+
"name": "google-pasta",
|
| 331 |
+
"version": "0.2.0",
|
| 332 |
+
"direct_url": null
|
| 333 |
+
},
|
| 334 |
+
{
|
| 335 |
+
"name": "gr00t",
|
| 336 |
+
"version": "1.1.0",
|
| 337 |
+
"direct_url": {
|
| 338 |
+
"dir_info": {
|
| 339 |
+
"editable": true
|
| 340 |
+
},
|
| 341 |
+
"url": "file:///mnt/workspace/users/zhangtianle/others/Isaac-GR00T"
|
| 342 |
+
}
|
| 343 |
+
},
|
| 344 |
+
{
|
| 345 |
+
"name": "grpcio",
|
| 346 |
+
"version": "1.75.1",
|
| 347 |
+
"direct_url": null
|
| 348 |
+
},
|
| 349 |
+
{
|
| 350 |
+
"name": "gymnasium",
|
| 351 |
+
"version": "1.0.0",
|
| 352 |
+
"direct_url": null
|
| 353 |
+
},
|
| 354 |
+
{
|
| 355 |
+
"name": "gymnasium",
|
| 356 |
+
"version": "1.2.1",
|
| 357 |
+
"direct_url": null
|
| 358 |
+
},
|
| 359 |
+
{
|
| 360 |
+
"name": "h5py",
|
| 361 |
+
"version": "3.12.1",
|
| 362 |
+
"direct_url": null
|
| 363 |
+
},
|
| 364 |
+
{
|
| 365 |
+
"name": "h5py",
|
| 366 |
+
"version": "3.14.0",
|
| 367 |
+
"direct_url": null
|
| 368 |
+
},
|
| 369 |
+
{
|
| 370 |
+
"name": "hf-xet",
|
| 371 |
+
"version": "1.1.10",
|
| 372 |
+
"direct_url": null
|
| 373 |
+
},
|
| 374 |
+
{
|
| 375 |
+
"name": "hidapi",
|
| 376 |
+
"version": "0.14.0.post4",
|
| 377 |
+
"direct_url": null
|
| 378 |
+
},
|
| 379 |
+
{
|
| 380 |
+
"name": "hrl_geom",
|
| 381 |
+
"version": "0.1.0",
|
| 382 |
+
"direct_url": {
|
| 383 |
+
"dir_info": {
|
| 384 |
+
"editable": true
|
| 385 |
+
},
|
| 386 |
+
"url": "file:///mnt/workspace/users/zhangtianle/others/hrl_geom"
|
| 387 |
+
}
|
| 388 |
+
},
|
| 389 |
+
{
|
| 390 |
+
"name": "huggingface-hub",
|
| 391 |
+
"version": "0.35.3",
|
| 392 |
+
"direct_url": null
|
| 393 |
+
},
|
| 394 |
+
{
|
| 395 |
+
"name": "hydra-core",
|
| 396 |
+
"version": "1.3.2",
|
| 397 |
+
"direct_url": null
|
| 398 |
+
},
|
| 399 |
+
{
|
| 400 |
+
"name": "idna",
|
| 401 |
+
"version": "3.10",
|
| 402 |
+
"direct_url": null
|
| 403 |
+
},
|
| 404 |
+
{
|
| 405 |
+
"name": "imageio",
|
| 406 |
+
"version": "2.34.2",
|
| 407 |
+
"direct_url": null
|
| 408 |
+
},
|
| 409 |
+
{
|
| 410 |
+
"name": "imageio",
|
| 411 |
+
"version": "2.37.0",
|
| 412 |
+
"direct_url": null
|
| 413 |
+
},
|
| 414 |
+
{
|
| 415 |
+
"name": "imageio-ffmpeg",
|
| 416 |
+
"version": "0.6.0",
|
| 417 |
+
"direct_url": null
|
| 418 |
+
},
|
| 419 |
+
{
|
| 420 |
+
"name": "importlib_metadata",
|
| 421 |
+
"version": "8.7.0",
|
| 422 |
+
"direct_url": null
|
| 423 |
+
},
|
| 424 |
+
{
|
| 425 |
+
"name": "importlib_resources",
|
| 426 |
+
"version": "6.5.2",
|
| 427 |
+
"direct_url": null
|
| 428 |
+
},
|
| 429 |
+
{
|
| 430 |
+
"name": "iniconfig",
|
| 431 |
+
"version": "2.1.0",
|
| 432 |
+
"direct_url": null
|
| 433 |
+
},
|
| 434 |
+
{
|
| 435 |
+
"name": "inquirerpy",
|
| 436 |
+
"version": "0.3.4",
|
| 437 |
+
"direct_url": null
|
| 438 |
+
},
|
| 439 |
+
{
|
| 440 |
+
"name": "iopath",
|
| 441 |
+
"version": "0.1.10",
|
| 442 |
+
"direct_url": null
|
| 443 |
+
},
|
| 444 |
+
{
|
| 445 |
+
"name": "Jinja2",
|
| 446 |
+
"version": "3.1.6",
|
| 447 |
+
"direct_url": null
|
| 448 |
+
},
|
| 449 |
+
{
|
| 450 |
+
"name": "jsonschema",
|
| 451 |
+
"version": "4.25.1",
|
| 452 |
+
"direct_url": null
|
| 453 |
+
},
|
| 454 |
+
{
|
| 455 |
+
"name": "jsonschema-specifications",
|
| 456 |
+
"version": "2025.9.1",
|
| 457 |
+
"direct_url": null
|
| 458 |
+
},
|
| 459 |
+
{
|
| 460 |
+
"name": "keras",
|
| 461 |
+
"version": "2.15.0",
|
| 462 |
+
"direct_url": null
|
| 463 |
+
},
|
| 464 |
+
{
|
| 465 |
+
"name": "kiwisolver",
|
| 466 |
+
"version": "1.4.9",
|
| 467 |
+
"direct_url": null
|
| 468 |
+
},
|
| 469 |
+
{
|
| 470 |
+
"name": "kornia",
|
| 471 |
+
"version": "0.7.4",
|
| 472 |
+
"direct_url": null
|
| 473 |
+
},
|
| 474 |
+
{
|
| 475 |
+
"name": "kornia_rs",
|
| 476 |
+
"version": "0.1.9",
|
| 477 |
+
"direct_url": null
|
| 478 |
+
},
|
| 479 |
+
{
|
| 480 |
+
"name": "lazy_loader",
|
| 481 |
+
"version": "0.4",
|
| 482 |
+
"direct_url": null
|
| 483 |
+
},
|
| 484 |
+
{
|
| 485 |
+
"name": "lerobot",
|
| 486 |
+
"version": "0.4.4",
|
| 487 |
+
"direct_url": null
|
| 488 |
+
},
|
| 489 |
+
{
|
| 490 |
+
"name": "libclang",
|
| 491 |
+
"version": "18.1.1",
|
| 492 |
+
"direct_url": null
|
| 493 |
+
},
|
| 494 |
+
{
|
| 495 |
+
"name": "libcoal",
|
| 496 |
+
"version": "3.0.2",
|
| 497 |
+
"direct_url": null
|
| 498 |
+
},
|
| 499 |
+
{
|
| 500 |
+
"name": "libero",
|
| 501 |
+
"version": "0.1.0",
|
| 502 |
+
"direct_url": {
|
| 503 |
+
"dir_info": {
|
| 504 |
+
"editable": true
|
| 505 |
+
},
|
| 506 |
+
"url": "file:///mnt/workspace/users/zlk/openpi/third_party/LIBERO"
|
| 507 |
+
}
|
| 508 |
+
},
|
| 509 |
+
{
|
| 510 |
+
"name": "libpinocchio",
|
| 511 |
+
"version": "3.9.0",
|
| 512 |
+
"direct_url": null
|
| 513 |
+
},
|
| 514 |
+
{
|
| 515 |
+
"name": "llvmlite",
|
| 516 |
+
"version": "0.44.0",
|
| 517 |
+
"direct_url": null
|
| 518 |
+
},
|
| 519 |
+
{
|
| 520 |
+
"name": "lxml",
|
| 521 |
+
"version": "6.0.2",
|
| 522 |
+
"direct_url": null
|
| 523 |
+
},
|
| 524 |
+
{
|
| 525 |
+
"name": "Markdown",
|
| 526 |
+
"version": "3.9",
|
| 527 |
+
"direct_url": null
|
| 528 |
+
},
|
| 529 |
+
{
|
| 530 |
+
"name": "markdown-it-py",
|
| 531 |
+
"version": "4.0.0",
|
| 532 |
+
"direct_url": null
|
| 533 |
+
},
|
| 534 |
+
{
|
| 535 |
+
"name": "MarkupSafe",
|
| 536 |
+
"version": "3.0.3",
|
| 537 |
+
"direct_url": null
|
| 538 |
+
},
|
| 539 |
+
{
|
| 540 |
+
"name": "matplotlib",
|
| 541 |
+
"version": "3.10.0",
|
| 542 |
+
"direct_url": null
|
| 543 |
+
},
|
| 544 |
+
{
|
| 545 |
+
"name": "mdurl",
|
| 546 |
+
"version": "0.1.2",
|
| 547 |
+
"direct_url": null
|
| 548 |
+
},
|
| 549 |
+
{
|
| 550 |
+
"name": "mink",
|
| 551 |
+
"version": "0.0.5",
|
| 552 |
+
"direct_url": null
|
| 553 |
+
},
|
| 554 |
+
{
|
| 555 |
+
"name": "ml-dtypes",
|
| 556 |
+
"version": "0.2.0",
|
| 557 |
+
"direct_url": null
|
| 558 |
+
},
|
| 559 |
+
{
|
| 560 |
+
"name": "mpmath",
|
| 561 |
+
"version": "1.3.0",
|
| 562 |
+
"direct_url": null
|
| 563 |
+
},
|
| 564 |
+
{
|
| 565 |
+
"name": "msgpack",
|
| 566 |
+
"version": "1.1.2",
|
| 567 |
+
"direct_url": null
|
| 568 |
+
},
|
| 569 |
+
{
|
| 570 |
+
"name": "msgpack-numpy",
|
| 571 |
+
"version": "0.4.8",
|
| 572 |
+
"direct_url": null
|
| 573 |
+
},
|
| 574 |
+
{
|
| 575 |
+
"name": "mujoco",
|
| 576 |
+
"version": "3.2.6",
|
| 577 |
+
"direct_url": null
|
| 578 |
+
},
|
| 579 |
+
{
|
| 580 |
+
"name": "multiprocess",
|
| 581 |
+
"version": "0.70.19",
|
| 582 |
+
"direct_url": null
|
| 583 |
+
},
|
| 584 |
+
{
|
| 585 |
+
"name": "networkx",
|
| 586 |
+
"version": "3.4.2",
|
| 587 |
+
"direct_url": null
|
| 588 |
+
},
|
| 589 |
+
{
|
| 590 |
+
"name": "nlopt",
|
| 591 |
+
"version": "2.10.0",
|
| 592 |
+
"direct_url": null
|
| 593 |
+
},
|
| 594 |
+
{
|
| 595 |
+
"name": "numba",
|
| 596 |
+
"version": "0.61.2",
|
| 597 |
+
"direct_url": null
|
| 598 |
+
},
|
| 599 |
+
{
|
| 600 |
+
"name": "numpy",
|
| 601 |
+
"version": "1.26.4",
|
| 602 |
+
"direct_url": null
|
| 603 |
+
},
|
| 604 |
+
{
|
| 605 |
+
"name": "numpydantic",
|
| 606 |
+
"version": "1.6.7",
|
| 607 |
+
"direct_url": null
|
| 608 |
+
},
|
| 609 |
+
{
|
| 610 |
+
"name": "nvidia-cublas-cu12",
|
| 611 |
+
"version": "12.4.5.8",
|
| 612 |
+
"direct_url": null
|
| 613 |
+
},
|
| 614 |
+
{
|
| 615 |
+
"name": "nvidia-cublas-cu12",
|
| 616 |
+
"version": "12.8.4.1",
|
| 617 |
+
"direct_url": null
|
| 618 |
+
},
|
| 619 |
+
{
|
| 620 |
+
"name": "nvidia-cuda-cupti-cu12",
|
| 621 |
+
"version": "12.4.127",
|
| 622 |
+
"direct_url": null
|
| 623 |
+
},
|
| 624 |
+
{
|
| 625 |
+
"name": "nvidia-cuda-cupti-cu12",
|
| 626 |
+
"version": "12.8.90",
|
| 627 |
+
"direct_url": null
|
| 628 |
+
},
|
| 629 |
+
{
|
| 630 |
+
"name": "nvidia-cuda-nvrtc-cu12",
|
| 631 |
+
"version": "12.4.127",
|
| 632 |
+
"direct_url": null
|
| 633 |
+
},
|
| 634 |
+
{
|
| 635 |
+
"name": "nvidia-cuda-nvrtc-cu12",
|
| 636 |
+
"version": "12.8.93",
|
| 637 |
+
"direct_url": null
|
| 638 |
+
},
|
| 639 |
+
{
|
| 640 |
+
"name": "nvidia-cuda-runtime-cu12",
|
| 641 |
+
"version": "12.4.127",
|
| 642 |
+
"direct_url": null
|
| 643 |
+
},
|
| 644 |
+
{
|
| 645 |
+
"name": "nvidia-cuda-runtime-cu12",
|
| 646 |
+
"version": "12.8.90",
|
| 647 |
+
"direct_url": null
|
| 648 |
+
},
|
| 649 |
+
{
|
| 650 |
+
"name": "nvidia-cudnn-cu12",
|
| 651 |
+
"version": "9.1.0.70",
|
| 652 |
+
"direct_url": null
|
| 653 |
+
},
|
| 654 |
+
{
|
| 655 |
+
"name": "nvidia-cudnn-cu12",
|
| 656 |
+
"version": "9.10.2.21",
|
| 657 |
+
"direct_url": null
|
| 658 |
+
},
|
| 659 |
+
{
|
| 660 |
+
"name": "nvidia-cufft-cu12",
|
| 661 |
+
"version": "11.2.1.3",
|
| 662 |
+
"direct_url": null
|
| 663 |
+
},
|
| 664 |
+
{
|
| 665 |
+
"name": "nvidia-cufft-cu12",
|
| 666 |
+
"version": "11.3.3.83",
|
| 667 |
+
"direct_url": null
|
| 668 |
+
},
|
| 669 |
+
{
|
| 670 |
+
"name": "nvidia-cufile-cu12",
|
| 671 |
+
"version": "1.13.1.3",
|
| 672 |
+
"direct_url": null
|
| 673 |
+
},
|
| 674 |
+
{
|
| 675 |
+
"name": "nvidia-curand-cu12",
|
| 676 |
+
"version": "10.3.5.147",
|
| 677 |
+
"direct_url": null
|
| 678 |
+
},
|
| 679 |
+
{
|
| 680 |
+
"name": "nvidia-curand-cu12",
|
| 681 |
+
"version": "10.3.9.90",
|
| 682 |
+
"direct_url": null
|
| 683 |
+
},
|
| 684 |
+
{
|
| 685 |
+
"name": "nvidia-cusolver-cu12",
|
| 686 |
+
"version": "11.6.1.9",
|
| 687 |
+
"direct_url": null
|
| 688 |
+
},
|
| 689 |
+
{
|
| 690 |
+
"name": "nvidia-cusolver-cu12",
|
| 691 |
+
"version": "11.7.3.90",
|
| 692 |
+
"direct_url": null
|
| 693 |
+
},
|
| 694 |
+
{
|
| 695 |
+
"name": "nvidia-cusparse-cu12",
|
| 696 |
+
"version": "12.3.1.170",
|
| 697 |
+
"direct_url": null
|
| 698 |
+
},
|
| 699 |
+
{
|
| 700 |
+
"name": "nvidia-cusparse-cu12",
|
| 701 |
+
"version": "12.5.8.93",
|
| 702 |
+
"direct_url": null
|
| 703 |
+
},
|
| 704 |
+
{
|
| 705 |
+
"name": "nvidia-cusparselt-cu12",
|
| 706 |
+
"version": "0.7.1",
|
| 707 |
+
"direct_url": null
|
| 708 |
+
},
|
| 709 |
+
{
|
| 710 |
+
"name": "nvidia-ml-py",
|
| 711 |
+
"version": "13.580.82",
|
| 712 |
+
"direct_url": null
|
| 713 |
+
},
|
| 714 |
+
{
|
| 715 |
+
"name": "nvidia-nccl-cu12",
|
| 716 |
+
"version": "2.21.5",
|
| 717 |
+
"direct_url": null
|
| 718 |
+
},
|
| 719 |
+
{
|
| 720 |
+
"name": "nvidia-nccl-cu12",
|
| 721 |
+
"version": "2.27.3",
|
| 722 |
+
"direct_url": null
|
| 723 |
+
},
|
| 724 |
+
{
|
| 725 |
+
"name": "nvidia-nvjitlink-cu12",
|
| 726 |
+
"version": "12.4.127",
|
| 727 |
+
"direct_url": null
|
| 728 |
+
},
|
| 729 |
+
{
|
| 730 |
+
"name": "nvidia-nvjitlink-cu12",
|
| 731 |
+
"version": "12.8.93",
|
| 732 |
+
"direct_url": null
|
| 733 |
+
},
|
| 734 |
+
{
|
| 735 |
+
"name": "nvidia-nvtx-cu12",
|
| 736 |
+
"version": "12.4.127",
|
| 737 |
+
"direct_url": null
|
| 738 |
+
},
|
| 739 |
+
{
|
| 740 |
+
"name": "nvidia-nvtx-cu12",
|
| 741 |
+
"version": "12.8.90",
|
| 742 |
+
"direct_url": null
|
| 743 |
+
},
|
| 744 |
+
{
|
| 745 |
+
"name": "oauthlib",
|
| 746 |
+
"version": "3.3.1",
|
| 747 |
+
"direct_url": null
|
| 748 |
+
},
|
| 749 |
+
{
|
| 750 |
+
"name": "omegaconf",
|
| 751 |
+
"version": "2.3.0",
|
| 752 |
+
"direct_url": null
|
| 753 |
+
},
|
| 754 |
+
{
|
| 755 |
+
"name": "onnx",
|
| 756 |
+
"version": "1.17.0",
|
| 757 |
+
"direct_url": null
|
| 758 |
+
},
|
| 759 |
+
{
|
| 760 |
+
"name": "opencv-python",
|
| 761 |
+
"version": "4.11.0.86",
|
| 762 |
+
"direct_url": null
|
| 763 |
+
},
|
| 764 |
+
{
|
| 765 |
+
"name": "opencv-python",
|
| 766 |
+
"version": "4.8.0.74",
|
| 767 |
+
"direct_url": null
|
| 768 |
+
},
|
| 769 |
+
{
|
| 770 |
+
"name": "opencv-python-headless",
|
| 771 |
+
"version": "4.11.0.86",
|
| 772 |
+
"direct_url": null
|
| 773 |
+
},
|
| 774 |
+
{
|
| 775 |
+
"name": "opt_einsum",
|
| 776 |
+
"version": "3.4.0",
|
| 777 |
+
"direct_url": null
|
| 778 |
+
},
|
| 779 |
+
{
|
| 780 |
+
"name": "packaging",
|
| 781 |
+
"version": "25.0",
|
| 782 |
+
"direct_url": null
|
| 783 |
+
},
|
| 784 |
+
{
|
| 785 |
+
"name": "pandas",
|
| 786 |
+
"version": "2.2.3",
|
| 787 |
+
"direct_url": null
|
| 788 |
+
},
|
| 789 |
+
{
|
| 790 |
+
"name": "peft",
|
| 791 |
+
"version": "0.17.0",
|
| 792 |
+
"direct_url": null
|
| 793 |
+
},
|
| 794 |
+
{
|
| 795 |
+
"name": "pettingzoo",
|
| 796 |
+
"version": "1.25.0",
|
| 797 |
+
"direct_url": null
|
| 798 |
+
},
|
| 799 |
+
{
|
| 800 |
+
"name": "pfzy",
|
| 801 |
+
"version": "0.3.4",
|
| 802 |
+
"direct_url": null
|
| 803 |
+
},
|
| 804 |
+
{
|
| 805 |
+
"name": "pillow",
|
| 806 |
+
"version": "11.3.0",
|
| 807 |
+
"direct_url": null
|
| 808 |
+
},
|
| 809 |
+
{
|
| 810 |
+
"name": "pin",
|
| 811 |
+
"version": "3.9.0",
|
| 812 |
+
"direct_url": null
|
| 813 |
+
},
|
| 814 |
+
{
|
| 815 |
+
"name": "pip",
|
| 816 |
+
"version": "25.3",
|
| 817 |
+
"direct_url": null
|
| 818 |
+
},
|
| 819 |
+
{
|
| 820 |
+
"name": "pipablepytorch3d",
|
| 821 |
+
"version": "0.7.6",
|
| 822 |
+
"direct_url": null
|
| 823 |
+
},
|
| 824 |
+
{
|
| 825 |
+
"name": "platformdirs",
|
| 826 |
+
"version": "4.5.0",
|
| 827 |
+
"direct_url": null
|
| 828 |
+
},
|
| 829 |
+
{
|
| 830 |
+
"name": "pluggy",
|
| 831 |
+
"version": "1.6.0",
|
| 832 |
+
"direct_url": null
|
| 833 |
+
},
|
| 834 |
+
{
|
| 835 |
+
"name": "portalocker",
|
| 836 |
+
"version": "3.2.0",
|
| 837 |
+
"direct_url": null
|
| 838 |
+
},
|
| 839 |
+
{
|
| 840 |
+
"name": "prompt_toolkit",
|
| 841 |
+
"version": "3.0.52",
|
| 842 |
+
"direct_url": null
|
| 843 |
+
},
|
| 844 |
+
{
|
| 845 |
+
"name": "protobuf",
|
| 846 |
+
"version": "3.20.3",
|
| 847 |
+
"direct_url": null
|
| 848 |
+
},
|
| 849 |
+
{
|
| 850 |
+
"name": "protobuf",
|
| 851 |
+
"version": "6.32.1",
|
| 852 |
+
"direct_url": null
|
| 853 |
+
},
|
| 854 |
+
{
|
| 855 |
+
"name": "psutil",
|
| 856 |
+
"version": "7.1.0",
|
| 857 |
+
"direct_url": null
|
| 858 |
+
},
|
| 859 |
+
{
|
| 860 |
+
"name": "pyarrow",
|
| 861 |
+
"version": "14.0.1",
|
| 862 |
+
"direct_url": null
|
| 863 |
+
},
|
| 864 |
+
{
|
| 865 |
+
"name": "pyasn1",
|
| 866 |
+
"version": "0.6.1",
|
| 867 |
+
"direct_url": null
|
| 868 |
+
},
|
| 869 |
+
{
|
| 870 |
+
"name": "pyasn1_modules",
|
| 871 |
+
"version": "0.4.2",
|
| 872 |
+
"direct_url": null
|
| 873 |
+
},
|
| 874 |
+
{
|
| 875 |
+
"name": "pybind11",
|
| 876 |
+
"version": "3.0.2a0",
|
| 877 |
+
"direct_url": {
|
| 878 |
+
"dir_info": {},
|
| 879 |
+
"url": "file:///vla/users/lijiayi/code/robot_retarget/retarget/body_retarget/pybind11"
|
| 880 |
+
}
|
| 881 |
+
},
|
| 882 |
+
{
|
| 883 |
+
"name": "pydantic",
|
| 884 |
+
"version": "2.10.6",
|
| 885 |
+
"direct_url": null
|
| 886 |
+
},
|
| 887 |
+
{
|
| 888 |
+
"name": "pydantic_core",
|
| 889 |
+
"version": "2.27.2",
|
| 890 |
+
"direct_url": null
|
| 891 |
+
},
|
| 892 |
+
{
|
| 893 |
+
"name": "pygame",
|
| 894 |
+
"version": "2.6.1",
|
| 895 |
+
"direct_url": null
|
| 896 |
+
},
|
| 897 |
+
{
|
| 898 |
+
"name": "Pygments",
|
| 899 |
+
"version": "2.19.2",
|
| 900 |
+
"direct_url": null
|
| 901 |
+
},
|
| 902 |
+
{
|
| 903 |
+
"name": "pykdl_utils",
|
| 904 |
+
"version": "0.1.0",
|
| 905 |
+
"direct_url": {
|
| 906 |
+
"dir_info": {
|
| 907 |
+
"editable": true
|
| 908 |
+
},
|
| 909 |
+
"url": "file:///mnt/workspace/users/zhangtianle/others/pykdl_utils"
|
| 910 |
+
}
|
| 911 |
+
},
|
| 912 |
+
{
|
| 913 |
+
"name": "pynput",
|
| 914 |
+
"version": "1.8.1",
|
| 915 |
+
"direct_url": null
|
| 916 |
+
},
|
| 917 |
+
{
|
| 918 |
+
"name": "pyparsing",
|
| 919 |
+
"version": "3.2.5",
|
| 920 |
+
"direct_url": null
|
| 921 |
+
},
|
| 922 |
+
{
|
| 923 |
+
"name": "pyperclip",
|
| 924 |
+
"version": "1.11.0",
|
| 925 |
+
"direct_url": null
|
| 926 |
+
},
|
| 927 |
+
{
|
| 928 |
+
"name": "pytest",
|
| 929 |
+
"version": "8.4.2",
|
| 930 |
+
"direct_url": null
|
| 931 |
+
},
|
| 932 |
+
{
|
| 933 |
+
"name": "python-dateutil",
|
| 934 |
+
"version": "2.9.0.post0",
|
| 935 |
+
"direct_url": null
|
| 936 |
+
},
|
| 937 |
+
{
|
| 938 |
+
"name": "python-xlib",
|
| 939 |
+
"version": "0.33",
|
| 940 |
+
"direct_url": null
|
| 941 |
+
},
|
| 942 |
+
{
|
| 943 |
+
"name": "pytransform3d",
|
| 944 |
+
"version": "3.14.4",
|
| 945 |
+
"direct_url": null
|
| 946 |
+
},
|
| 947 |
+
{
|
| 948 |
+
"name": "pytz",
|
| 949 |
+
"version": "2025.2",
|
| 950 |
+
"direct_url": null
|
| 951 |
+
},
|
| 952 |
+
{
|
| 953 |
+
"name": "pyzmq",
|
| 954 |
+
"version": "27.1.0",
|
| 955 |
+
"direct_url": null
|
| 956 |
+
},
|
| 957 |
+
{
|
| 958 |
+
"name": "qpsolvers",
|
| 959 |
+
"version": "4.8.1",
|
| 960 |
+
"direct_url": null
|
| 961 |
+
},
|
| 962 |
+
{
|
| 963 |
+
"name": "quadprog",
|
| 964 |
+
"version": "0.1.13",
|
| 965 |
+
"direct_url": null
|
| 966 |
+
},
|
| 967 |
+
{
|
| 968 |
+
"name": "qwen-vl-utils",
|
| 969 |
+
"version": "0.0.14",
|
| 970 |
+
"direct_url": null
|
| 971 |
+
},
|
| 972 |
+
{
|
| 973 |
+
"name": "ray",
|
| 974 |
+
"version": "2.40.0",
|
| 975 |
+
"direct_url": null
|
| 976 |
+
},
|
| 977 |
+
{
|
| 978 |
+
"name": "referencing",
|
| 979 |
+
"version": "0.36.2",
|
| 980 |
+
"direct_url": null
|
| 981 |
+
},
|
| 982 |
+
{
|
| 983 |
+
"name": "regex",
|
| 984 |
+
"version": "2025.9.18",
|
| 985 |
+
"direct_url": null
|
| 986 |
+
},
|
| 987 |
+
{
|
| 988 |
+
"name": "requests",
|
| 989 |
+
"version": "2.32.3",
|
| 990 |
+
"direct_url": null
|
| 991 |
+
},
|
| 992 |
+
{
|
| 993 |
+
"name": "requests-oauthlib",
|
| 994 |
+
"version": "2.0.0",
|
| 995 |
+
"direct_url": null
|
| 996 |
+
},
|
| 997 |
+
{
|
| 998 |
+
"name": "rich",
|
| 999 |
+
"version": "14.2.0",
|
| 1000 |
+
"direct_url": null
|
| 1001 |
+
},
|
| 1002 |
+
{
|
| 1003 |
+
"name": "robocasa",
|
| 1004 |
+
"version": "0.2.0",
|
| 1005 |
+
"direct_url": {
|
| 1006 |
+
"dir_info": {
|
| 1007 |
+
"editable": true
|
| 1008 |
+
},
|
| 1009 |
+
"url": "file:///mnt/workspace/users/zhangtianle/others/robocasa-gr1-tabletop-tasks"
|
| 1010 |
+
}
|
| 1011 |
+
},
|
| 1012 |
+
{
|
| 1013 |
+
"name": "robosuite",
|
| 1014 |
+
"version": "1.5.1",
|
| 1015 |
+
"direct_url": {
|
| 1016 |
+
"dir_info": {
|
| 1017 |
+
"editable": true
|
| 1018 |
+
},
|
| 1019 |
+
"url": "file:///mnt/workspace/users/zhangtianle/others/robosuite"
|
| 1020 |
+
}
|
| 1021 |
+
},
|
| 1022 |
+
{
|
| 1023 |
+
"name": "robosuite_models",
|
| 1024 |
+
"version": "1.0.0",
|
| 1025 |
+
"direct_url": null
|
| 1026 |
+
},
|
| 1027 |
+
{
|
| 1028 |
+
"name": "rpds-py",
|
| 1029 |
+
"version": "0.27.1",
|
| 1030 |
+
"direct_url": null
|
| 1031 |
+
},
|
| 1032 |
+
{
|
| 1033 |
+
"name": "rsa",
|
| 1034 |
+
"version": "4.9.1",
|
| 1035 |
+
"direct_url": null
|
| 1036 |
+
},
|
| 1037 |
+
{
|
| 1038 |
+
"name": "safetensors",
|
| 1039 |
+
"version": "0.6.2",
|
| 1040 |
+
"direct_url": null
|
| 1041 |
+
},
|
| 1042 |
+
{
|
| 1043 |
+
"name": "sapien",
|
| 1044 |
+
"version": "3.0.1",
|
| 1045 |
+
"direct_url": null
|
| 1046 |
+
},
|
| 1047 |
+
{
|
| 1048 |
+
"name": "scikit-image",
|
| 1049 |
+
"version": "0.25.2",
|
| 1050 |
+
"direct_url": null
|
| 1051 |
+
},
|
| 1052 |
+
{
|
| 1053 |
+
"name": "scipy",
|
| 1054 |
+
"version": "1.15.3",
|
| 1055 |
+
"direct_url": null
|
| 1056 |
+
},
|
| 1057 |
+
{
|
| 1058 |
+
"name": "sentry-sdk",
|
| 1059 |
+
"version": "2.41.0",
|
| 1060 |
+
"direct_url": null
|
| 1061 |
+
},
|
| 1062 |
+
{
|
| 1063 |
+
"name": "setproctitle",
|
| 1064 |
+
"version": "1.3.7",
|
| 1065 |
+
"direct_url": null
|
| 1066 |
+
},
|
| 1067 |
+
{
|
| 1068 |
+
"name": "setuptools",
|
| 1069 |
+
"version": "80.9.0",
|
| 1070 |
+
"direct_url": null
|
| 1071 |
+
},
|
| 1072 |
+
{
|
| 1073 |
+
"name": "shtab",
|
| 1074 |
+
"version": "1.7.2",
|
| 1075 |
+
"direct_url": null
|
| 1076 |
+
},
|
| 1077 |
+
{
|
| 1078 |
+
"name": "six",
|
| 1079 |
+
"version": "1.17.0",
|
| 1080 |
+
"direct_url": null
|
| 1081 |
+
},
|
| 1082 |
+
{
|
| 1083 |
+
"name": "smmap",
|
| 1084 |
+
"version": "5.0.2",
|
| 1085 |
+
"direct_url": null
|
| 1086 |
+
},
|
| 1087 |
+
{
|
| 1088 |
+
"name": "sympy",
|
| 1089 |
+
"version": "1.13.1",
|
| 1090 |
+
"direct_url": null
|
| 1091 |
+
},
|
| 1092 |
+
{
|
| 1093 |
+
"name": "sympy",
|
| 1094 |
+
"version": "1.14.0",
|
| 1095 |
+
"direct_url": null
|
| 1096 |
+
},
|
| 1097 |
+
{
|
| 1098 |
+
"name": "tabulate",
|
| 1099 |
+
"version": "0.9.0",
|
| 1100 |
+
"direct_url": null
|
| 1101 |
+
},
|
| 1102 |
+
{
|
| 1103 |
+
"name": "tensorboard",
|
| 1104 |
+
"version": "2.15.2",
|
| 1105 |
+
"direct_url": null
|
| 1106 |
+
},
|
| 1107 |
+
{
|
| 1108 |
+
"name": "tensorboard",
|
| 1109 |
+
"version": "2.20.0",
|
| 1110 |
+
"direct_url": null
|
| 1111 |
+
},
|
| 1112 |
+
{
|
| 1113 |
+
"name": "tensorboard-data-server",
|
| 1114 |
+
"version": "0.7.2",
|
| 1115 |
+
"direct_url": null
|
| 1116 |
+
},
|
| 1117 |
+
{
|
| 1118 |
+
"name": "tensorflow",
|
| 1119 |
+
"version": "2.15.0",
|
| 1120 |
+
"direct_url": null
|
| 1121 |
+
},
|
| 1122 |
+
{
|
| 1123 |
+
"name": "tensorflow-estimator",
|
| 1124 |
+
"version": "2.15.0",
|
| 1125 |
+
"direct_url": null
|
| 1126 |
+
},
|
| 1127 |
+
{
|
| 1128 |
+
"name": "tensorflow-io-gcs-filesystem",
|
| 1129 |
+
"version": "0.37.1",
|
| 1130 |
+
"direct_url": null
|
| 1131 |
+
},
|
| 1132 |
+
{
|
| 1133 |
+
"name": "termcolor",
|
| 1134 |
+
"version": "3.1.0",
|
| 1135 |
+
"direct_url": null
|
| 1136 |
+
},
|
| 1137 |
+
{
|
| 1138 |
+
"name": "tianshou",
|
| 1139 |
+
"version": "0.5.1",
|
| 1140 |
+
"direct_url": null
|
| 1141 |
+
},
|
| 1142 |
+
{
|
| 1143 |
+
"name": "tifffile",
|
| 1144 |
+
"version": "2025.5.10",
|
| 1145 |
+
"direct_url": null
|
| 1146 |
+
},
|
| 1147 |
+
{
|
| 1148 |
+
"name": "timm",
|
| 1149 |
+
"version": "1.0.14",
|
| 1150 |
+
"direct_url": null
|
| 1151 |
+
},
|
| 1152 |
+
{
|
| 1153 |
+
"name": "tokenizers",
|
| 1154 |
+
"version": "0.21.4",
|
| 1155 |
+
"direct_url": null
|
| 1156 |
+
},
|
| 1157 |
+
{
|
| 1158 |
+
"name": "tomli",
|
| 1159 |
+
"version": "2.3.0",
|
| 1160 |
+
"direct_url": null
|
| 1161 |
+
},
|
| 1162 |
+
{
|
| 1163 |
+
"name": "torch",
|
| 1164 |
+
"version": "2.5.1",
|
| 1165 |
+
"direct_url": null
|
| 1166 |
+
},
|
| 1167 |
+
{
|
| 1168 |
+
"name": "torch",
|
| 1169 |
+
"version": "2.8.0",
|
| 1170 |
+
"direct_url": null
|
| 1171 |
+
},
|
| 1172 |
+
{
|
| 1173 |
+
"name": "torchvision",
|
| 1174 |
+
"version": "0.20.1",
|
| 1175 |
+
"direct_url": null
|
| 1176 |
+
},
|
| 1177 |
+
{
|
| 1178 |
+
"name": "tqdm",
|
| 1179 |
+
"version": "4.67.1",
|
| 1180 |
+
"direct_url": null
|
| 1181 |
+
},
|
| 1182 |
+
{
|
| 1183 |
+
"name": "transformers",
|
| 1184 |
+
"version": "4.51.3",
|
| 1185 |
+
"direct_url": null
|
| 1186 |
+
},
|
| 1187 |
+
{
|
| 1188 |
+
"name": "transforms3d",
|
| 1189 |
+
"version": "0.4.2",
|
| 1190 |
+
"direct_url": null
|
| 1191 |
+
},
|
| 1192 |
+
{
|
| 1193 |
+
"name": "triton",
|
| 1194 |
+
"version": "3.1.0",
|
| 1195 |
+
"direct_url": null
|
| 1196 |
+
},
|
| 1197 |
+
{
|
| 1198 |
+
"name": "triton",
|
| 1199 |
+
"version": "3.4.0",
|
| 1200 |
+
"direct_url": null
|
| 1201 |
+
},
|
| 1202 |
+
{
|
| 1203 |
+
"name": "typeguard",
|
| 1204 |
+
"version": "4.4.2",
|
| 1205 |
+
"direct_url": null
|
| 1206 |
+
},
|
| 1207 |
+
{
|
| 1208 |
+
"name": "typing_extensions",
|
| 1209 |
+
"version": "4.12.2",
|
| 1210 |
+
"direct_url": null
|
| 1211 |
+
},
|
| 1212 |
+
{
|
| 1213 |
+
"name": "typing_extensions",
|
| 1214 |
+
"version": "4.15.0",
|
| 1215 |
+
"direct_url": null
|
| 1216 |
+
},
|
| 1217 |
+
{
|
| 1218 |
+
"name": "tyro",
|
| 1219 |
+
"version": "0.9.17",
|
| 1220 |
+
"direct_url": null
|
| 1221 |
+
},
|
| 1222 |
+
{
|
| 1223 |
+
"name": "tzdata",
|
| 1224 |
+
"version": "2025.2",
|
| 1225 |
+
"direct_url": null
|
| 1226 |
+
},
|
| 1227 |
+
{
|
| 1228 |
+
"name": "urdf_parser_py",
|
| 1229 |
+
"version": "0.0.4",
|
| 1230 |
+
"direct_url": null
|
| 1231 |
+
},
|
| 1232 |
+
{
|
| 1233 |
+
"name": "urllib3",
|
| 1234 |
+
"version": "2.5.0",
|
| 1235 |
+
"direct_url": null
|
| 1236 |
+
},
|
| 1237 |
+
{
|
| 1238 |
+
"name": "wandb",
|
| 1239 |
+
"version": "0.18.0",
|
| 1240 |
+
"direct_url": null
|
| 1241 |
+
},
|
| 1242 |
+
{
|
| 1243 |
+
"name": "wcwidth",
|
| 1244 |
+
"version": "0.2.14",
|
| 1245 |
+
"direct_url": null
|
| 1246 |
+
},
|
| 1247 |
+
{
|
| 1248 |
+
"name": "websockets",
|
| 1249 |
+
"version": "15.0.1",
|
| 1250 |
+
"direct_url": null
|
| 1251 |
+
},
|
| 1252 |
+
{
|
| 1253 |
+
"name": "Werkzeug",
|
| 1254 |
+
"version": "3.1.3",
|
| 1255 |
+
"direct_url": null
|
| 1256 |
+
},
|
| 1257 |
+
{
|
| 1258 |
+
"name": "wheel",
|
| 1259 |
+
"version": "0.45.1",
|
| 1260 |
+
"direct_url": null
|
| 1261 |
+
},
|
| 1262 |
+
{
|
| 1263 |
+
"name": "wrapt",
|
| 1264 |
+
"version": "1.14.2",
|
| 1265 |
+
"direct_url": null
|
| 1266 |
+
},
|
| 1267 |
+
{
|
| 1268 |
+
"name": "yacs",
|
| 1269 |
+
"version": "0.1.8",
|
| 1270 |
+
"direct_url": null
|
| 1271 |
+
},
|
| 1272 |
+
{
|
| 1273 |
+
"name": "zipp",
|
| 1274 |
+
"version": "3.23.0",
|
| 1275 |
+
"direct_url": null
|
| 1276 |
+
},
|
| 1277 |
+
{
|
| 1278 |
+
"name": "hrl_geom",
|
| 1279 |
+
"version": "0.1.0",
|
| 1280 |
+
"direct_url": null
|
| 1281 |
+
},
|
| 1282 |
+
{
|
| 1283 |
+
"name": "pykdl_utils",
|
| 1284 |
+
"version": "0.1.0",
|
| 1285 |
+
"direct_url": null
|
| 1286 |
+
}
|
| 1287 |
+
]
|
| 1288 |
+
}
|
environment/simulation.requirements.txt
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
accelerate==1.2.1
|
| 2 |
+
av==12.3.0
|
| 3 |
+
gymnasium==1.0.0
|
| 4 |
+
h5py==3.12.1
|
| 5 |
+
hidapi==0.14.0.post4
|
| 6 |
+
imageio==2.34.2
|
| 7 |
+
lxml==6.0.2
|
| 8 |
+
matplotlib==3.10.0
|
| 9 |
+
msgpack==1.1.2
|
| 10 |
+
msgpack-numpy==0.4.8
|
| 11 |
+
mujoco==3.2.6
|
| 12 |
+
numba==0.61.2
|
| 13 |
+
numpy==1.26.4
|
| 14 |
+
omegaconf==2.3.0
|
| 15 |
+
opencv-python-headless==4.11.0.86
|
| 16 |
+
pandas==2.2.3
|
| 17 |
+
pillow==11.3.0
|
| 18 |
+
pydantic==2.10.6
|
| 19 |
+
pygame==2.6.1
|
| 20 |
+
PyOpenGL==3.1.7
|
| 21 |
+
pynput==1.8.1
|
| 22 |
+
pyyaml==6.0.2
|
| 23 |
+
rich==14.2.0
|
| 24 |
+
scipy==1.15.3
|
| 25 |
+
termcolor==3.1.0
|
| 26 |
+
tqdm==4.67.1
|
| 27 |
+
transforms3d==0.4.2
|
| 28 |
+
tyro==0.9.17
|
| 29 |
+
urdf-parser-py==0.0.4
|
| 30 |
+
websockets==15.0.1
|
| 31 |
+
quadprog==0.1.13
|
environment/starVLA_1.observed.json
ADDED
|
@@ -0,0 +1,1309 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"python": "3.10.19 (main, Oct 21 2025, 16:43:05) [GCC 11.2.0]",
|
| 3 |
+
"packages": [
|
| 4 |
+
{
|
| 5 |
+
"name": "MarkupSafe",
|
| 6 |
+
"version": "2.1.5",
|
| 7 |
+
"direct_url": null
|
| 8 |
+
},
|
| 9 |
+
{
|
| 10 |
+
"name": "absl-py",
|
| 11 |
+
"version": "2.3.1",
|
| 12 |
+
"direct_url": null
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"name": "albucore",
|
| 16 |
+
"version": "0.0.17",
|
| 17 |
+
"direct_url": null
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"name": "albumentations",
|
| 21 |
+
"version": "1.4.18",
|
| 22 |
+
"direct_url": null
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"name": "annotated-types",
|
| 26 |
+
"version": "0.7.0",
|
| 27 |
+
"direct_url": null
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
"name": "antlr4-python3-runtime",
|
| 31 |
+
"version": "4.9.3",
|
| 32 |
+
"direct_url": null
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"name": "anyio",
|
| 36 |
+
"version": "4.12.0",
|
| 37 |
+
"direct_url": null
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"name": "av",
|
| 41 |
+
"version": "12.3.0",
|
| 42 |
+
"direct_url": null
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"name": "certifi",
|
| 46 |
+
"version": "2025.11.12",
|
| 47 |
+
"direct_url": null
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"name": "charset-normalizer",
|
| 51 |
+
"version": "3.4.4",
|
| 52 |
+
"direct_url": null
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"name": "click",
|
| 56 |
+
"version": "8.3.1",
|
| 57 |
+
"direct_url": null
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"name": "conda-pack",
|
| 61 |
+
"version": "0.8.1",
|
| 62 |
+
"direct_url": {
|
| 63 |
+
"dir_info": {},
|
| 64 |
+
"url": "file:///home/conda/feedstock_root/build_artifacts/conda-pack_1734292804024/work"
|
| 65 |
+
}
|
| 66 |
+
},
|
| 67 |
+
{
|
| 68 |
+
"name": "contourpy",
|
| 69 |
+
"version": "1.3.2",
|
| 70 |
+
"direct_url": null
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"name": "cramjam",
|
| 74 |
+
"version": "2.11.0",
|
| 75 |
+
"direct_url": null
|
| 76 |
+
},
|
| 77 |
+
{
|
| 78 |
+
"name": "cycler",
|
| 79 |
+
"version": "0.12.1",
|
| 80 |
+
"direct_url": null
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"name": "decord",
|
| 84 |
+
"version": "0.6.0",
|
| 85 |
+
"direct_url": null
|
| 86 |
+
},
|
| 87 |
+
{
|
| 88 |
+
"name": "deepspeed",
|
| 89 |
+
"version": "0.18.3",
|
| 90 |
+
"direct_url": null
|
| 91 |
+
},
|
| 92 |
+
{
|
| 93 |
+
"name": "docstring_parser",
|
| 94 |
+
"version": "0.17.0",
|
| 95 |
+
"direct_url": null
|
| 96 |
+
},
|
| 97 |
+
{
|
| 98 |
+
"name": "einops",
|
| 99 |
+
"version": "0.8.1",
|
| 100 |
+
"direct_url": null
|
| 101 |
+
},
|
| 102 |
+
{
|
| 103 |
+
"name": "eva-decord",
|
| 104 |
+
"version": "0.6.1",
|
| 105 |
+
"direct_url": null
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"name": "eval_type_backport",
|
| 109 |
+
"version": "0.3.1",
|
| 110 |
+
"direct_url": null
|
| 111 |
+
},
|
| 112 |
+
{
|
| 113 |
+
"name": "exceptiongroup",
|
| 114 |
+
"version": "1.3.1",
|
| 115 |
+
"direct_url": null
|
| 116 |
+
},
|
| 117 |
+
{
|
| 118 |
+
"name": "fastparquet",
|
| 119 |
+
"version": "2024.11.0",
|
| 120 |
+
"direct_url": null
|
| 121 |
+
},
|
| 122 |
+
{
|
| 123 |
+
"name": "filelock",
|
| 124 |
+
"version": "3.20.0",
|
| 125 |
+
"direct_url": null
|
| 126 |
+
},
|
| 127 |
+
{
|
| 128 |
+
"name": "fonttools",
|
| 129 |
+
"version": "4.61.1",
|
| 130 |
+
"direct_url": null
|
| 131 |
+
},
|
| 132 |
+
{
|
| 133 |
+
"name": "fsspec",
|
| 134 |
+
"version": "2025.12.0",
|
| 135 |
+
"direct_url": null
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"name": "fvcore",
|
| 139 |
+
"version": "0.1.5.post20221221",
|
| 140 |
+
"direct_url": null
|
| 141 |
+
},
|
| 142 |
+
{
|
| 143 |
+
"name": "gevent",
|
| 144 |
+
"version": "25.9.1",
|
| 145 |
+
"direct_url": null
|
| 146 |
+
},
|
| 147 |
+
{
|
| 148 |
+
"name": "gitdb",
|
| 149 |
+
"version": "4.0.12",
|
| 150 |
+
"direct_url": null
|
| 151 |
+
},
|
| 152 |
+
{
|
| 153 |
+
"name": "GitPython",
|
| 154 |
+
"version": "3.1.46",
|
| 155 |
+
"direct_url": null
|
| 156 |
+
},
|
| 157 |
+
{
|
| 158 |
+
"name": "greenlet",
|
| 159 |
+
"version": "3.3.0",
|
| 160 |
+
"direct_url": null
|
| 161 |
+
},
|
| 162 |
+
{
|
| 163 |
+
"name": "grpcio",
|
| 164 |
+
"version": "1.76.0",
|
| 165 |
+
"direct_url": null
|
| 166 |
+
},
|
| 167 |
+
{
|
| 168 |
+
"name": "h11",
|
| 169 |
+
"version": "0.16.0",
|
| 170 |
+
"direct_url": null
|
| 171 |
+
},
|
| 172 |
+
{
|
| 173 |
+
"name": "hjson",
|
| 174 |
+
"version": "3.1.0",
|
| 175 |
+
"direct_url": null
|
| 176 |
+
},
|
| 177 |
+
{
|
| 178 |
+
"name": "httpcore",
|
| 179 |
+
"version": "1.0.9",
|
| 180 |
+
"direct_url": null
|
| 181 |
+
},
|
| 182 |
+
{
|
| 183 |
+
"name": "httpx",
|
| 184 |
+
"version": "0.28.1",
|
| 185 |
+
"direct_url": null
|
| 186 |
+
},
|
| 187 |
+
{
|
| 188 |
+
"name": "idna",
|
| 189 |
+
"version": "3.11",
|
| 190 |
+
"direct_url": null
|
| 191 |
+
},
|
| 192 |
+
{
|
| 193 |
+
"name": "ImageIO",
|
| 194 |
+
"version": "2.37.2",
|
| 195 |
+
"direct_url": null
|
| 196 |
+
},
|
| 197 |
+
{
|
| 198 |
+
"name": "importlib_metadata",
|
| 199 |
+
"version": "8.7.1",
|
| 200 |
+
"direct_url": null
|
| 201 |
+
},
|
| 202 |
+
{
|
| 203 |
+
"name": "iopath",
|
| 204 |
+
"version": "0.1.10",
|
| 205 |
+
"direct_url": null
|
| 206 |
+
},
|
| 207 |
+
{
|
| 208 |
+
"name": "Jinja2",
|
| 209 |
+
"version": "3.1.6",
|
| 210 |
+
"direct_url": null
|
| 211 |
+
},
|
| 212 |
+
{
|
| 213 |
+
"name": "kiwisolver",
|
| 214 |
+
"version": "1.4.9",
|
| 215 |
+
"direct_url": null
|
| 216 |
+
},
|
| 217 |
+
{
|
| 218 |
+
"name": "lazy_loader",
|
| 219 |
+
"version": "0.4",
|
| 220 |
+
"direct_url": null
|
| 221 |
+
},
|
| 222 |
+
{
|
| 223 |
+
"name": "Markdown",
|
| 224 |
+
"version": "3.10",
|
| 225 |
+
"direct_url": null
|
| 226 |
+
},
|
| 227 |
+
{
|
| 228 |
+
"name": "markdown-it-py",
|
| 229 |
+
"version": "4.0.0",
|
| 230 |
+
"direct_url": null
|
| 231 |
+
},
|
| 232 |
+
{
|
| 233 |
+
"name": "matplotlib",
|
| 234 |
+
"version": "3.10.8",
|
| 235 |
+
"direct_url": null
|
| 236 |
+
},
|
| 237 |
+
{
|
| 238 |
+
"name": "mdurl",
|
| 239 |
+
"version": "0.1.2",
|
| 240 |
+
"direct_url": null
|
| 241 |
+
},
|
| 242 |
+
{
|
| 243 |
+
"name": "mpmath",
|
| 244 |
+
"version": "1.3.0",
|
| 245 |
+
"direct_url": null
|
| 246 |
+
},
|
| 247 |
+
{
|
| 248 |
+
"name": "msgpack",
|
| 249 |
+
"version": "1.1.2",
|
| 250 |
+
"direct_url": null
|
| 251 |
+
},
|
| 252 |
+
{
|
| 253 |
+
"name": "networkx",
|
| 254 |
+
"version": "3.4.2",
|
| 255 |
+
"direct_url": null
|
| 256 |
+
},
|
| 257 |
+
{
|
| 258 |
+
"name": "ninja",
|
| 259 |
+
"version": "1.13.0",
|
| 260 |
+
"direct_url": null
|
| 261 |
+
},
|
| 262 |
+
{
|
| 263 |
+
"name": "numpydantic",
|
| 264 |
+
"version": "1.6.9",
|
| 265 |
+
"direct_url": null
|
| 266 |
+
},
|
| 267 |
+
{
|
| 268 |
+
"name": "nvidia-cublas-cu12",
|
| 269 |
+
"version": "12.8.4.1",
|
| 270 |
+
"direct_url": null
|
| 271 |
+
},
|
| 272 |
+
{
|
| 273 |
+
"name": "nvidia-cuda-cupti-cu12",
|
| 274 |
+
"version": "12.8.90",
|
| 275 |
+
"direct_url": null
|
| 276 |
+
},
|
| 277 |
+
{
|
| 278 |
+
"name": "nvidia-cuda-nvrtc-cu12",
|
| 279 |
+
"version": "12.8.93",
|
| 280 |
+
"direct_url": null
|
| 281 |
+
},
|
| 282 |
+
{
|
| 283 |
+
"name": "nvidia-cuda-runtime-cu12",
|
| 284 |
+
"version": "12.8.90",
|
| 285 |
+
"direct_url": null
|
| 286 |
+
},
|
| 287 |
+
{
|
| 288 |
+
"name": "nvidia-cudnn-cu12",
|
| 289 |
+
"version": "9.10.2.21",
|
| 290 |
+
"direct_url": null
|
| 291 |
+
},
|
| 292 |
+
{
|
| 293 |
+
"name": "nvidia-cufft-cu12",
|
| 294 |
+
"version": "11.3.3.83",
|
| 295 |
+
"direct_url": null
|
| 296 |
+
},
|
| 297 |
+
{
|
| 298 |
+
"name": "nvidia-cufile-cu12",
|
| 299 |
+
"version": "1.13.1.3",
|
| 300 |
+
"direct_url": null
|
| 301 |
+
},
|
| 302 |
+
{
|
| 303 |
+
"name": "nvidia-curand-cu12",
|
| 304 |
+
"version": "10.3.9.90",
|
| 305 |
+
"direct_url": null
|
| 306 |
+
},
|
| 307 |
+
{
|
| 308 |
+
"name": "nvidia-cusolver-cu12",
|
| 309 |
+
"version": "11.7.3.90",
|
| 310 |
+
"direct_url": null
|
| 311 |
+
},
|
| 312 |
+
{
|
| 313 |
+
"name": "nvidia-cusparse-cu12",
|
| 314 |
+
"version": "12.5.8.93",
|
| 315 |
+
"direct_url": null
|
| 316 |
+
},
|
| 317 |
+
{
|
| 318 |
+
"name": "nvidia-cusparselt-cu12",
|
| 319 |
+
"version": "0.7.1",
|
| 320 |
+
"direct_url": null
|
| 321 |
+
},
|
| 322 |
+
{
|
| 323 |
+
"name": "nvidia-nccl-cu12",
|
| 324 |
+
"version": "2.27.3",
|
| 325 |
+
"direct_url": null
|
| 326 |
+
},
|
| 327 |
+
{
|
| 328 |
+
"name": "nvidia-nvjitlink-cu12",
|
| 329 |
+
"version": "12.8.93",
|
| 330 |
+
"direct_url": null
|
| 331 |
+
},
|
| 332 |
+
{
|
| 333 |
+
"name": "nvidia-nvtx-cu12",
|
| 334 |
+
"version": "12.8.90",
|
| 335 |
+
"direct_url": null
|
| 336 |
+
},
|
| 337 |
+
{
|
| 338 |
+
"name": "omegaconf",
|
| 339 |
+
"version": "2.3.0",
|
| 340 |
+
"direct_url": null
|
| 341 |
+
},
|
| 342 |
+
{
|
| 343 |
+
"name": "opencv-python-headless",
|
| 344 |
+
"version": "4.11.0.86",
|
| 345 |
+
"direct_url": null
|
| 346 |
+
},
|
| 347 |
+
{
|
| 348 |
+
"name": "packaging",
|
| 349 |
+
"version": "25.0",
|
| 350 |
+
"direct_url": null
|
| 351 |
+
},
|
| 352 |
+
{
|
| 353 |
+
"name": "pandas",
|
| 354 |
+
"version": "2.3.3",
|
| 355 |
+
"direct_url": null
|
| 356 |
+
},
|
| 357 |
+
{
|
| 358 |
+
"name": "pillow",
|
| 359 |
+
"version": "12.0.0",
|
| 360 |
+
"direct_url": null
|
| 361 |
+
},
|
| 362 |
+
{
|
| 363 |
+
"name": "pipablepytorch3d",
|
| 364 |
+
"version": "0.7.6",
|
| 365 |
+
"direct_url": null
|
| 366 |
+
},
|
| 367 |
+
{
|
| 368 |
+
"name": "platformdirs",
|
| 369 |
+
"version": "4.5.1",
|
| 370 |
+
"direct_url": null
|
| 371 |
+
},
|
| 372 |
+
{
|
| 373 |
+
"name": "portalocker",
|
| 374 |
+
"version": "3.2.0",
|
| 375 |
+
"direct_url": null
|
| 376 |
+
},
|
| 377 |
+
{
|
| 378 |
+
"name": "protobuf",
|
| 379 |
+
"version": "6.33.2",
|
| 380 |
+
"direct_url": null
|
| 381 |
+
},
|
| 382 |
+
{
|
| 383 |
+
"name": "psutil",
|
| 384 |
+
"version": "7.2.1",
|
| 385 |
+
"direct_url": null
|
| 386 |
+
},
|
| 387 |
+
{
|
| 388 |
+
"name": "py-cpuinfo",
|
| 389 |
+
"version": "9.0.0",
|
| 390 |
+
"direct_url": null
|
| 391 |
+
},
|
| 392 |
+
{
|
| 393 |
+
"name": "pydantic",
|
| 394 |
+
"version": "2.10.6",
|
| 395 |
+
"direct_url": null
|
| 396 |
+
},
|
| 397 |
+
{
|
| 398 |
+
"name": "pydantic_core",
|
| 399 |
+
"version": "2.27.2",
|
| 400 |
+
"direct_url": null
|
| 401 |
+
},
|
| 402 |
+
{
|
| 403 |
+
"name": "Pygments",
|
| 404 |
+
"version": "2.19.2",
|
| 405 |
+
"direct_url": null
|
| 406 |
+
},
|
| 407 |
+
{
|
| 408 |
+
"name": "pyparsing",
|
| 409 |
+
"version": "3.3.1",
|
| 410 |
+
"direct_url": null
|
| 411 |
+
},
|
| 412 |
+
{
|
| 413 |
+
"name": "python-dateutil",
|
| 414 |
+
"version": "2.9.0.post0",
|
| 415 |
+
"direct_url": null
|
| 416 |
+
},
|
| 417 |
+
{
|
| 418 |
+
"name": "pytz",
|
| 419 |
+
"version": "2025.2",
|
| 420 |
+
"direct_url": null
|
| 421 |
+
},
|
| 422 |
+
{
|
| 423 |
+
"name": "PyYAML",
|
| 424 |
+
"version": "6.0.3",
|
| 425 |
+
"direct_url": null
|
| 426 |
+
},
|
| 427 |
+
{
|
| 428 |
+
"name": "qwen-vl-utils",
|
| 429 |
+
"version": "0.0.14",
|
| 430 |
+
"direct_url": null
|
| 431 |
+
},
|
| 432 |
+
{
|
| 433 |
+
"name": "regex",
|
| 434 |
+
"version": "2025.11.3",
|
| 435 |
+
"direct_url": null
|
| 436 |
+
},
|
| 437 |
+
{
|
| 438 |
+
"name": "requests",
|
| 439 |
+
"version": "2.32.5",
|
| 440 |
+
"direct_url": null
|
| 441 |
+
},
|
| 442 |
+
{
|
| 443 |
+
"name": "rich",
|
| 444 |
+
"version": "14.2.0",
|
| 445 |
+
"direct_url": null
|
| 446 |
+
},
|
| 447 |
+
{
|
| 448 |
+
"name": "scikit-image",
|
| 449 |
+
"version": "0.25.2",
|
| 450 |
+
"direct_url": null
|
| 451 |
+
},
|
| 452 |
+
{
|
| 453 |
+
"name": "scipy",
|
| 454 |
+
"version": "1.15.3",
|
| 455 |
+
"direct_url": null
|
| 456 |
+
},
|
| 457 |
+
{
|
| 458 |
+
"name": "sentry-sdk",
|
| 459 |
+
"version": "2.48.0",
|
| 460 |
+
"direct_url": null
|
| 461 |
+
},
|
| 462 |
+
{
|
| 463 |
+
"name": "setuptools",
|
| 464 |
+
"version": "80.9.0",
|
| 465 |
+
"direct_url": null
|
| 466 |
+
},
|
| 467 |
+
{
|
| 468 |
+
"name": "six",
|
| 469 |
+
"version": "1.17.0",
|
| 470 |
+
"direct_url": null
|
| 471 |
+
},
|
| 472 |
+
{
|
| 473 |
+
"name": "smmap",
|
| 474 |
+
"version": "5.0.2",
|
| 475 |
+
"direct_url": null
|
| 476 |
+
},
|
| 477 |
+
{
|
| 478 |
+
"name": "sympy",
|
| 479 |
+
"version": "1.14.0",
|
| 480 |
+
"direct_url": null
|
| 481 |
+
},
|
| 482 |
+
{
|
| 483 |
+
"name": "tabulate",
|
| 484 |
+
"version": "0.9.0",
|
| 485 |
+
"direct_url": null
|
| 486 |
+
},
|
| 487 |
+
{
|
| 488 |
+
"name": "tensorboard",
|
| 489 |
+
"version": "2.20.0",
|
| 490 |
+
"direct_url": null
|
| 491 |
+
},
|
| 492 |
+
{
|
| 493 |
+
"name": "tensorboard-data-server",
|
| 494 |
+
"version": "0.7.2",
|
| 495 |
+
"direct_url": null
|
| 496 |
+
},
|
| 497 |
+
{
|
| 498 |
+
"name": "termcolor",
|
| 499 |
+
"version": "3.3.0",
|
| 500 |
+
"direct_url": null
|
| 501 |
+
},
|
| 502 |
+
{
|
| 503 |
+
"name": "tifffile",
|
| 504 |
+
"version": "2025.5.10",
|
| 505 |
+
"direct_url": null
|
| 506 |
+
},
|
| 507 |
+
{
|
| 508 |
+
"name": "tiktoken",
|
| 509 |
+
"version": "0.12.0",
|
| 510 |
+
"direct_url": null
|
| 511 |
+
},
|
| 512 |
+
{
|
| 513 |
+
"name": "timm",
|
| 514 |
+
"version": "1.0.22",
|
| 515 |
+
"direct_url": null
|
| 516 |
+
},
|
| 517 |
+
{
|
| 518 |
+
"name": "torch",
|
| 519 |
+
"version": "2.8.0+cu128",
|
| 520 |
+
"direct_url": null
|
| 521 |
+
},
|
| 522 |
+
{
|
| 523 |
+
"name": "torchaudio",
|
| 524 |
+
"version": "2.8.0+cu128",
|
| 525 |
+
"direct_url": null
|
| 526 |
+
},
|
| 527 |
+
{
|
| 528 |
+
"name": "torchvision",
|
| 529 |
+
"version": "0.23.0+cu128",
|
| 530 |
+
"direct_url": null
|
| 531 |
+
},
|
| 532 |
+
{
|
| 533 |
+
"name": "tqdm",
|
| 534 |
+
"version": "4.67.1",
|
| 535 |
+
"direct_url": null
|
| 536 |
+
},
|
| 537 |
+
{
|
| 538 |
+
"name": "transformers-stream-generator",
|
| 539 |
+
"version": "0.0.5",
|
| 540 |
+
"direct_url": null
|
| 541 |
+
},
|
| 542 |
+
{
|
| 543 |
+
"name": "triton",
|
| 544 |
+
"version": "3.4.0",
|
| 545 |
+
"direct_url": null
|
| 546 |
+
},
|
| 547 |
+
{
|
| 548 |
+
"name": "typeguard",
|
| 549 |
+
"version": "4.4.4",
|
| 550 |
+
"direct_url": null
|
| 551 |
+
},
|
| 552 |
+
{
|
| 553 |
+
"name": "typing_extensions",
|
| 554 |
+
"version": "4.15.0",
|
| 555 |
+
"direct_url": null
|
| 556 |
+
},
|
| 557 |
+
{
|
| 558 |
+
"name": "tyro",
|
| 559 |
+
"version": "1.0.3",
|
| 560 |
+
"direct_url": null
|
| 561 |
+
},
|
| 562 |
+
{
|
| 563 |
+
"name": "tzdata",
|
| 564 |
+
"version": "2025.3",
|
| 565 |
+
"direct_url": null
|
| 566 |
+
},
|
| 567 |
+
{
|
| 568 |
+
"name": "urllib3",
|
| 569 |
+
"version": "2.6.2",
|
| 570 |
+
"direct_url": null
|
| 571 |
+
},
|
| 572 |
+
{
|
| 573 |
+
"name": "wandb",
|
| 574 |
+
"version": "0.23.1",
|
| 575 |
+
"direct_url": null
|
| 576 |
+
},
|
| 577 |
+
{
|
| 578 |
+
"name": "websocket",
|
| 579 |
+
"version": "0.2.1",
|
| 580 |
+
"direct_url": null
|
| 581 |
+
},
|
| 582 |
+
{
|
| 583 |
+
"name": "websocket-client",
|
| 584 |
+
"version": "1.8.0",
|
| 585 |
+
"direct_url": null
|
| 586 |
+
},
|
| 587 |
+
{
|
| 588 |
+
"name": "websockets",
|
| 589 |
+
"version": "15.0.1",
|
| 590 |
+
"direct_url": null
|
| 591 |
+
},
|
| 592 |
+
{
|
| 593 |
+
"name": "Werkzeug",
|
| 594 |
+
"version": "3.1.4",
|
| 595 |
+
"direct_url": null
|
| 596 |
+
},
|
| 597 |
+
{
|
| 598 |
+
"name": "wheel",
|
| 599 |
+
"version": "0.45.1",
|
| 600 |
+
"direct_url": null
|
| 601 |
+
},
|
| 602 |
+
{
|
| 603 |
+
"name": "yacs",
|
| 604 |
+
"version": "0.1.8",
|
| 605 |
+
"direct_url": null
|
| 606 |
+
},
|
| 607 |
+
{
|
| 608 |
+
"name": "zipp",
|
| 609 |
+
"version": "3.23.0",
|
| 610 |
+
"direct_url": null
|
| 611 |
+
},
|
| 612 |
+
{
|
| 613 |
+
"name": "zope.event",
|
| 614 |
+
"version": "6.1",
|
| 615 |
+
"direct_url": null
|
| 616 |
+
},
|
| 617 |
+
{
|
| 618 |
+
"name": "zope.interface",
|
| 619 |
+
"version": "8.1.1",
|
| 620 |
+
"direct_url": null
|
| 621 |
+
},
|
| 622 |
+
{
|
| 623 |
+
"name": "flash_attn",
|
| 624 |
+
"version": "2.8.3",
|
| 625 |
+
"direct_url": null
|
| 626 |
+
},
|
| 627 |
+
{
|
| 628 |
+
"name": "wrapt",
|
| 629 |
+
"version": "2.0.1",
|
| 630 |
+
"direct_url": null
|
| 631 |
+
},
|
| 632 |
+
{
|
| 633 |
+
"name": "svgwrite",
|
| 634 |
+
"version": "1.4.3",
|
| 635 |
+
"direct_url": null
|
| 636 |
+
},
|
| 637 |
+
{
|
| 638 |
+
"name": "attrs",
|
| 639 |
+
"version": "25.4.0",
|
| 640 |
+
"direct_url": null
|
| 641 |
+
},
|
| 642 |
+
{
|
| 643 |
+
"name": "Tree",
|
| 644 |
+
"version": "0.2.4",
|
| 645 |
+
"direct_url": null
|
| 646 |
+
},
|
| 647 |
+
{
|
| 648 |
+
"name": "dm-tree",
|
| 649 |
+
"version": "0.1.9",
|
| 650 |
+
"direct_url": null
|
| 651 |
+
},
|
| 652 |
+
{
|
| 653 |
+
"name": "debugpy",
|
| 654 |
+
"version": "1.8.19",
|
| 655 |
+
"direct_url": null
|
| 656 |
+
},
|
| 657 |
+
{
|
| 658 |
+
"name": "nvidia-ml-py",
|
| 659 |
+
"version": "13.590.44",
|
| 660 |
+
"direct_url": null
|
| 661 |
+
},
|
| 662 |
+
{
|
| 663 |
+
"name": "wcwidth",
|
| 664 |
+
"version": "0.2.14",
|
| 665 |
+
"direct_url": null
|
| 666 |
+
},
|
| 667 |
+
{
|
| 668 |
+
"name": "blessed",
|
| 669 |
+
"version": "1.25.0",
|
| 670 |
+
"direct_url": null
|
| 671 |
+
},
|
| 672 |
+
{
|
| 673 |
+
"name": "gpustat",
|
| 674 |
+
"version": "1.1.1",
|
| 675 |
+
"direct_url": null
|
| 676 |
+
},
|
| 677 |
+
{
|
| 678 |
+
"name": "pure_eval",
|
| 679 |
+
"version": "0.2.3",
|
| 680 |
+
"direct_url": null
|
| 681 |
+
},
|
| 682 |
+
{
|
| 683 |
+
"name": "ptyprocess",
|
| 684 |
+
"version": "0.7.0",
|
| 685 |
+
"direct_url": null
|
| 686 |
+
},
|
| 687 |
+
{
|
| 688 |
+
"name": "traitlets",
|
| 689 |
+
"version": "5.14.3",
|
| 690 |
+
"direct_url": null
|
| 691 |
+
},
|
| 692 |
+
{
|
| 693 |
+
"name": "tomli",
|
| 694 |
+
"version": "2.3.0",
|
| 695 |
+
"direct_url": null
|
| 696 |
+
},
|
| 697 |
+
{
|
| 698 |
+
"name": "prompt_toolkit",
|
| 699 |
+
"version": "3.0.52",
|
| 700 |
+
"direct_url": null
|
| 701 |
+
},
|
| 702 |
+
{
|
| 703 |
+
"name": "pexpect",
|
| 704 |
+
"version": "4.9.0",
|
| 705 |
+
"direct_url": null
|
| 706 |
+
},
|
| 707 |
+
{
|
| 708 |
+
"name": "parso",
|
| 709 |
+
"version": "0.8.5",
|
| 710 |
+
"direct_url": null
|
| 711 |
+
},
|
| 712 |
+
{
|
| 713 |
+
"name": "executing",
|
| 714 |
+
"version": "2.2.1",
|
| 715 |
+
"direct_url": null
|
| 716 |
+
},
|
| 717 |
+
{
|
| 718 |
+
"name": "decorator",
|
| 719 |
+
"version": "5.2.1",
|
| 720 |
+
"direct_url": null
|
| 721 |
+
},
|
| 722 |
+
{
|
| 723 |
+
"name": "asttokens",
|
| 724 |
+
"version": "3.0.1",
|
| 725 |
+
"direct_url": null
|
| 726 |
+
},
|
| 727 |
+
{
|
| 728 |
+
"name": "stack-data",
|
| 729 |
+
"version": "0.6.3",
|
| 730 |
+
"direct_url": null
|
| 731 |
+
},
|
| 732 |
+
{
|
| 733 |
+
"name": "matplotlib-inline",
|
| 734 |
+
"version": "0.2.1",
|
| 735 |
+
"direct_url": null
|
| 736 |
+
},
|
| 737 |
+
{
|
| 738 |
+
"name": "jedi",
|
| 739 |
+
"version": "0.19.2",
|
| 740 |
+
"direct_url": null
|
| 741 |
+
},
|
| 742 |
+
{
|
| 743 |
+
"name": "ipython",
|
| 744 |
+
"version": "8.38.0",
|
| 745 |
+
"direct_url": null
|
| 746 |
+
},
|
| 747 |
+
{
|
| 748 |
+
"name": "ipdb",
|
| 749 |
+
"version": "0.13.13",
|
| 750 |
+
"direct_url": null
|
| 751 |
+
},
|
| 752 |
+
{
|
| 753 |
+
"name": "json-numpy",
|
| 754 |
+
"version": "2.1.1",
|
| 755 |
+
"direct_url": null
|
| 756 |
+
},
|
| 757 |
+
{
|
| 758 |
+
"name": "accelerate",
|
| 759 |
+
"version": "1.5.2",
|
| 760 |
+
"direct_url": null
|
| 761 |
+
},
|
| 762 |
+
{
|
| 763 |
+
"name": "h5py",
|
| 764 |
+
"version": "3.15.1",
|
| 765 |
+
"direct_url": null
|
| 766 |
+
},
|
| 767 |
+
{
|
| 768 |
+
"name": "pip",
|
| 769 |
+
"version": "26.0.1",
|
| 770 |
+
"direct_url": null
|
| 771 |
+
},
|
| 772 |
+
{
|
| 773 |
+
"name": "docutils",
|
| 774 |
+
"version": "0.22.4",
|
| 775 |
+
"direct_url": null
|
| 776 |
+
},
|
| 777 |
+
{
|
| 778 |
+
"name": "catkin-pkg",
|
| 779 |
+
"version": "1.1.0",
|
| 780 |
+
"direct_url": null
|
| 781 |
+
},
|
| 782 |
+
{
|
| 783 |
+
"name": "pykdl_utils",
|
| 784 |
+
"version": "0.1.0",
|
| 785 |
+
"direct_url": {
|
| 786 |
+
"dir_info": {
|
| 787 |
+
"editable": true
|
| 788 |
+
},
|
| 789 |
+
"url": "file:///mnt/workspace/users/zhangtianle/others/pykdl_utils"
|
| 790 |
+
}
|
| 791 |
+
},
|
| 792 |
+
{
|
| 793 |
+
"name": "hrl_geom",
|
| 794 |
+
"version": "0.1.0",
|
| 795 |
+
"direct_url": {
|
| 796 |
+
"dir_info": {
|
| 797 |
+
"editable": true
|
| 798 |
+
},
|
| 799 |
+
"url": "file:///mnt/workspace/users/zhangtianle/others/hrl_geom"
|
| 800 |
+
}
|
| 801 |
+
},
|
| 802 |
+
{
|
| 803 |
+
"name": "lxml",
|
| 804 |
+
"version": "6.0.2",
|
| 805 |
+
"direct_url": null
|
| 806 |
+
},
|
| 807 |
+
{
|
| 808 |
+
"name": "urdf_parser_py",
|
| 809 |
+
"version": "0.0.4",
|
| 810 |
+
"direct_url": null
|
| 811 |
+
},
|
| 812 |
+
{
|
| 813 |
+
"name": "fla-core",
|
| 814 |
+
"version": "0.4.2",
|
| 815 |
+
"direct_url": null
|
| 816 |
+
},
|
| 817 |
+
{
|
| 818 |
+
"name": "flash-linear-attention",
|
| 819 |
+
"version": "0.4.2",
|
| 820 |
+
"direct_url": null
|
| 821 |
+
},
|
| 822 |
+
{
|
| 823 |
+
"name": "shellingham",
|
| 824 |
+
"version": "1.5.4",
|
| 825 |
+
"direct_url": null
|
| 826 |
+
},
|
| 827 |
+
{
|
| 828 |
+
"name": "annotated-doc",
|
| 829 |
+
"version": "0.0.4",
|
| 830 |
+
"direct_url": null
|
| 831 |
+
},
|
| 832 |
+
{
|
| 833 |
+
"name": "typer",
|
| 834 |
+
"version": "0.24.1",
|
| 835 |
+
"direct_url": null
|
| 836 |
+
},
|
| 837 |
+
{
|
| 838 |
+
"name": "typer-slim",
|
| 839 |
+
"version": "0.24.0",
|
| 840 |
+
"direct_url": null
|
| 841 |
+
},
|
| 842 |
+
{
|
| 843 |
+
"name": "openpi-client",
|
| 844 |
+
"version": "0.1.0",
|
| 845 |
+
"direct_url": {
|
| 846 |
+
"dir_info": {},
|
| 847 |
+
"url": "file:///mnt/workspace/users/lidongwei1/code/openpi-client"
|
| 848 |
+
}
|
| 849 |
+
},
|
| 850 |
+
{
|
| 851 |
+
"name": "pyzmq",
|
| 852 |
+
"version": "27.1.0",
|
| 853 |
+
"direct_url": null
|
| 854 |
+
},
|
| 855 |
+
{
|
| 856 |
+
"name": "xxhash",
|
| 857 |
+
"version": "3.6.0",
|
| 858 |
+
"direct_url": null
|
| 859 |
+
},
|
| 860 |
+
{
|
| 861 |
+
"name": "pyarrow",
|
| 862 |
+
"version": "23.0.1",
|
| 863 |
+
"direct_url": null
|
| 864 |
+
},
|
| 865 |
+
{
|
| 866 |
+
"name": "propcache",
|
| 867 |
+
"version": "0.4.1",
|
| 868 |
+
"direct_url": null
|
| 869 |
+
},
|
| 870 |
+
{
|
| 871 |
+
"name": "multidict",
|
| 872 |
+
"version": "6.7.1",
|
| 873 |
+
"direct_url": null
|
| 874 |
+
},
|
| 875 |
+
{
|
| 876 |
+
"name": "frozenlist",
|
| 877 |
+
"version": "1.8.0",
|
| 878 |
+
"direct_url": null
|
| 879 |
+
},
|
| 880 |
+
{
|
| 881 |
+
"name": "dill",
|
| 882 |
+
"version": "0.4.1",
|
| 883 |
+
"direct_url": null
|
| 884 |
+
},
|
| 885 |
+
{
|
| 886 |
+
"name": "async-timeout",
|
| 887 |
+
"version": "5.0.1",
|
| 888 |
+
"direct_url": null
|
| 889 |
+
},
|
| 890 |
+
{
|
| 891 |
+
"name": "aiohappyeyeballs",
|
| 892 |
+
"version": "2.6.1",
|
| 893 |
+
"direct_url": null
|
| 894 |
+
},
|
| 895 |
+
{
|
| 896 |
+
"name": "yarl",
|
| 897 |
+
"version": "1.23.0",
|
| 898 |
+
"direct_url": null
|
| 899 |
+
},
|
| 900 |
+
{
|
| 901 |
+
"name": "multiprocess",
|
| 902 |
+
"version": "0.70.19",
|
| 903 |
+
"direct_url": null
|
| 904 |
+
},
|
| 905 |
+
{
|
| 906 |
+
"name": "aiosignal",
|
| 907 |
+
"version": "1.4.0",
|
| 908 |
+
"direct_url": null
|
| 909 |
+
},
|
| 910 |
+
{
|
| 911 |
+
"name": "aiohttp",
|
| 912 |
+
"version": "3.13.5",
|
| 913 |
+
"direct_url": null
|
| 914 |
+
},
|
| 915 |
+
{
|
| 916 |
+
"name": "datasets",
|
| 917 |
+
"version": "4.8.4",
|
| 918 |
+
"direct_url": null
|
| 919 |
+
},
|
| 920 |
+
{
|
| 921 |
+
"name": "narwhals",
|
| 922 |
+
"version": "2.19.0",
|
| 923 |
+
"direct_url": null
|
| 924 |
+
},
|
| 925 |
+
{
|
| 926 |
+
"name": "plotly",
|
| 927 |
+
"version": "6.7.0",
|
| 928 |
+
"direct_url": null
|
| 929 |
+
},
|
| 930 |
+
{
|
| 931 |
+
"name": "hydra-core",
|
| 932 |
+
"version": "1.3.2",
|
| 933 |
+
"direct_url": null
|
| 934 |
+
},
|
| 935 |
+
{
|
| 936 |
+
"name": "peft",
|
| 937 |
+
"version": "0.19.1",
|
| 938 |
+
"direct_url": null
|
| 939 |
+
},
|
| 940 |
+
{
|
| 941 |
+
"name": "x-transformers",
|
| 942 |
+
"version": "2.19.0",
|
| 943 |
+
"direct_url": null
|
| 944 |
+
},
|
| 945 |
+
{
|
| 946 |
+
"name": "loguru",
|
| 947 |
+
"version": "0.7.3",
|
| 948 |
+
"direct_url": null
|
| 949 |
+
},
|
| 950 |
+
{
|
| 951 |
+
"name": "torch-einops-utils",
|
| 952 |
+
"version": "0.0.33",
|
| 953 |
+
"direct_url": null
|
| 954 |
+
},
|
| 955 |
+
{
|
| 956 |
+
"name": "einx",
|
| 957 |
+
"version": "0.4.3",
|
| 958 |
+
"direct_url": null
|
| 959 |
+
},
|
| 960 |
+
{
|
| 961 |
+
"name": "uvicorn",
|
| 962 |
+
"version": "0.46.0",
|
| 963 |
+
"direct_url": null
|
| 964 |
+
},
|
| 965 |
+
{
|
| 966 |
+
"name": "typing-inspection",
|
| 967 |
+
"version": "0.4.2",
|
| 968 |
+
"direct_url": null
|
| 969 |
+
},
|
| 970 |
+
{
|
| 971 |
+
"name": "starlette",
|
| 972 |
+
"version": "1.0.0",
|
| 973 |
+
"direct_url": null
|
| 974 |
+
},
|
| 975 |
+
{
|
| 976 |
+
"name": "fastapi",
|
| 977 |
+
"version": "0.136.1",
|
| 978 |
+
"direct_url": null
|
| 979 |
+
},
|
| 980 |
+
{
|
| 981 |
+
"name": "safetensors",
|
| 982 |
+
"version": "0.8.0rc0",
|
| 983 |
+
"direct_url": null
|
| 984 |
+
},
|
| 985 |
+
{
|
| 986 |
+
"name": "diffusers",
|
| 987 |
+
"version": "0.38.0",
|
| 988 |
+
"direct_url": null
|
| 989 |
+
},
|
| 990 |
+
{
|
| 991 |
+
"name": "easydict",
|
| 992 |
+
"version": "1.13",
|
| 993 |
+
"direct_url": null
|
| 994 |
+
},
|
| 995 |
+
{
|
| 996 |
+
"name": "ftfy",
|
| 997 |
+
"version": "6.3.1",
|
| 998 |
+
"direct_url": null
|
| 999 |
+
},
|
| 1000 |
+
{
|
| 1001 |
+
"name": "threadpoolctl",
|
| 1002 |
+
"version": "3.6.0",
|
| 1003 |
+
"direct_url": null
|
| 1004 |
+
},
|
| 1005 |
+
{
|
| 1006 |
+
"name": "soxr",
|
| 1007 |
+
"version": "1.1.0",
|
| 1008 |
+
"direct_url": null
|
| 1009 |
+
},
|
| 1010 |
+
{
|
| 1011 |
+
"name": "pycparser",
|
| 1012 |
+
"version": "3.0",
|
| 1013 |
+
"direct_url": null
|
| 1014 |
+
},
|
| 1015 |
+
{
|
| 1016 |
+
"name": "llvmlite",
|
| 1017 |
+
"version": "0.47.0",
|
| 1018 |
+
"direct_url": null
|
| 1019 |
+
},
|
| 1020 |
+
{
|
| 1021 |
+
"name": "joblib",
|
| 1022 |
+
"version": "1.5.3",
|
| 1023 |
+
"direct_url": null
|
| 1024 |
+
},
|
| 1025 |
+
{
|
| 1026 |
+
"name": "audioread",
|
| 1027 |
+
"version": "3.1.0",
|
| 1028 |
+
"direct_url": null
|
| 1029 |
+
},
|
| 1030 |
+
{
|
| 1031 |
+
"name": "scikit-learn",
|
| 1032 |
+
"version": "1.7.2",
|
| 1033 |
+
"direct_url": null
|
| 1034 |
+
},
|
| 1035 |
+
{
|
| 1036 |
+
"name": "pooch",
|
| 1037 |
+
"version": "1.9.0",
|
| 1038 |
+
"direct_url": null
|
| 1039 |
+
},
|
| 1040 |
+
{
|
| 1041 |
+
"name": "numba",
|
| 1042 |
+
"version": "0.65.1",
|
| 1043 |
+
"direct_url": null
|
| 1044 |
+
},
|
| 1045 |
+
{
|
| 1046 |
+
"name": "cffi",
|
| 1047 |
+
"version": "2.0.0",
|
| 1048 |
+
"direct_url": null
|
| 1049 |
+
},
|
| 1050 |
+
{
|
| 1051 |
+
"name": "soundfile",
|
| 1052 |
+
"version": "0.13.1",
|
| 1053 |
+
"direct_url": null
|
| 1054 |
+
},
|
| 1055 |
+
{
|
| 1056 |
+
"name": "librosa",
|
| 1057 |
+
"version": "0.11.0",
|
| 1058 |
+
"direct_url": null
|
| 1059 |
+
},
|
| 1060 |
+
{
|
| 1061 |
+
"name": "cryptography",
|
| 1062 |
+
"version": "48.0.0",
|
| 1063 |
+
"direct_url": null
|
| 1064 |
+
},
|
| 1065 |
+
{
|
| 1066 |
+
"name": "dashscope",
|
| 1067 |
+
"version": "1.25.18",
|
| 1068 |
+
"direct_url": null
|
| 1069 |
+
},
|
| 1070 |
+
{
|
| 1071 |
+
"name": "nltk",
|
| 1072 |
+
"version": "3.9.4",
|
| 1073 |
+
"direct_url": null
|
| 1074 |
+
},
|
| 1075 |
+
{
|
| 1076 |
+
"name": "better-profanity",
|
| 1077 |
+
"version": "0.7.0",
|
| 1078 |
+
"direct_url": null
|
| 1079 |
+
},
|
| 1080 |
+
{
|
| 1081 |
+
"name": "jmespath",
|
| 1082 |
+
"version": "1.1.0",
|
| 1083 |
+
"direct_url": null
|
| 1084 |
+
},
|
| 1085 |
+
{
|
| 1086 |
+
"name": "botocore",
|
| 1087 |
+
"version": "1.43.9",
|
| 1088 |
+
"direct_url": null
|
| 1089 |
+
},
|
| 1090 |
+
{
|
| 1091 |
+
"name": "s3transfer",
|
| 1092 |
+
"version": "0.17.0",
|
| 1093 |
+
"direct_url": null
|
| 1094 |
+
},
|
| 1095 |
+
{
|
| 1096 |
+
"name": "boto3",
|
| 1097 |
+
"version": "1.43.9",
|
| 1098 |
+
"direct_url": null
|
| 1099 |
+
},
|
| 1100 |
+
{
|
| 1101 |
+
"name": "megatron-core",
|
| 1102 |
+
"version": "0.16.1",
|
| 1103 |
+
"direct_url": null
|
| 1104 |
+
},
|
| 1105 |
+
{
|
| 1106 |
+
"name": "braceexpand",
|
| 1107 |
+
"version": "0.1.7",
|
| 1108 |
+
"direct_url": null
|
| 1109 |
+
},
|
| 1110 |
+
{
|
| 1111 |
+
"name": "webdataset",
|
| 1112 |
+
"version": "1.0.2",
|
| 1113 |
+
"direct_url": null
|
| 1114 |
+
},
|
| 1115 |
+
{
|
| 1116 |
+
"name": "hf-xet",
|
| 1117 |
+
"version": "1.5.0",
|
| 1118 |
+
"direct_url": null
|
| 1119 |
+
},
|
| 1120 |
+
{
|
| 1121 |
+
"name": "huggingface_hub",
|
| 1122 |
+
"version": "1.15.0",
|
| 1123 |
+
"direct_url": null
|
| 1124 |
+
},
|
| 1125 |
+
{
|
| 1126 |
+
"name": "tokenizers",
|
| 1127 |
+
"version": "0.22.2",
|
| 1128 |
+
"direct_url": null
|
| 1129 |
+
},
|
| 1130 |
+
{
|
| 1131 |
+
"name": "transformers",
|
| 1132 |
+
"version": "5.8.1",
|
| 1133 |
+
"direct_url": null
|
| 1134 |
+
},
|
| 1135 |
+
{
|
| 1136 |
+
"name": "frozendict",
|
| 1137 |
+
"version": "2.4.7",
|
| 1138 |
+
"direct_url": null
|
| 1139 |
+
},
|
| 1140 |
+
{
|
| 1141 |
+
"name": "hyper-connections",
|
| 1142 |
+
"version": "0.4.11",
|
| 1143 |
+
"direct_url": null
|
| 1144 |
+
},
|
| 1145 |
+
{
|
| 1146 |
+
"name": "gymnasium",
|
| 1147 |
+
"version": "0.29.1",
|
| 1148 |
+
"direct_url": null
|
| 1149 |
+
},
|
| 1150 |
+
{
|
| 1151 |
+
"name": "zstandard",
|
| 1152 |
+
"version": "0.25.0",
|
| 1153 |
+
"direct_url": null
|
| 1154 |
+
},
|
| 1155 |
+
{
|
| 1156 |
+
"name": "ruamel.yaml",
|
| 1157 |
+
"version": "0.19.1",
|
| 1158 |
+
"direct_url": null
|
| 1159 |
+
},
|
| 1160 |
+
{
|
| 1161 |
+
"name": "lz4",
|
| 1162 |
+
"version": "4.4.5",
|
| 1163 |
+
"direct_url": null
|
| 1164 |
+
},
|
| 1165 |
+
{
|
| 1166 |
+
"name": "apsw",
|
| 1167 |
+
"version": "3.53.1.0",
|
| 1168 |
+
"direct_url": null
|
| 1169 |
+
},
|
| 1170 |
+
{
|
| 1171 |
+
"name": "rosbags",
|
| 1172 |
+
"version": "0.11.3",
|
| 1173 |
+
"direct_url": null
|
| 1174 |
+
},
|
| 1175 |
+
{
|
| 1176 |
+
"name": "sentencepiece",
|
| 1177 |
+
"version": "0.2.1",
|
| 1178 |
+
"direct_url": null
|
| 1179 |
+
},
|
| 1180 |
+
{
|
| 1181 |
+
"name": "numpy",
|
| 1182 |
+
"version": "2.2.6",
|
| 1183 |
+
"direct_url": null
|
| 1184 |
+
},
|
| 1185 |
+
{
|
| 1186 |
+
"name": "cmeel",
|
| 1187 |
+
"version": "0.60.1",
|
| 1188 |
+
"direct_url": null
|
| 1189 |
+
},
|
| 1190 |
+
{
|
| 1191 |
+
"name": "cmeel-zlib",
|
| 1192 |
+
"version": "1.3.2",
|
| 1193 |
+
"direct_url": null
|
| 1194 |
+
},
|
| 1195 |
+
{
|
| 1196 |
+
"name": "cmeel-tinyxml2",
|
| 1197 |
+
"version": "11.0.0",
|
| 1198 |
+
"direct_url": null
|
| 1199 |
+
},
|
| 1200 |
+
{
|
| 1201 |
+
"name": "cmeel-qhull",
|
| 1202 |
+
"version": "8.0.2.1",
|
| 1203 |
+
"direct_url": null
|
| 1204 |
+
},
|
| 1205 |
+
{
|
| 1206 |
+
"name": "cmeel-octomap",
|
| 1207 |
+
"version": "1.10.0",
|
| 1208 |
+
"direct_url": null
|
| 1209 |
+
},
|
| 1210 |
+
{
|
| 1211 |
+
"name": "cmeel-console-bridge",
|
| 1212 |
+
"version": "1.0.2.3",
|
| 1213 |
+
"direct_url": null
|
| 1214 |
+
},
|
| 1215 |
+
{
|
| 1216 |
+
"name": "cmeel-boost",
|
| 1217 |
+
"version": "1.90.0",
|
| 1218 |
+
"direct_url": null
|
| 1219 |
+
},
|
| 1220 |
+
{
|
| 1221 |
+
"name": "eigenpy",
|
| 1222 |
+
"version": "3.13.0",
|
| 1223 |
+
"direct_url": null
|
| 1224 |
+
},
|
| 1225 |
+
{
|
| 1226 |
+
"name": "cmeel-urdfdom",
|
| 1227 |
+
"version": "6.0.0",
|
| 1228 |
+
"direct_url": null
|
| 1229 |
+
},
|
| 1230 |
+
{
|
| 1231 |
+
"name": "cmeel-assimp",
|
| 1232 |
+
"version": "6.0.5",
|
| 1233 |
+
"direct_url": null
|
| 1234 |
+
},
|
| 1235 |
+
{
|
| 1236 |
+
"name": "libcoal",
|
| 1237 |
+
"version": "3.0.3",
|
| 1238 |
+
"direct_url": null
|
| 1239 |
+
},
|
| 1240 |
+
{
|
| 1241 |
+
"name": "libpinocchio",
|
| 1242 |
+
"version": "4.0.0",
|
| 1243 |
+
"direct_url": null
|
| 1244 |
+
},
|
| 1245 |
+
{
|
| 1246 |
+
"name": "coal",
|
| 1247 |
+
"version": "3.0.3",
|
| 1248 |
+
"direct_url": null
|
| 1249 |
+
},
|
| 1250 |
+
{
|
| 1251 |
+
"name": "pin",
|
| 1252 |
+
"version": "4.0.0",
|
| 1253 |
+
"direct_url": null
|
| 1254 |
+
},
|
| 1255 |
+
{
|
| 1256 |
+
"name": "gesim",
|
| 1257 |
+
"version": "0.1.0",
|
| 1258 |
+
"direct_url": {
|
| 1259 |
+
"dir_info": {
|
| 1260 |
+
"editable": true
|
| 1261 |
+
},
|
| 1262 |
+
"url": "file:///mnt/workspace/users/wangjunjie729/wjj/GE-Sim-V2-main"
|
| 1263 |
+
}
|
| 1264 |
+
},
|
| 1265 |
+
{
|
| 1266 |
+
"name": "liger_kernel",
|
| 1267 |
+
"version": "0.8.0",
|
| 1268 |
+
"direct_url": null
|
| 1269 |
+
},
|
| 1270 |
+
{
|
| 1271 |
+
"name": "msgpack-numpy",
|
| 1272 |
+
"version": "0.4.8",
|
| 1273 |
+
"direct_url": {
|
| 1274 |
+
"archive_info": {
|
| 1275 |
+
"hash": "sha256=773c19d4dfbae1b3c7b791083e2caf66983bb19b40901646f61d8731554ae3da",
|
| 1276 |
+
"hashes": {
|
| 1277 |
+
"sha256": "773c19d4dfbae1b3c7b791083e2caf66983bb19b40901646f61d8731554ae3da"
|
| 1278 |
+
}
|
| 1279 |
+
},
|
| 1280 |
+
"url": "file:///tmp/msgpack_numpy-0.4.8-py2.py3-none-any.whl"
|
| 1281 |
+
}
|
| 1282 |
+
},
|
| 1283 |
+
{
|
| 1284 |
+
"name": "pluggy",
|
| 1285 |
+
"version": "1.6.0",
|
| 1286 |
+
"direct_url": null
|
| 1287 |
+
},
|
| 1288 |
+
{
|
| 1289 |
+
"name": "iniconfig",
|
| 1290 |
+
"version": "2.3.0",
|
| 1291 |
+
"direct_url": null
|
| 1292 |
+
},
|
| 1293 |
+
{
|
| 1294 |
+
"name": "pytest",
|
| 1295 |
+
"version": "8.4.2",
|
| 1296 |
+
"direct_url": null
|
| 1297 |
+
},
|
| 1298 |
+
{
|
| 1299 |
+
"name": "hrl_geom",
|
| 1300 |
+
"version": "0.1.0",
|
| 1301 |
+
"direct_url": null
|
| 1302 |
+
},
|
| 1303 |
+
{
|
| 1304 |
+
"name": "pykdl_utils",
|
| 1305 |
+
"version": "0.1.0",
|
| 1306 |
+
"direct_url": null
|
| 1307 |
+
}
|
| 1308 |
+
]
|
| 1309 |
+
}
|
examples/Behavior/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!-- # Copyright 2025 starVLA community. All rights reserved.
|
| 2 |
+
# Licensed under the MIT License, Version 1.0 (the "License");
|
| 3 |
+
# Implemented by [Zixuan Wang / HKUST] in [2025]. -->
|
| 4 |
+
# 🚧Under construction
|
| 5 |
+
This document provides instructions to run our framework with the [BEHAVIOR-1K Benchmark](https://github.com/StanfordVL/BEHAVIOR-1K). We follow the structure of [2025 BEHAVIOR Challenge](https://behavior.stanford.edu/challenge/index.html) so that you can train and evaluate on the 50 full-length household tasks.
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
The evaluation process consists of two main parts:
|
| 9 |
+
|
| 10 |
+
1. Setting up the `behavior` environment and dependencies.
|
| 11 |
+
2. Running the evaluation by launching services in both `starVLA` and `behavior` environments.
|
| 12 |
+
|
| 13 |
+
Note that to run evaluation on Behavior benchmark, you should **not** use GPUs without RT Cores (A100, H100). Otherwise you may encounter problems of Segmentation fault or low resolution. See [this](https://github.com/StanfordVL/BEHAVIOR-1K/issues/1872#issuecomment-3455002820) and [this](https://github.com/StanfordVL/BEHAVIOR-1K/issues/1875#issuecomment-3444246495) for discussion.
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
## 📦 1. Environment Setup
|
| 17 |
+
To set up the conda enviroment for `behavior` environment, use the following command:
|
| 18 |
+
|
| 19 |
+
```
|
| 20 |
+
git clone https://github.com/StanfordVL/BEHAVIOR-1K.git
|
| 21 |
+
conda create -n behavior python=3.10 -y
|
| 22 |
+
conda activate behavior
|
| 23 |
+
cd BEHAVIOR-1K
|
| 24 |
+
pip install "setuptools<=79"
|
| 25 |
+
./setup.sh --omnigibson --bddl --joylo --dataset
|
| 26 |
+
conda install -c conda-forge libglu
|
| 27 |
+
pip install rich omegaconf hydra-core msgpack websockets av pandas google-auth
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
Also in starVLA env:
|
| 31 |
+
```
|
| 32 |
+
pip install websockets
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
## 🚀 2. Eval in Behavior
|
| 36 |
+
|
| 37 |
+
Steps:
|
| 38 |
+
1) Download the checkpoint:``
|
| 39 |
+
2) Choose the script below according to your need
|
| 40 |
+
|
| 41 |
+
(A) parallel evaluation script.
|
| 42 |
+
|
| 43 |
+
```bash
|
| 44 |
+
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 bash examples/Behavior/start_parallel_eval.sh
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
Before running start_parallel_eval.sh, set the following three paths:
|
| 48 |
+
- `star_vla_python`: Python interpreter for the StarVLA environment.
|
| 49 |
+
- `sim_python`: Python interpreter for the Behavior environment.
|
| 50 |
+
- `TASKS_JSONL_PATH`: This file contains the task description downloaded from the [training dataset](https://huggingface.co/datasets/behavior-1k/2025-challenge-demos), we have included it with path examples/Behavior/tasks.jsonl
|
| 51 |
+
- `BEHAVIOR_ASSET_PATH`: Local path to the behavior asset path. The default path is in BEHAVIOR-1K/datasets after installing behavior with `./setup.sh --omnigibson --bddl --joylo --dataset`
|
| 52 |
+
|
| 53 |
+
(B) For the ease of debugging, you may also start the client (evaluation environment) and server (policy) in two separate terminal:
|
| 54 |
+
|
| 55 |
+
```bash
|
| 56 |
+
bash examples/Behavior/start_server.sh
|
| 57 |
+
bash examples/Behavior/start_client.sh
|
| 58 |
+
```
|
| 59 |
+
The above debugging files will conduct evaluation on train set
|
| 60 |
+
|
| 61 |
+
(C) To prevent memory overflow, we implemented another file `start_parallel_eval_per_task.sh`:
|
| 62 |
+
```bash
|
| 63 |
+
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 bash examples/Behavior/start_parallel_eval.sh
|
| 64 |
+
```
|
| 65 |
+
- The script will run evaluation for each task in `INSTANCE_NAMES` iteratively
|
| 66 |
+
- For each tasks, allocate all instances from `TEST_EVAL_INSTANCE_IDS` across GPUs
|
| 67 |
+
- Wait for the previous task to finish, then procede to the next task
|
| 68 |
+
|
| 69 |
+
## 🔧 3. Notes
|
| 70 |
+
|
| 71 |
+
### Wrapper
|
| 72 |
+
1. RGBLowResWrapper: only use rgb as visual observation and camera resolutions of 224 * 224. Only using low-res RGB can help speed up the simulator and thus reduce evaluation time compared to the two other example wrappers. This wrapper is ok to use in standard track.
|
| 73 |
+
2. DefaultWrapper: wrapper with the default observation config used during data collection (rgb + depth + segmentation, 720p for head camera and 480p for wrist camera). This wrapper is ok to use in standard track, but evaluation will be considerably slower compared to RGBLowResWrapper.
|
| 74 |
+
3. RichObservationWrapper: this will load additional observation modalities, such as normal and flow, as well as privileged task information. This wrapper can only be used in privileged information track.
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
### Action Dim
|
| 78 |
+
BEHAVIOR has action dim = 23
|
| 79 |
+
|
| 80 |
+
```
|
| 81 |
+
"R1Pro": {
|
| 82 |
+
"base": np.s_[0:3], # Indices 0-2
|
| 83 |
+
"torso": np.s_[3:7], # Indices 3-6
|
| 84 |
+
"left_arm": np.s_[7:14], # Indices 7-13
|
| 85 |
+
"left_gripper": np.s_[14:15], # Index 14
|
| 86 |
+
"right_arm": np.s_[15:22], # Indices 15-21
|
| 87 |
+
"right_gripper": np.s_[22:23], # Index 22
|
| 88 |
+
}
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
### Video Saving:
|
| 92 |
+
The video will be saved in the format of {task_name}\_{idx}\_{epi}.mp4, where idx is the instance number, epi is the episode number
|
| 93 |
+
|
| 94 |
+
### Common Bugs
|
| 95 |
+
Segmentation fault (core dumped): a likely reason is vulkan is not successfully installed. Check this [link](https://maniskill.readthedocs.io/en/latest/user_guide/getting_started/installation.html#vulkan)
|
| 96 |
+
|
| 97 |
+
ImportError: libGL.so.1: cannot open shared object file: No such file or directory:
|
| 98 |
+
`apt-get install ffmpeg libsm6 libxext6 -y`
|
examples/Behavior/adaptive_ensemble.py
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
adaptive_ensemble.py
|
| 3 |
+
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from collections import deque
|
| 7 |
+
import numpy as np
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class AdaptiveEnsembler:
|
| 11 |
+
def __init__(self, pred_action_horizon, adaptive_ensemble_alpha=0.0):
|
| 12 |
+
self.pred_action_horizon = pred_action_horizon
|
| 13 |
+
self.action_history = deque(maxlen=self.pred_action_horizon)
|
| 14 |
+
self.adaptive_ensemble_alpha = adaptive_ensemble_alpha
|
| 15 |
+
|
| 16 |
+
def reset(self):
|
| 17 |
+
self.action_history.clear()
|
| 18 |
+
|
| 19 |
+
def ensemble_action(self, cur_action):
|
| 20 |
+
self.action_history.append(cur_action)
|
| 21 |
+
num_actions = len(self.action_history)
|
| 22 |
+
if cur_action.ndim == 1:
|
| 23 |
+
curr_act_preds = np.stack(self.action_history)
|
| 24 |
+
else:
|
| 25 |
+
curr_act_preds = np.stack(
|
| 26 |
+
[pred_actions[i] for (i, pred_actions) in zip(range(num_actions - 1, -1, -1), self.action_history)]
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
# calculate cosine similarity between the current prediction and all previous predictions
|
| 30 |
+
ref = curr_act_preds[num_actions-1, :]
|
| 31 |
+
previous_pred = curr_act_preds
|
| 32 |
+
dot_product = np.sum(previous_pred * ref, axis=1)
|
| 33 |
+
norm_previous_pred = np.linalg.norm(previous_pred, axis=1)
|
| 34 |
+
norm_ref = np.linalg.norm(ref)
|
| 35 |
+
cos_similarity = dot_product / (norm_previous_pred * norm_ref + 1e-7)
|
| 36 |
+
|
| 37 |
+
# compute the weights for each prediction
|
| 38 |
+
weights = np.exp(self.adaptive_ensemble_alpha * cos_similarity)
|
| 39 |
+
weights = weights / weights.sum()
|
| 40 |
+
|
| 41 |
+
# compute the weighted average across all predictions for this timestep
|
| 42 |
+
cur_action = np.sum(weights[:, None] * curr_act_preds, axis=0)
|
| 43 |
+
|
| 44 |
+
return cur_action
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
class ChunkedAdaptiveEnsembler:
|
| 48 |
+
def __init__(self, pred_action_horizon, update_interval, adaptive_ensemble_alpha=0.0):
|
| 49 |
+
self.pred_action_horizon = pred_action_horizon
|
| 50 |
+
self.update_interval = update_interval
|
| 51 |
+
self.adaptive_ensemble_alpha = adaptive_ensemble_alpha
|
| 52 |
+
|
| 53 |
+
self.action_history = []
|
| 54 |
+
self.current_step = 0
|
| 55 |
+
|
| 56 |
+
def reset(self):
|
| 57 |
+
self.action_history = []
|
| 58 |
+
self.current_step = 0
|
| 59 |
+
|
| 60 |
+
def ensemble_action(self, new_action_chunk):
|
| 61 |
+
self.action_history.append({
|
| 62 |
+
'start_step': self.current_step,
|
| 63 |
+
'actions': new_action_chunk
|
| 64 |
+
})
|
| 65 |
+
|
| 66 |
+
def step(self):
|
| 67 |
+
self.action_history = [
|
| 68 |
+
h for h in self.action_history
|
| 69 |
+
if h['start_step'] + len(h['actions']) > self.current_step
|
| 70 |
+
]
|
| 71 |
+
|
| 72 |
+
relevant_preds = []
|
| 73 |
+
|
| 74 |
+
for history_item in self.action_history:
|
| 75 |
+
idx = self.current_step - history_item['start_step']
|
| 76 |
+
|
| 77 |
+
if 0 <= idx < len(history_item['actions']):
|
| 78 |
+
relevant_preds.append(history_item['actions'][idx])
|
| 79 |
+
|
| 80 |
+
if not relevant_preds:
|
| 81 |
+
raise ValueError(f"Step {self.current_step}: No actions available. Did you forget to initialize with an action chunk?")
|
| 82 |
+
|
| 83 |
+
curr_act_preds = np.stack(relevant_preds)
|
| 84 |
+
num_actions = curr_act_preds.shape[0]
|
| 85 |
+
|
| 86 |
+
if num_actions == 1:
|
| 87 |
+
final_action = curr_act_preds[0]
|
| 88 |
+
else:
|
| 89 |
+
ref = curr_act_preds[-1, :]
|
| 90 |
+
previous_pred = curr_act_preds
|
| 91 |
+
|
| 92 |
+
dot_product = np.sum(previous_pred * ref, axis=1)
|
| 93 |
+
norm_previous_pred = np.linalg.norm(previous_pred, axis=1)
|
| 94 |
+
norm_ref = np.linalg.norm(ref)
|
| 95 |
+
cos_similarity = dot_product / (norm_previous_pred * norm_ref + 1e-7)
|
| 96 |
+
|
| 97 |
+
weights = np.exp(self.adaptive_ensemble_alpha * cos_similarity)
|
| 98 |
+
weights = weights / weights.sum()
|
| 99 |
+
|
| 100 |
+
final_action = np.sum(weights[:, None] * curr_act_preds, axis=0)
|
| 101 |
+
|
| 102 |
+
self.current_step += 1
|
| 103 |
+
|
| 104 |
+
return final_action
|
examples/Behavior/custom_argparse.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# copy from SimplerEnv/simpler_env/evaluation/argparse.py
|
| 2 |
+
|
| 3 |
+
import argparse
|
| 4 |
+
|
| 5 |
+
import numpy as np
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def parse_range_tuple(t):
|
| 9 |
+
return np.linspace(t[0], t[1], int(t[2]))
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def get_args():
|
| 13 |
+
# parse command-line arguments
|
| 14 |
+
parser = argparse.ArgumentParser()
|
| 15 |
+
parser.add_argument(
|
| 16 |
+
"--policy-model",
|
| 17 |
+
type=str,
|
| 18 |
+
default="rt1",
|
| 19 |
+
help="Policy model type; e.g., 'rt1', 'octo-base', 'octo-small'",
|
| 20 |
+
)
|
| 21 |
+
parser.add_argument("--policy-setup", type=str, default="R1Pro", help="Policy setup")
|
| 22 |
+
parser.add_argument("--ckpt-path", type=str, default=None)
|
| 23 |
+
|
| 24 |
+
parser.add_argument("--eval-on-train-instances", type=lambda x: x.lower() == "true",default=True)
|
| 25 |
+
parser.add_argument("--logging-dir", type=str, default="./results")
|
| 26 |
+
parser.add_argument("--tf-memory-limit", type=int, default=3072, help="Tensorflow memory limit")
|
| 27 |
+
parser.add_argument("--async-freq", type=int, default=1)
|
| 28 |
+
parser.add_argument("--host", type=str, default="127.0.0.1", help="Octo init rng seed")
|
| 29 |
+
parser.add_argument("--port", type=int, default=10093)
|
| 30 |
+
parser.add_argument("--headless", type=bool, default=True, help="Whether to run in headless mode (no GUI)")
|
| 31 |
+
parser.add_argument("--write-video", type=bool, default=True, help="Whether to save videos of the evaluation")
|
| 32 |
+
parser.add_argument("--task-name", type=str, required=True, help="Task name")
|
| 33 |
+
parser.add_argument("--eval-instance-ids", type=str, default=None, help="Instance ids to evaluate on, if None, evaluate on all instances")
|
| 34 |
+
parser.add_argument("--behavior-tasks-jsonl-path", type=str, required=True, help="behavior tasks jsonl path")
|
| 35 |
+
parser.add_argument("--behavior-asset-path", type=str, required=True, help="parent path of 2025-challenge-task-instances data path (default to be BEHAVIOR-1k/datasets)")
|
| 36 |
+
parser.add_argument("--partial-scene-load", type=bool, default=False, help="Whether to only load task-relevant rooms for a specific task")
|
| 37 |
+
parser.add_argument("--wrappers", type=str, default="RGBLowResWrapper",choices=["RGBLowResWrapper", "DefaultWrapper", "RichObservationWrapper"], help="List of wrappers to apply to the environment")
|
| 38 |
+
parser.add_argument("--max-steps", type=int, default=None, help="Max steps per rollout episode, setting to null will use the default value (2 x average human demo completion steps)")
|
| 39 |
+
parser.add_argument("--use-state", default=False, type=lambda x: x.lower() == "true",help="Whether to use state as part of the observation")
|
| 40 |
+
|
| 41 |
+
args = parser.parse_args()
|
| 42 |
+
|
| 43 |
+
return args
|
examples/Behavior/model2behavior_interface.py
ADDED
|
@@ -0,0 +1,384 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from collections import deque
|
| 2 |
+
from typing import Optional, Sequence, Dict, Any
|
| 3 |
+
import os
|
| 4 |
+
import cv2 as cv
|
| 5 |
+
import matplotlib.pyplot as plt
|
| 6 |
+
import numpy as np
|
| 7 |
+
import torch
|
| 8 |
+
from datetime import datetime
|
| 9 |
+
|
| 10 |
+
from transforms3d.euler import euler2axangle
|
| 11 |
+
from deployment.model_server.tools.websocket_policy_client import WebsocketClientPolicy
|
| 12 |
+
|
| 13 |
+
from examples.Behavior.adaptive_ensemble import AdaptiveEnsembler, ChunkedAdaptiveEnsembler
|
| 14 |
+
from pathlib import Path
|
| 15 |
+
|
| 16 |
+
from starVLA.model.tools import read_mode_config
|
| 17 |
+
|
| 18 |
+
# Import BEHAVIOR-specific utilities
|
| 19 |
+
from omnigibson.learning.utils.eval_utils import ROBOT_CAMERA_NAMES, PROPRIOCEPTION_INDICES
|
| 20 |
+
|
| 21 |
+
def start_debugpy_once():
|
| 22 |
+
"""start debugpy once"""
|
| 23 |
+
import debugpy
|
| 24 |
+
if getattr(start_debugpy_once, "_started", False):
|
| 25 |
+
return
|
| 26 |
+
debugpy.listen(("0.0.0.0", 10092))
|
| 27 |
+
print("🔍 Waiting for VSCode attach on 0.0.0.0:10092 ...")
|
| 28 |
+
debugpy.wait_for_client()
|
| 29 |
+
start_debugpy_once._started = True
|
| 30 |
+
|
| 31 |
+
class M1Inference:
|
| 32 |
+
def __init__(
|
| 33 |
+
self,
|
| 34 |
+
policy_ckpt_path,
|
| 35 |
+
policy_setup: str = "R1Pro",
|
| 36 |
+
horizon: int = 0,
|
| 37 |
+
action_ensemble_horizon: Optional[int] = None,
|
| 38 |
+
image_size: list[int] = [224, 224],
|
| 39 |
+
action_scale: float = 1.0,
|
| 40 |
+
cfg_scale: float = 1.5,
|
| 41 |
+
use_ddim: bool = True,
|
| 42 |
+
num_ddim_steps: int = 10,
|
| 43 |
+
action_ensemble: bool = False,
|
| 44 |
+
adaptive_ensemble_alpha: float = 0.1,
|
| 45 |
+
host: str = "0.0.0.0",
|
| 46 |
+
port: int = 10093,
|
| 47 |
+
task_description: str = None,
|
| 48 |
+
use_state: bool = False,
|
| 49 |
+
) -> None:
|
| 50 |
+
|
| 51 |
+
# build client to connect server policy
|
| 52 |
+
self.client = WebsocketClientPolicy(host, port)
|
| 53 |
+
|
| 54 |
+
action_ensemble = True
|
| 55 |
+
|
| 56 |
+
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
| 57 |
+
|
| 58 |
+
# Robot type for BEHAVIOR
|
| 59 |
+
if policy_setup == "R1Pro":
|
| 60 |
+
unnorm_key = "R1Pro"
|
| 61 |
+
if action_ensemble_horizon is None:
|
| 62 |
+
action_ensemble_horizon = 5
|
| 63 |
+
self.sticky_gripper_num_repeat = 3
|
| 64 |
+
else:
|
| 65 |
+
raise NotImplementedError(
|
| 66 |
+
f"Policy setup {policy_setup} not supported for BEHAVIOR models."
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
self.policy_setup = policy_setup
|
| 70 |
+
self.unnorm_key = unnorm_key
|
| 71 |
+
self.action_ensemble = action_ensemble
|
| 72 |
+
self.adaptive_ensemble_alpha = adaptive_ensemble_alpha
|
| 73 |
+
self.action_ensemble_horizon = action_ensemble_horizon
|
| 74 |
+
self.policy_ckpt_path = policy_ckpt_path
|
| 75 |
+
|
| 76 |
+
print(f"*** policy_setup: {policy_setup}, unnorm_key: {unnorm_key} ***")
|
| 77 |
+
self.use_ddim = use_ddim
|
| 78 |
+
self.num_ddim_steps = num_ddim_steps
|
| 79 |
+
self.cfg_scale = cfg_scale
|
| 80 |
+
self.image_size = image_size
|
| 81 |
+
self.action_scale = action_scale
|
| 82 |
+
self.horizon = horizon
|
| 83 |
+
|
| 84 |
+
# Gripper control state
|
| 85 |
+
self.sticky_action_is_on = False
|
| 86 |
+
self.gripper_action_repeat = 0
|
| 87 |
+
self.sticky_gripper_action = 0.0
|
| 88 |
+
self.previous_gripper_action = None
|
| 89 |
+
|
| 90 |
+
# initial
|
| 91 |
+
self.action_chunk_size = 2
|
| 92 |
+
self.current_step = 0
|
| 93 |
+
|
| 94 |
+
# Task and image history
|
| 95 |
+
self.task_description = task_description
|
| 96 |
+
self.image_history = deque(maxlen=self.horizon)
|
| 97 |
+
if self.action_ensemble:
|
| 98 |
+
if self.action_chunk_size > 1:
|
| 99 |
+
self.action_ensembler = ChunkedAdaptiveEnsembler(self.action_ensemble_horizon, self.action_chunk_size, self.adaptive_ensemble_alpha)
|
| 100 |
+
else:
|
| 101 |
+
self.action_ensembler = AdaptiveEnsembler(self.action_ensemble_horizon, self.adaptive_ensemble_alpha)
|
| 102 |
+
else:
|
| 103 |
+
self.action_ensembler = None
|
| 104 |
+
self.num_image_history = 0
|
| 105 |
+
|
| 106 |
+
# Load action normalization stats
|
| 107 |
+
self.action_norm_stats = self.get_action_stats(self.unnorm_key, policy_ckpt_path=policy_ckpt_path)
|
| 108 |
+
|
| 109 |
+
self.use_state = use_state
|
| 110 |
+
|
| 111 |
+
# If want to debug, uncomment the following line
|
| 112 |
+
# if os.getenv("DEBUG", False):
|
| 113 |
+
# start_debugpy_once()
|
| 114 |
+
|
| 115 |
+
def reset(self, task_description: Optional[str] = None) -> None:
|
| 116 |
+
if task_description is not None:
|
| 117 |
+
self.task_description = task_description
|
| 118 |
+
if self.action_ensemble:
|
| 119 |
+
self.action_ensembler.reset()
|
| 120 |
+
|
| 121 |
+
self.sticky_action_is_on = False
|
| 122 |
+
self.gripper_action_repeat = 0
|
| 123 |
+
self.sticky_gripper_action = 0.0
|
| 124 |
+
self.previous_gripper_action = None
|
| 125 |
+
self.current_step = 0
|
| 126 |
+
|
| 127 |
+
def _generate_prop_state(self, proprio: np.ndarray) -> np.ndarray:
|
| 128 |
+
"""Generate proprioceptive state for R1Pro robot."""
|
| 129 |
+
idx = PROPRIOCEPTION_INDICES[self.policy_setup]
|
| 130 |
+
qpos_list = [
|
| 131 |
+
proprio[idx["joint_qpos_sin"]][6:], # First 6 are base joints, which is NOT allowed in standard track
|
| 132 |
+
proprio[idx["joint_qpos_cos"]][6:], # First 6 are base joints, which is NOT allowed in standard track
|
| 133 |
+
]
|
| 134 |
+
assert qpos_list[0].shape == (22,)
|
| 135 |
+
assert qpos_list[1].shape == (22,)
|
| 136 |
+
return np.concatenate(qpos_list, axis=0)
|
| 137 |
+
|
| 138 |
+
def _process_behavior_obs(self, obs: Dict[str, Any]) -> Dict[str, Any]:
|
| 139 |
+
"""Process BEHAVIOR observations to extract images and proprioception."""
|
| 140 |
+
# Extract images from different camera views
|
| 141 |
+
try:
|
| 142 |
+
head_camera_key = ROBOT_CAMERA_NAMES[self.policy_setup]["head"] + "::rgb"
|
| 143 |
+
left_wrist_camera_key = ROBOT_CAMERA_NAMES[self.policy_setup]["left_wrist"] + "::rgb"
|
| 144 |
+
right_wrist_camera_key = ROBOT_CAMERA_NAMES[self.policy_setup]["right_wrist"] + "::rgb"
|
| 145 |
+
|
| 146 |
+
full_image = obs[head_camera_key][:, :, :3] # [224, 224, 3]
|
| 147 |
+
left_wrist_image = obs[left_wrist_camera_key][:, :, :3] # [224, 224, 3]
|
| 148 |
+
right_wrist_image = obs[right_wrist_camera_key][:, :, :3] # [224, 224, 3]
|
| 149 |
+
prop_state = self._generate_prop_state(obs["robot_r1::proprio"])
|
| 150 |
+
|
| 151 |
+
except KeyError as e:
|
| 152 |
+
print(f"Error extracting observations: {e}")
|
| 153 |
+
print(f"Available keys in obs: {list(obs.keys())}")
|
| 154 |
+
raise
|
| 155 |
+
|
| 156 |
+
# Resize images to policy input size
|
| 157 |
+
full_image = self._resize_image(full_image)
|
| 158 |
+
left_wrist_image = self._resize_image(left_wrist_image)
|
| 159 |
+
right_wrist_image = self._resize_image(right_wrist_image)
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
return {
|
| 163 |
+
"full_image": full_image,
|
| 164 |
+
"left_wrist_image": left_wrist_image,
|
| 165 |
+
"right_wrist_image": right_wrist_image,
|
| 166 |
+
"state": prop_state,
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
def forward(self, obs: Dict[str, Any]) -> torch.Tensor:
|
| 170 |
+
"""
|
| 171 |
+
Forward pass for BEHAVIOR environment.
|
| 172 |
+
|
| 173 |
+
Args:
|
| 174 |
+
obs: Dictionary containing observations from BEHAVIOR environment
|
| 175 |
+
|
| 176 |
+
Returns:
|
| 177 |
+
torch.Tensor: Action tensor for the robot
|
| 178 |
+
"""
|
| 179 |
+
# Process observations to extract images and proprioception
|
| 180 |
+
processed_obs = self._process_behavior_obs(obs)
|
| 181 |
+
|
| 182 |
+
# Use the head camera image as the primary input
|
| 183 |
+
primary_image = processed_obs["full_image"]
|
| 184 |
+
left_wrist_image = processed_obs["left_wrist_image"]
|
| 185 |
+
right_wrist_image = processed_obs["right_wrist_image"]
|
| 186 |
+
if "dual" in self.policy_ckpt_path.lower():
|
| 187 |
+
image_input = [primary_image]
|
| 188 |
+
wrist_image_input = [left_wrist_image, right_wrist_image]
|
| 189 |
+
else:
|
| 190 |
+
image_input = [primary_image, left_wrist_image, right_wrist_image]
|
| 191 |
+
wrist_image_input = None
|
| 192 |
+
|
| 193 |
+
# Get task description from environment if not already set
|
| 194 |
+
if self.task_description is None:
|
| 195 |
+
# Try to get task description from the environment
|
| 196 |
+
# This assumes the environment has a task attribute with show_instruction method
|
| 197 |
+
print(f"Warning: Could not get task description")
|
| 198 |
+
self.task_description = "Turn on the radio receiver that's on the table in the living room."
|
| 199 |
+
|
| 200 |
+
# Prepare proprioceptive state.
|
| 201 |
+
# GR00T action header expects state tensor to have shape (B, T_s, state_dim)
|
| 202 |
+
# so that after the MLP it becomes (B, T_s, hidden). If we pass a simple
|
| 203 |
+
# 1-D vector the downstream `torch.cat` fails because the ranks differ.
|
| 204 |
+
# Therefore, when state is enabled we reshape it to (1, 1, state_dim).
|
| 205 |
+
|
| 206 |
+
if self.use_state:
|
| 207 |
+
raw_state = processed_obs["state"] # shape (state_dim,)
|
| 208 |
+
state = raw_state[None, :] # → (1, state_dim)
|
| 209 |
+
example = {
|
| 210 |
+
"image": image_input,
|
| 211 |
+
"wrist_views": wrist_image_input,
|
| 212 |
+
"state": state,
|
| 213 |
+
"lang": self.task_description,
|
| 214 |
+
}
|
| 215 |
+
else:
|
| 216 |
+
example = {
|
| 217 |
+
"image": image_input,
|
| 218 |
+
"wrist_views": wrist_image_input,
|
| 219 |
+
"lang": self.task_description,
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
vla_input = {
|
| 223 |
+
"examples": [example],
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
# Get action from websocket server
|
| 227 |
+
action_chunk_size = self.action_chunk_size
|
| 228 |
+
if self.current_step % action_chunk_size == 0:
|
| 229 |
+
if self.current_step % 100 == 0:
|
| 230 |
+
print('Step:', self.current_step)
|
| 231 |
+
response = self.client.infer(vla_input)
|
| 232 |
+
|
| 233 |
+
# Check if the response indicates an error
|
| 234 |
+
if response.get("ok", True) == False or response.get("status") == "error":
|
| 235 |
+
error_info = response.get("error", {})
|
| 236 |
+
print(f"Websocket server returned an error:")
|
| 237 |
+
print(f"Status: {response.get('status')}")
|
| 238 |
+
print(f"Error details: {error_info}")
|
| 239 |
+
raise RuntimeError(f"Websocket server error: {error_info}")
|
| 240 |
+
|
| 241 |
+
# Extract and unnormalize actions
|
| 242 |
+
try:
|
| 243 |
+
normalized_actions = response["data"]["normalized_actions"] # B, chunk, D
|
| 244 |
+
except KeyError as e:
|
| 245 |
+
print(f"KeyError accessing response: {e}")
|
| 246 |
+
print(f"Available keys in response: {list(response.keys())}")
|
| 247 |
+
if "data" in response:
|
| 248 |
+
print(f"Keys in 'data': {list(response['data'].keys())}")
|
| 249 |
+
raise
|
| 250 |
+
# Take the first batch element (B dimension) → shape (T, D)
|
| 251 |
+
normalized_actions = normalized_actions[0]
|
| 252 |
+
# Un-normalize to get real-valued actions. Still shape (T, D)
|
| 253 |
+
self.raw_actions = self.unnormalize_actions(
|
| 254 |
+
normalized_actions=normalized_actions,
|
| 255 |
+
action_norm_stats=self.action_norm_stats
|
| 256 |
+
)
|
| 257 |
+
|
| 258 |
+
# Apply action ensembling if enabled
|
| 259 |
+
if self.action_ensemble and action_chunk_size > 1:
|
| 260 |
+
self.action_ensembler.ensemble_action(self.raw_actions)
|
| 261 |
+
|
| 262 |
+
if self.action_ensemble:
|
| 263 |
+
if action_chunk_size == 1:
|
| 264 |
+
raw_actions = self.action_ensembler.ensemble_action(self.raw_actions)[None]
|
| 265 |
+
else:
|
| 266 |
+
raw_actions = self.action_ensembler.step()[None]
|
| 267 |
+
else:
|
| 268 |
+
raw_actions = self.raw_actions[self.current_step % action_chunk_size][None]
|
| 269 |
+
self.current_step += 1
|
| 270 |
+
|
| 271 |
+
# Process raw actions for BEHAVIOR environment
|
| 272 |
+
raw_action = {
|
| 273 |
+
"base_pose": np.array(raw_actions[0,:3]),
|
| 274 |
+
"torso_pose": np.array(raw_actions[0,3:7]),
|
| 275 |
+
"left_arm_pose": np.array(raw_actions[0,7:14]),
|
| 276 |
+
"left_gripper_pose": np.array(raw_actions[0,14:15]),
|
| 277 |
+
"right_arm_pose": np.array(raw_actions[0,15:22]),
|
| 278 |
+
"right_gripper_pose": np.array(raw_actions[0,22:23]),
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
# Convert to BEHAVIOR action format
|
| 282 |
+
action = self._process_action_for_behavior(raw_action)
|
| 283 |
+
|
| 284 |
+
return torch.from_numpy(action).float()
|
| 285 |
+
|
| 286 |
+
def _process_action_for_behavior(self, raw_action: Dict[str, np.ndarray]) -> np.ndarray:
|
| 287 |
+
"""Process raw action to BEHAVIOR environment format."""
|
| 288 |
+
# Process base, torso, left arm, right arm
|
| 289 |
+
base_pose = raw_action["base_pose"]
|
| 290 |
+
torso_pose = raw_action["torso_pose"]
|
| 291 |
+
left_arm_pose = raw_action["left_arm_pose"]
|
| 292 |
+
right_arm_pose = raw_action["right_arm_pose"]
|
| 293 |
+
|
| 294 |
+
# Process gripper action
|
| 295 |
+
left_gripper_pose = self._process_gripper_action(raw_action["left_gripper_pose"])
|
| 296 |
+
right_gripper_pose = self._process_gripper_action(raw_action["right_gripper_pose"])
|
| 297 |
+
|
| 298 |
+
# Combine all actions into a single array
|
| 299 |
+
# BEHAVIOR expects "ACTION_DIM": 23
|
| 300 |
+
# See the following files:
|
| 301 |
+
# - ACTION_QPOS_INDICES in omnigibson/learning/utils/eval_utils.py
|
| 302 |
+
# - action_keys in omnigibson/learning/configs/robot/r1pro.yaml
|
| 303 |
+
action = np.concatenate([
|
| 304 |
+
base_pose, # indices 0:3 (3 dims)
|
| 305 |
+
torso_pose, # indices 3:7 (4 dims)
|
| 306 |
+
left_arm_pose, # indices 7:14 (7 dims)
|
| 307 |
+
np.array([left_gripper_pose]), # index 14:15 (1 dim)
|
| 308 |
+
right_arm_pose, # indices 15:22 (7 dims)
|
| 309 |
+
np.array([right_gripper_pose]), # index 22:23 (1 dim)
|
| 310 |
+
])
|
| 311 |
+
|
| 312 |
+
return action
|
| 313 |
+
|
| 314 |
+
|
| 315 |
+
def _process_gripper_action(self, open_gripper: np.ndarray) -> float:
|
| 316 |
+
"""Process gripper action with sticky behavior for BEHAVIOR environment."""
|
| 317 |
+
# We currently don't apply any other sticky behavior for gripper action.
|
| 318 |
+
current_gripper_action = open_gripper[0]
|
| 319 |
+
|
| 320 |
+
return current_gripper_action
|
| 321 |
+
|
| 322 |
+
@staticmethod
|
| 323 |
+
def unnormalize_actions(normalized_actions: np.ndarray, action_norm_stats: Dict[str, np.ndarray]) -> np.ndarray:
|
| 324 |
+
"""Unnormalize actions using the provided statistics."""
|
| 325 |
+
mask = action_norm_stats.get("mask", np.ones_like(action_norm_stats["min"], dtype=bool))
|
| 326 |
+
action_high, action_low = np.array(action_norm_stats["max"]), np.array(action_norm_stats["min"])
|
| 327 |
+
normalized_actions = np.clip(normalized_actions, -1, 1)
|
| 328 |
+
|
| 329 |
+
actions = np.where(
|
| 330 |
+
mask,
|
| 331 |
+
0.5 * (normalized_actions + 1) * (action_high - action_low) + action_low,
|
| 332 |
+
normalized_actions,
|
| 333 |
+
)
|
| 334 |
+
|
| 335 |
+
return actions
|
| 336 |
+
|
| 337 |
+
@staticmethod
|
| 338 |
+
def get_action_stats(unnorm_key: str, policy_ckpt_path) -> dict:
|
| 339 |
+
"""Load action normalization statistics from checkpoint."""
|
| 340 |
+
policy_ckpt_path = Path(policy_ckpt_path)
|
| 341 |
+
model_config, norm_stats = read_mode_config(policy_ckpt_path)
|
| 342 |
+
|
| 343 |
+
return norm_stats[unnorm_key]["action"]
|
| 344 |
+
|
| 345 |
+
def _resize_image(self, image: np.ndarray) -> np.ndarray:
|
| 346 |
+
"""Resize image to policy input size."""
|
| 347 |
+
|
| 348 |
+
image = image.numpy()
|
| 349 |
+
|
| 350 |
+
image = cv.resize(image, tuple(self.image_size), interpolation=cv.INTER_AREA)
|
| 351 |
+
return image
|
| 352 |
+
|
| 353 |
+
def visualize_epoch(
|
| 354 |
+
self, predicted_raw_actions: Sequence[np.ndarray], images: Sequence[np.ndarray], save_path: str
|
| 355 |
+
) -> None:
|
| 356 |
+
"""Visualize predicted actions and images."""
|
| 357 |
+
images = [self._resize_image(image) for image in images]
|
| 358 |
+
ACTION_DIM_LABELS = ["x", "y", "z", "roll", "pitch", "yaw", "grasp"]
|
| 359 |
+
|
| 360 |
+
img_strip = np.concatenate(np.array(images[::3]), axis=1)
|
| 361 |
+
|
| 362 |
+
# set up plt figure
|
| 363 |
+
figure_layout = [["image"] * len(ACTION_DIM_LABELS), ACTION_DIM_LABELS]
|
| 364 |
+
plt.rcParams.update({"font.size": 12})
|
| 365 |
+
fig, axs = plt.subplot_mosaic(figure_layout)
|
| 366 |
+
fig.set_size_inches([45, 10])
|
| 367 |
+
|
| 368 |
+
# plot actions
|
| 369 |
+
pred_actions = np.array(
|
| 370 |
+
[
|
| 371 |
+
np.concatenate([a["world_vector"], a["rotation_delta"], a["open_gripper"]], axis=-1)
|
| 372 |
+
for a in predicted_raw_actions
|
| 373 |
+
]
|
| 374 |
+
)
|
| 375 |
+
for action_dim, action_label in enumerate(ACTION_DIM_LABELS):
|
| 376 |
+
# actions have batch, horizon, dim, in this example we just take the first action for simplicity
|
| 377 |
+
axs[action_label].plot(pred_actions[:, action_dim], label="predicted action")
|
| 378 |
+
axs[action_label].set_title(action_label)
|
| 379 |
+
axs[action_label].set_xlabel("Time in one episode")
|
| 380 |
+
|
| 381 |
+
axs["image"].imshow(img_strip)
|
| 382 |
+
axs["image"].set_xlabel("Time in one episode (subsampled)")
|
| 383 |
+
plt.legend()
|
| 384 |
+
plt.savefig(save_path)
|