jadechoghari commited on
Commit
f60504c
·
verified ·
1 Parent(s): f4eeeeb

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +121 -33
README.md CHANGED
@@ -1,62 +1,150 @@
1
  ---
2
- datasets: unknown
 
3
  library_name: lerobot
4
- license: apache-2.0
5
- model_name: xvla
6
  pipeline_tag: robotics
7
  tags:
8
- - xvla
9
- - robotics
10
  - lerobot
 
 
11
  ---
12
 
13
- # Model Card for xvla
14
 
15
- <!-- Provide a quick summary of what the model is/does. -->
16
 
 
17
 
18
- _Model type not recognized please update this template._
 
 
19
 
20
 
21
- This policy has been trained and pushed to the Hub using [LeRobot](https://github.com/huggingface/lerobot).
22
- See the full documentation at [LeRobot Docs](https://huggingface.co/docs/lerobot/index).
23
 
24
- ---
 
 
 
 
25
 
26
- ## How to Get Started with the Model
27
 
28
- For a complete walkthrough, see the [training guide](https://huggingface.co/docs/lerobot/il_robots#train-a-policy).
29
- Below is the short version on how to train and run inference/eval:
30
 
31
- ### Train from scratch
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  ```bash
34
  lerobot-train \
35
  --dataset.repo_id=${HF_USER}/<dataset> \
36
- --policy.type=act \
37
- --output_dir=outputs/train/<desired_policy_repo_id> \
38
- --job_name=lerobot_training \
 
 
39
  --policy.device=cuda \
40
- --policy.repo_id=${HF_USER}/<desired_policy_repo_id>
41
- --wandb.enable=true
42
  ```
43
 
44
- _Writes checkpoints to `outputs/train/<desired_policy_repo_id>/checkpoints/`._
45
 
46
- ### Evaluate the policy/run inference
 
 
 
47
 
48
- ```bash
49
- lerobot-record \
50
- --robot.type=so100_follower \
51
- --dataset.repo_id=<hf_user>/eval_<dataset> \
52
- --policy.path=<hf_user>/<desired_policy_repo_id> \
53
- --episodes=10
54
- ```
55
 
56
- Prefix the dataset repo with **eval\_** and supply `--policy.path` pointing to a local or hub checkpoint.
57
 
58
- ---
59
 
60
- ## Model Details
61
 
62
- - **License:** apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ license: apache-2.0
12
  ---
13
 
14
+ # X-VLA (LeRobot)
15
 
16
+ X-VLA is a Vision-Language-Action foundation model that uses soft prompts to handle cross-embodiment and cross-domain robot control within a unified Transformer architecture.
17
 
18
+ Checkpoint adapted for Google Robot platforms.
19
 
20
+ **Original paper:** [X-VLA: Soft-Prompted Transformer as Scalable Cross-Embodiment Vision-Language-Action Model](https://arxiv.org/abs/2510.10274)
21
+ **Reference implementation:** https://github.com/2toinf/X-VLA
22
+ **LeRobot implementation:** Follows the original reference code for compatibility.
23
 
24
 
25
+ ## Model description
 
26
 
27
+ - **Inputs:** images (multi-view), proprio/state, optional language instruction
28
+ - **Outputs:** continuous actions
29
+ - **Training objective:** flow matching
30
+ - **Action representation:** continuous
31
+ - **Intended use:** Base model to fine tune on your specific use case
32
 
 
33
 
34
+ ## Quick start (inference on a real batch)
 
35
 
36
+ ### Installation
37
+
38
+ ```bash
39
+ pip install "lerobot[xvla]"
40
+ ```
41
+ For full installation details (including optional video dependencies such as ffmpeg for torchcodec), see the official documentation: https://huggingface.co/docs/lerobot/installation
42
+
43
+ ### Load model + dataset, run `select_action`
44
+
45
+ ```python
46
+ import torch
47
+ from lerobot.datasets.lerobot_dataset import LeRobotDataset
48
+ from lerobot.policies.factory import make_pre_post_processors
49
+
50
+ # Swap this import per-policy
51
+ from lerobot.policies.xvla.modeling_xvla import XVLAPolicy
52
+
53
+ # load a policy
54
+ model_id = "lerobot/xvla-google-robot" # <- swap checkpoint
55
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
56
+
57
+ policy = XVLAPolicy.from_pretrained(model_id).to(device).eval()
58
+
59
+ preprocess, postprocess = make_pre_post_processors(
60
+ policy.config,
61
+ model_id,
62
+ preprocessor_overrides={"device_processor": {"device": str(device)}},
63
+ )
64
+ # load a lerobotdataset (we will replace with a simpler dataset)
65
+ dataset = LeRobotDataset("lerobot/libero")
66
+
67
+ # pick an episode
68
+ episode_index = 0
69
+
70
+ # each episode corresponds to a contiguous range of frame indices
71
+ from_idx = dataset.meta.episodes["dataset_from_index"][episode_index]
72
+ to_idx = dataset.meta.episodes["dataset_to_index"][episode_index]
73
+
74
+ # get a single frame from that episode (e.g. the first frame)
75
+ frame_index = from_idx
76
+ frame = dict(dataset[frame_index])
77
+
78
+ batch = preprocess(frame)
79
+ with torch.inference_mode():
80
+ pred_action = policy.select_action(batch)
81
+ # use your policy postprocess, this post process the action
82
+ # for instance unnormalize the actions, detokenize it etc..
83
+ pred_action = postprocess(pred_action)
84
+ ```
85
+
86
+
87
+ ## Training step (loss + backward)
88
+
89
+ If you’re training / fine-tuning, you typically call `forward(...)` to get a loss and then:
90
+
91
+ ```python
92
+ policy.train()
93
+ batch = dict(dataset[0])
94
+ batch = preprocess(batch)
95
+
96
+ loss, outputs = policy.forward(batch)
97
+ loss.backward()
98
+
99
+ ```
100
+
101
+ > Notes:
102
+ >
103
+ > - Some policies expose `policy(**batch)` or return a dict; keep this snippet aligned with the policy API.
104
+ > - Use your trainer script (`lerobot-train`) for full training loops.
105
+
106
+
107
+ ## How to train / fine-tune
108
 
109
  ```bash
110
  lerobot-train \
111
  --dataset.repo_id=${HF_USER}/<dataset> \
112
+ --output_dir=./outputs/[RUN_NAME] \
113
+ --job_name=[RUN_NAME] \
114
+ --policy.repo_id=${HF_USER}/<desired_policy_repo_id> \
115
+ --policy.path=lerobot/[BASE_CHECKPOINT] \
116
+ --policy.dtype=bfloat16 \
117
  --policy.device=cuda \
118
+ --steps=100000 \
119
+ --batch_size=4
120
  ```
121
 
122
+ Add policy-specific flags below:
123
 
124
+ - `-policy.chunk_size=...`
125
+ - `-policy.n_action_steps=...`
126
+ - `-policy.max_action_tokens=...`
127
+ - `-policy.gradient_checkpointing=true`
128
 
 
 
 
 
 
 
 
129
 
130
+ ## Real-World Inference & Evaluation
131
 
132
+ 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.
133
 
134
+ For instance, run this command or API example to run inference and record 10 evaluation episodes:
135
 
136
+ ```
137
+ lerobot-record \
138
+ --robot.type=so100_follower \
139
+ --robot.port=/dev/ttyACM1 \
140
+ --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}}" \
141
+ --robot.id=my_awesome_follower_arm \
142
+ --display_data=false \
143
+ --dataset.repo_id=${HF_USER}/eval_so100 \
144
+ --dataset.single_task="Put lego brick into the transparent box" \
145
+ # <- Teleop optional if you want to teleoperate in between episodes \
146
+ # --teleop.type=so100_leader \
147
+ # --teleop.port=/dev/ttyACM0 \
148
+ # --teleop.id=my_awesome_leader_arm \
149
+ --policy.path=${HF_USER}/my_policy
150
+ ```