Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- Finetune_SmolVLA_notebook.ipynb +214 -0
- README.md +146 -0
- collage_small.gif +3 -0
- config.json +96 -0
- model.safetensors +3 -0
- policy_postprocessor.json +32 -0
- policy_postprocessor_step_0_unnormalizer_processor.safetensors +3 -0
- policy_preprocessor.json +87 -0
- policy_preprocessor_step_5_normalizer_processor.safetensors +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
collage_small.gif filter=lfs diff=lfs merge=lfs -text
|
Finetune_SmolVLA_notebook.ipynb
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {
|
| 6 |
+
"id": "NQUk3Y0WwYZ4"
|
| 7 |
+
},
|
| 8 |
+
"source": [
|
| 9 |
+
"# 🤗 x 🦾: Training SmolVLA with LeRobot Notebook\n",
|
| 10 |
+
"\n",
|
| 11 |
+
"Welcome to the **LeRobot SmolVLA training notebook**! This notebook provides a ready-to-run setup for training imitation learning policies using the [🤗 LeRobot](https://github.com/huggingface/lerobot) library.\n",
|
| 12 |
+
"\n",
|
| 13 |
+
"In this example, we train an `SmolVLA` policy using a dataset hosted on the [Hugging Face Hub](https://huggingface.co/), and optionally track training metrics with [Weights & Biases (wandb)](https://wandb.ai/).\n",
|
| 14 |
+
"\n",
|
| 15 |
+
"## ⚙️ Requirements\n",
|
| 16 |
+
"- A Hugging Face dataset repo ID containing your training data (`--dataset.repo_id=YOUR_USERNAME/YOUR_DATASET`)\n",
|
| 17 |
+
"- Optional: A [wandb](https://wandb.ai/) account if you want to enable training visualization\n",
|
| 18 |
+
"- Recommended: GPU runtime (e.g., NVIDIA A100) for faster training\n",
|
| 19 |
+
"\n",
|
| 20 |
+
"## ⏱️ Expected Training Time\n",
|
| 21 |
+
"Training with the `SmolVLA` policy for 20,000 steps typically takes **about 5 hours on an NVIDIA A100** GPU. On less powerful GPUs or CPUs, training may take significantly longer!\n",
|
| 22 |
+
"\n",
|
| 23 |
+
"## Example Output\n",
|
| 24 |
+
"Model checkpoints, logs, and training plots will be saved to the specified `--output_dir`. If `wandb` is enabled, progress will also be visualized in your wandb project dashboard.\n"
|
| 25 |
+
]
|
| 26 |
+
},
|
| 27 |
+
{
|
| 28 |
+
"cell_type": "markdown",
|
| 29 |
+
"metadata": {
|
| 30 |
+
"id": "MOJyX0CnwA5m"
|
| 31 |
+
},
|
| 32 |
+
"source": [
|
| 33 |
+
"## Install conda\n",
|
| 34 |
+
"This cell uses `condacolab` to bootstrap a full Conda environment inside Google Colab.\n"
|
| 35 |
+
]
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"cell_type": "code",
|
| 39 |
+
"execution_count": null,
|
| 40 |
+
"metadata": {
|
| 41 |
+
"id": "QlKjL1X5t_zM"
|
| 42 |
+
},
|
| 43 |
+
"outputs": [],
|
| 44 |
+
"source": [
|
| 45 |
+
"!pip install -q condacolab\n",
|
| 46 |
+
"import condacolab\n",
|
| 47 |
+
"condacolab.install()"
|
| 48 |
+
]
|
| 49 |
+
},
|
| 50 |
+
{
|
| 51 |
+
"cell_type": "markdown",
|
| 52 |
+
"metadata": {
|
| 53 |
+
"id": "DxCc3CARwUjN"
|
| 54 |
+
},
|
| 55 |
+
"source": [
|
| 56 |
+
"## Install LeRobot\n",
|
| 57 |
+
"This cell clones the `lerobot` repository from Hugging Face, installs FFmpeg (version 7.1.1), and installs the package in editable mode.\n"
|
| 58 |
+
]
|
| 59 |
+
},
|
| 60 |
+
{
|
| 61 |
+
"cell_type": "code",
|
| 62 |
+
"execution_count": null,
|
| 63 |
+
"metadata": {
|
| 64 |
+
"id": "dgLu7QT5tUik"
|
| 65 |
+
},
|
| 66 |
+
"outputs": [],
|
| 67 |
+
"source": [
|
| 68 |
+
"!git clone https://github.com/huggingface/lerobot.git\n",
|
| 69 |
+
"!conda install ffmpeg=7.1.1 -c conda-forge\n",
|
| 70 |
+
"!cd lerobot && pip install -e ."
|
| 71 |
+
]
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"cell_type": "markdown",
|
| 75 |
+
"metadata": {
|
| 76 |
+
"id": "Q8Sn2wG4wldo"
|
| 77 |
+
},
|
| 78 |
+
"source": [
|
| 79 |
+
"## Weights & Biases login\n",
|
| 80 |
+
"This cell logs you into Weights & Biases (wandb) to enable experiment tracking and logging."
|
| 81 |
+
]
|
| 82 |
+
},
|
| 83 |
+
{
|
| 84 |
+
"cell_type": "code",
|
| 85 |
+
"execution_count": null,
|
| 86 |
+
"metadata": {
|
| 87 |
+
"id": "PolVM_movEvp"
|
| 88 |
+
},
|
| 89 |
+
"outputs": [],
|
| 90 |
+
"source": [
|
| 91 |
+
"!wandb login"
|
| 92 |
+
]
|
| 93 |
+
},
|
| 94 |
+
{
|
| 95 |
+
"cell_type": "markdown",
|
| 96 |
+
"metadata": {
|
| 97 |
+
"id": "zTWQAgX9xseE"
|
| 98 |
+
},
|
| 99 |
+
"source": [
|
| 100 |
+
"## Install SmolVLA dependencies"
|
| 101 |
+
]
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"cell_type": "code",
|
| 105 |
+
"execution_count": null,
|
| 106 |
+
"metadata": {
|
| 107 |
+
"id": "DiHs0BKwxseE"
|
| 108 |
+
},
|
| 109 |
+
"outputs": [],
|
| 110 |
+
"source": [
|
| 111 |
+
"!cd lerobot && pip install -e \".[smolvla]\""
|
| 112 |
+
]
|
| 113 |
+
},
|
| 114 |
+
{
|
| 115 |
+
"cell_type": "markdown",
|
| 116 |
+
"metadata": {
|
| 117 |
+
"id": "IkzTo4mNwxaC"
|
| 118 |
+
},
|
| 119 |
+
"source": [
|
| 120 |
+
"## Start training SmolVLA with LeRobot\n",
|
| 121 |
+
"\n",
|
| 122 |
+
"This cell runs the `train.py` script from the `lerobot` library to train a robot control policy. \n",
|
| 123 |
+
"\n",
|
| 124 |
+
"Make sure to adjust the following arguments to your setup:\n",
|
| 125 |
+
"\n",
|
| 126 |
+
"1. `--dataset.repo_id=YOUR_HF_USERNAME/YOUR_DATASET`: \n",
|
| 127 |
+
" Replace this with the Hugging Face Hub repo ID where your dataset is stored, e.g., `pepijn223/il_gym0`.\n",
|
| 128 |
+
"\n",
|
| 129 |
+
"2. `--batch_size=64`: means the model processes 64 training samples in parallel before doing one gradient update. Reduce this number if you have a GPU with low memory.\n",
|
| 130 |
+
"\n",
|
| 131 |
+
"3. `--output_dir=outputs/train/...`: \n",
|
| 132 |
+
" Directory where training logs and model checkpoints will be saved.\n",
|
| 133 |
+
"\n",
|
| 134 |
+
"4. `--job_name=...`: \n",
|
| 135 |
+
" A name for this training job, used for logging and Weights & Biases.\n",
|
| 136 |
+
"\n",
|
| 137 |
+
"5. `--policy.device=cuda`: \n",
|
| 138 |
+
" Use `cuda` if training on an NVIDIA GPU. Use `mps` for Apple Silicon, or `cpu` if no GPU is available.\n",
|
| 139 |
+
"\n",
|
| 140 |
+
"6. `--wandb.enable=true`: \n",
|
| 141 |
+
" Enables Weights & Biases for visualizing training progress. You must be logged in via `wandb login` before running this."
|
| 142 |
+
]
|
| 143 |
+
},
|
| 144 |
+
{
|
| 145 |
+
"cell_type": "code",
|
| 146 |
+
"execution_count": null,
|
| 147 |
+
"metadata": {
|
| 148 |
+
"id": "ZO52lcQtxseE"
|
| 149 |
+
},
|
| 150 |
+
"outputs": [],
|
| 151 |
+
"source": [
|
| 152 |
+
"!cd lerobot && python lerobot/scripts/train.py \\\n",
|
| 153 |
+
" --policy.path=lerobot/smolvla_base \\\n",
|
| 154 |
+
" --dataset.repo_id=${HF_USER}/mydataset \\\n",
|
| 155 |
+
" --batch_size=64 \\\n",
|
| 156 |
+
" --steps=20000 \\\n",
|
| 157 |
+
" --output_dir=outputs/train/my_smolvla \\\n",
|
| 158 |
+
" --job_name=my_smolvla_training \\\n",
|
| 159 |
+
" --policy.device=cuda \\\n",
|
| 160 |
+
" --wandb.enable=true"
|
| 161 |
+
]
|
| 162 |
+
},
|
| 163 |
+
{
|
| 164 |
+
"cell_type": "markdown",
|
| 165 |
+
"metadata": {
|
| 166 |
+
"id": "2PBu7izpxseF"
|
| 167 |
+
},
|
| 168 |
+
"source": [
|
| 169 |
+
"## Login into Hugging Face Hub\n",
|
| 170 |
+
"Now after training is done login into the Hugging Face hub and upload the last checkpoint"
|
| 171 |
+
]
|
| 172 |
+
},
|
| 173 |
+
{
|
| 174 |
+
"cell_type": "code",
|
| 175 |
+
"execution_count": null,
|
| 176 |
+
"metadata": {
|
| 177 |
+
"id": "8yu5khQGIHi6"
|
| 178 |
+
},
|
| 179 |
+
"outputs": [],
|
| 180 |
+
"source": [
|
| 181 |
+
"!huggingface-cli login"
|
| 182 |
+
]
|
| 183 |
+
},
|
| 184 |
+
{
|
| 185 |
+
"cell_type": "code",
|
| 186 |
+
"execution_count": null,
|
| 187 |
+
"metadata": {
|
| 188 |
+
"id": "zFMLGuVkH7UN"
|
| 189 |
+
},
|
| 190 |
+
"outputs": [],
|
| 191 |
+
"source": [
|
| 192 |
+
"!huggingface-cli upload ${HF_USER}/my_smolvla \\\n",
|
| 193 |
+
" /content/lerobot/outputs/train/my_smolvla/checkpoints/last/pretrained_model"
|
| 194 |
+
]
|
| 195 |
+
}
|
| 196 |
+
],
|
| 197 |
+
"metadata": {
|
| 198 |
+
"accelerator": "GPU",
|
| 199 |
+
"colab": {
|
| 200 |
+
"gpuType": "A100",
|
| 201 |
+
"machine_shape": "hm",
|
| 202 |
+
"provenance": []
|
| 203 |
+
},
|
| 204 |
+
"kernelspec": {
|
| 205 |
+
"display_name": "Python 3",
|
| 206 |
+
"name": "python3"
|
| 207 |
+
},
|
| 208 |
+
"language_info": {
|
| 209 |
+
"name": "python"
|
| 210 |
+
}
|
| 211 |
+
},
|
| 212 |
+
"nbformat": 4,
|
| 213 |
+
"nbformat_minor": 0
|
| 214 |
+
}
|
README.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
library_name: lerobot
|
| 5 |
+
pipeline_tag: robotics
|
| 6 |
+
tags:
|
| 7 |
+
- vision-language-action
|
| 8 |
+
- imitation-learning
|
| 9 |
+
- lerobot
|
| 10 |
+
inference: false
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# SmolVLA (LeRobot)
|
| 14 |
+
|
| 15 |
+
SmolVLA is a compact, efficient Vision-Language-Action (VLA) model designed for affordable robotics, trainable on a single GPU and deployable on consumer hardware, while matching the performance of much larger VLAs through community-driven data.
|
| 16 |
+
|
| 17 |
+
**Original paper:** (SmolVLA: A Vision-Language-Action Model for Affordable and Efficient Robotics)[https://arxiv.org/abs/2506.01844]
|
| 18 |
+
**Reference implementation:** https://github.com/huggingface/lerobot
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
## Model description
|
| 22 |
+
|
| 23 |
+
- **Inputs:** images (multi-view), proprio/state, optional language instruction
|
| 24 |
+
- **Outputs:** continuous actions
|
| 25 |
+
- **Training objective:** flow matching
|
| 26 |
+
- **Action representation:** continuous
|
| 27 |
+
- **Intended use:** Base model to fine tune on your specific use case
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
## Quick start (inference on a real batch)
|
| 31 |
+
|
| 32 |
+
### Installation
|
| 33 |
+
|
| 34 |
+
```bash
|
| 35 |
+
pip install "lerobot[smolvla]"
|
| 36 |
+
```
|
| 37 |
+
For full installation details (including optional video dependencies such as ffmpeg for torchcodec), see the official documentation: https://huggingface.co/docs/lerobot/installation
|
| 38 |
+
|
| 39 |
+
### Load model + dataset, run `select_action`
|
| 40 |
+
|
| 41 |
+
```python
|
| 42 |
+
import torch
|
| 43 |
+
from lerobot.datasets.lerobot_dataset import LeRobotDataset
|
| 44 |
+
from lerobot.policies.factory import make_pre_post_processors
|
| 45 |
+
|
| 46 |
+
# Swap this import per-policy
|
| 47 |
+
from lerobot.policies.smolvla.modeling_smolvla import SmolVLAPolicy
|
| 48 |
+
|
| 49 |
+
# load a policy
|
| 50 |
+
model_id = "lerobot/smolvla_base" # <- swap checkpoint
|
| 51 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 52 |
+
|
| 53 |
+
policy = SmolVLAPolicy.from_pretrained(model_id).to(device).eval()
|
| 54 |
+
|
| 55 |
+
preprocess, postprocess = make_pre_post_processors(
|
| 56 |
+
policy.config,
|
| 57 |
+
model_id,
|
| 58 |
+
preprocessor_overrides={"device_processor": {"device": str(device)}},
|
| 59 |
+
)
|
| 60 |
+
# load a lerobotdataset
|
| 61 |
+
dataset = LeRobotDataset("lerobot/libero")
|
| 62 |
+
|
| 63 |
+
# pick an episode
|
| 64 |
+
episode_index = 0
|
| 65 |
+
|
| 66 |
+
# each episode corresponds to a contiguous range of frame indices
|
| 67 |
+
from_idx = dataset.meta.episodes["dataset_from_index"][episode_index]
|
| 68 |
+
to_idx = dataset.meta.episodes["dataset_to_index"][episode_index]
|
| 69 |
+
|
| 70 |
+
# get a single frame from that episode (e.g. the first frame)
|
| 71 |
+
frame_index = from_idx
|
| 72 |
+
frame = dict(dataset[frame_index])
|
| 73 |
+
|
| 74 |
+
batch = preprocess(frame)
|
| 75 |
+
with torch.inference_mode():
|
| 76 |
+
pred_action = policy.select_action(frame)
|
| 77 |
+
# use your policy postprocess, this post process the action
|
| 78 |
+
# for instance unnormalize the actions, detokenize it etc..
|
| 79 |
+
pred_action = postprocess(pred_action)
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
## Training step (loss + backward)
|
| 84 |
+
|
| 85 |
+
If you’re training / fine-tuning, you typically call `forward(...)` to get a loss and then:
|
| 86 |
+
|
| 87 |
+
```python
|
| 88 |
+
policy.train()
|
| 89 |
+
batch = dict(dataset[0])
|
| 90 |
+
batch = preprocess(batch)
|
| 91 |
+
|
| 92 |
+
loss, outputs = policy.forward(batch)
|
| 93 |
+
loss.backward()
|
| 94 |
+
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
> Notes:
|
| 98 |
+
>
|
| 99 |
+
> - Some policies expose `policy(**batch)` or return a dict; keep this snippet aligned with the policy API.
|
| 100 |
+
> - Use your trainer script (`lerobot-train`) for full training loops.
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
## How to train / fine-tune
|
| 104 |
+
|
| 105 |
+
```bash
|
| 106 |
+
lerobot-train \
|
| 107 |
+
--dataset.repo_id=${HF_USER}/<dataset> \
|
| 108 |
+
--output_dir=./outputs/[RUN_NAME] \
|
| 109 |
+
--job_name=[RUN_NAME] \
|
| 110 |
+
--policy.repo_id=${HF_USER}/<desired_policy_repo_id> \
|
| 111 |
+
--policy.path=lerobot/[BASE_CHECKPOINT] \
|
| 112 |
+
--policy.dtype=bfloat16 \
|
| 113 |
+
--policy.device=cuda \
|
| 114 |
+
--steps=100000 \
|
| 115 |
+
--batch_size=4
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
Add policy-specific flags below:
|
| 119 |
+
|
| 120 |
+
- `-policy.chunk_size=...`
|
| 121 |
+
- `-policy.n_action_steps=...`
|
| 122 |
+
- `-policy.max_action_tokens=...`
|
| 123 |
+
- `-policy.gradient_checkpointing=true`
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
## Real-World Inference & Evaluation
|
| 127 |
+
|
| 128 |
+
You can use the `record` script from [**`lerobot-record`**](https://github.com/huggingface/lerobot/blob/main/src/lerobot/scripts/lerobot_record.py) with a policy checkpoint as input, to run inference and evaluate your policy.
|
| 129 |
+
|
| 130 |
+
For instance, run this command or API example to run inference and record 10 evaluation episodes:
|
| 131 |
+
|
| 132 |
+
```
|
| 133 |
+
lerobot-record \
|
| 134 |
+
--robot.type=so100_follower \
|
| 135 |
+
--robot.port=/dev/ttyACM1 \
|
| 136 |
+
--robot.cameras="{ up: {type: opencv, index_or_path: /dev/video10, width: 640, height: 480, fps: 30}, side: {type: intelrealsense, serial_number_or_name: 233522074606, width: 640, height: 480, fps: 30}}" \
|
| 137 |
+
--robot.id=my_awesome_follower_arm \
|
| 138 |
+
--display_data=false \
|
| 139 |
+
--dataset.repo_id=${HF_USER}/eval_so100 \
|
| 140 |
+
--dataset.single_task="Put lego brick into the transparent box" \
|
| 141 |
+
# <- Teleop optional if you want to teleoperate in between episodes \
|
| 142 |
+
# --teleop.type=so100_leader \
|
| 143 |
+
# --teleop.port=/dev/ttyACM0 \
|
| 144 |
+
# --teleop.id=my_awesome_leader_arm \
|
| 145 |
+
--policy.path=${HF_USER}/my_policy
|
| 146 |
+
```
|
collage_small.gif
ADDED
|
Git LFS Details
|
config.json
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"type": "smolvla",
|
| 3 |
+
"n_obs_steps": 1,
|
| 4 |
+
"input_features": {
|
| 5 |
+
"observation.state": {
|
| 6 |
+
"type": "STATE",
|
| 7 |
+
"shape": [
|
| 8 |
+
6
|
| 9 |
+
]
|
| 10 |
+
},
|
| 11 |
+
"observation.images.camera1": {
|
| 12 |
+
"type": "VISUAL",
|
| 13 |
+
"shape": [
|
| 14 |
+
3,
|
| 15 |
+
256,
|
| 16 |
+
256
|
| 17 |
+
]
|
| 18 |
+
},
|
| 19 |
+
"observation.images.camera2": {
|
| 20 |
+
"type": "VISUAL",
|
| 21 |
+
"shape": [
|
| 22 |
+
3,
|
| 23 |
+
256,
|
| 24 |
+
256
|
| 25 |
+
]
|
| 26 |
+
},
|
| 27 |
+
"observation.images.camera3": {
|
| 28 |
+
"type": "VISUAL",
|
| 29 |
+
"shape": [
|
| 30 |
+
3,
|
| 31 |
+
256,
|
| 32 |
+
256
|
| 33 |
+
]
|
| 34 |
+
}
|
| 35 |
+
},
|
| 36 |
+
"output_features": {
|
| 37 |
+
"action": {
|
| 38 |
+
"type": "ACTION",
|
| 39 |
+
"shape": [
|
| 40 |
+
6
|
| 41 |
+
]
|
| 42 |
+
}
|
| 43 |
+
},
|
| 44 |
+
"device": "cuda",
|
| 45 |
+
"use_amp": false,
|
| 46 |
+
"push_to_hub": true,
|
| 47 |
+
"repo_id": null,
|
| 48 |
+
"private": null,
|
| 49 |
+
"tags": null,
|
| 50 |
+
"license": null,
|
| 51 |
+
"chunk_size": 50,
|
| 52 |
+
"n_action_steps": 50,
|
| 53 |
+
"normalization_mapping": {
|
| 54 |
+
"VISUAL": "IDENTITY",
|
| 55 |
+
"STATE": "MEAN_STD",
|
| 56 |
+
"ACTION": "MEAN_STD"
|
| 57 |
+
},
|
| 58 |
+
"max_state_dim": 32,
|
| 59 |
+
"max_action_dim": 32,
|
| 60 |
+
"resize_imgs_with_padding": [
|
| 61 |
+
512,
|
| 62 |
+
512
|
| 63 |
+
],
|
| 64 |
+
"empty_cameras": 0,
|
| 65 |
+
"adapt_to_pi_aloha": false,
|
| 66 |
+
"use_delta_joint_actions_aloha": false,
|
| 67 |
+
"tokenizer_max_length": 48,
|
| 68 |
+
"num_steps": 10,
|
| 69 |
+
"use_cache": true,
|
| 70 |
+
"freeze_vision_encoder": true,
|
| 71 |
+
"train_expert_only": true,
|
| 72 |
+
"train_state_proj": true,
|
| 73 |
+
"optimizer_lr": 0.0001,
|
| 74 |
+
"optimizer_betas": [
|
| 75 |
+
0.9,
|
| 76 |
+
0.95
|
| 77 |
+
],
|
| 78 |
+
"optimizer_eps": 1e-08,
|
| 79 |
+
"optimizer_weight_decay": 1e-10,
|
| 80 |
+
"optimizer_grad_clip_norm": 10,
|
| 81 |
+
"scheduler_warmup_steps": 1000,
|
| 82 |
+
"scheduler_decay_steps": 30000,
|
| 83 |
+
"scheduler_decay_lr": 2.5e-06,
|
| 84 |
+
"vlm_model_name": "HuggingFaceTB/SmolVLM2-500M-Video-Instruct",
|
| 85 |
+
"load_vlm_weights": true,
|
| 86 |
+
"add_image_special_tokens": false,
|
| 87 |
+
"attention_mode": "cross_attn",
|
| 88 |
+
"prefix_length": 0,
|
| 89 |
+
"pad_language_to": "max_length",
|
| 90 |
+
"num_expert_layers": 0,
|
| 91 |
+
"num_vlm_layers": 16,
|
| 92 |
+
"self_attn_every_n_layers": 2,
|
| 93 |
+
"expert_width_multiplier": 0.75,
|
| 94 |
+
"min_period": 0.004,
|
| 95 |
+
"max_period": 4.0
|
| 96 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7cd549ac2351fb069c0ddb3c34ad2d09cfc92b56a15dccdfc2e41467aaca01eb
|
| 3 |
+
size 906712520
|
policy_postprocessor.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "policy_postprocessor",
|
| 3 |
+
"steps": [
|
| 4 |
+
{
|
| 5 |
+
"registry_name": "unnormalizer_processor",
|
| 6 |
+
"config": {
|
| 7 |
+
"eps": 1e-08,
|
| 8 |
+
"features": {
|
| 9 |
+
"action": {
|
| 10 |
+
"type": "ACTION",
|
| 11 |
+
"shape": [
|
| 12 |
+
6
|
| 13 |
+
]
|
| 14 |
+
}
|
| 15 |
+
},
|
| 16 |
+
"norm_map": {
|
| 17 |
+
"VISUAL": "IDENTITY",
|
| 18 |
+
"STATE": "MEAN_STD",
|
| 19 |
+
"ACTION": "MEAN_STD"
|
| 20 |
+
}
|
| 21 |
+
},
|
| 22 |
+
"state_file": "policy_postprocessor_step_0_unnormalizer_processor.safetensors"
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"registry_name": "device_processor",
|
| 26 |
+
"config": {
|
| 27 |
+
"device": "cpu",
|
| 28 |
+
"float_dtype": null
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
]
|
| 32 |
+
}
|
policy_postprocessor_step_0_unnormalizer_processor.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:490ab239d96e263687c0b2e386a0afbc235a2eceb9857c36ed32f2f162a3e7c8
|
| 3 |
+
size 640
|
policy_preprocessor.json
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "policy_preprocessor",
|
| 3 |
+
"steps": [
|
| 4 |
+
{
|
| 5 |
+
"registry_name": "rename_observations_processor",
|
| 6 |
+
"config": {
|
| 7 |
+
"rename_map": {}
|
| 8 |
+
}
|
| 9 |
+
},
|
| 10 |
+
{
|
| 11 |
+
"registry_name": "to_batch_processor",
|
| 12 |
+
"config": {}
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"registry_name": "smolvla_new_line_processor",
|
| 16 |
+
"config": {}
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"registry_name": "tokenizer_processor",
|
| 20 |
+
"config": {
|
| 21 |
+
"max_length": 48,
|
| 22 |
+
"task_key": "task",
|
| 23 |
+
"padding_side": "right",
|
| 24 |
+
"padding": "max_length",
|
| 25 |
+
"truncation": true,
|
| 26 |
+
"tokenizer_name": "HuggingFaceTB/SmolVLM2-500M-Video-Instruct"
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
"registry_name": "device_processor",
|
| 31 |
+
"config": {
|
| 32 |
+
"device": "cuda",
|
| 33 |
+
"float_dtype": null
|
| 34 |
+
}
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
"registry_name": "normalizer_processor",
|
| 38 |
+
"config": {
|
| 39 |
+
"eps": 1e-08,
|
| 40 |
+
"features": {
|
| 41 |
+
"observation.state": {
|
| 42 |
+
"type": "STATE",
|
| 43 |
+
"shape": [
|
| 44 |
+
6
|
| 45 |
+
]
|
| 46 |
+
},
|
| 47 |
+
"observation.image2": {
|
| 48 |
+
"type": "VISUAL",
|
| 49 |
+
"shape": [
|
| 50 |
+
3,
|
| 51 |
+
256,
|
| 52 |
+
256
|
| 53 |
+
]
|
| 54 |
+
},
|
| 55 |
+
"observation.image": {
|
| 56 |
+
"type": "VISUAL",
|
| 57 |
+
"shape": [
|
| 58 |
+
3,
|
| 59 |
+
256,
|
| 60 |
+
256
|
| 61 |
+
]
|
| 62 |
+
},
|
| 63 |
+
"observation.image3": {
|
| 64 |
+
"type": "VISUAL",
|
| 65 |
+
"shape": [
|
| 66 |
+
3,
|
| 67 |
+
256,
|
| 68 |
+
256
|
| 69 |
+
]
|
| 70 |
+
},
|
| 71 |
+
"action": {
|
| 72 |
+
"type": "ACTION",
|
| 73 |
+
"shape": [
|
| 74 |
+
6
|
| 75 |
+
]
|
| 76 |
+
}
|
| 77 |
+
},
|
| 78 |
+
"norm_map": {
|
| 79 |
+
"VISUAL": "IDENTITY",
|
| 80 |
+
"STATE": "MEAN_STD",
|
| 81 |
+
"ACTION": "MEAN_STD"
|
| 82 |
+
}
|
| 83 |
+
},
|
| 84 |
+
"state_file": "policy_preprocessor_step_5_normalizer_processor.safetensors"
|
| 85 |
+
}
|
| 86 |
+
]
|
| 87 |
+
}
|
policy_preprocessor_step_5_normalizer_processor.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:490ab239d96e263687c0b2e386a0afbc235a2eceb9857c36ed32f2f162a3e7c8
|
| 3 |
+
size 640
|