jadechoghari commited on
Commit
45dcc8f
·
verified ·
1 Parent(s): 982c019

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +116 -48
README.md CHANGED
@@ -1,77 +1,145 @@
1
  ---
2
- datasets: HuggingFaceVLA/libero
 
3
  library_name: lerobot
4
- license: apache-2.0
5
- model_name: pi0
6
  pipeline_tag: robotics
7
  tags:
8
- - pi0
9
- - robotics
10
  - lerobot
 
 
 
 
 
 
11
  ---
12
 
13
- # Model Card for pi0
14
 
15
- <!-- Provide a quick summary of what the model is/does. -->
16
 
 
17
 
18
- # π (Pi0) Libero Finetuned
 
 
19
 
20
- This model which come from the Pytorch conversion script of openpi and their `pi0_libero` model, has been finetuned on libero dataset.
21
 
22
- π₀ is a **Vision-Language-Action model for general robot control**, from Physical Intelligence. The LeRobot implementation is adapted from their open source [OpenPI](https://github.com/Physical-Intelligence/openpi) repository.
23
 
24
- ## Model Overview
 
 
 
 
25
 
26
- π₀ represents a breakthrough in robotics as the first general-purpose robot foundation model developed by [Physical Intelligence](https://www.physicalintelligence.company/blog/pi0). Unlike traditional robots that are narrow specialists programmed for repetitive motions, π₀ is designed to be a generalist policy that can understand visual inputs, interpret natural language instructions, and control a variety of different robots across diverse tasks.
27
 
28
- ### Architecture and Approach
29
 
30
- π₀ combines several key innovations:
31
 
32
- - **Flow Matching**: Uses a novel method to augment pre-trained VLMs with continuous action outputs via flow matching (a variant of diffusion models)
33
- - **Cross-Embodiment Training**: Trained on data from 8 distinct robot platforms including UR5e, Bimanual UR5e, Franka, Bimanual Trossen, Bimanual ARX, Mobile Trossen, and Mobile Fibocom
34
- - **Internet-Scale Pre-training**: Inherits semantic knowledge from a pre-trained 3B parameter Vision-Language Model
35
- - **High-Frequency Control**: Outputs motor commands at up to 50 Hz for real-time dexterous manipulation
36
 
37
- ## Training
38
 
39
- For training π₀, you can use the standard LeRobot training script with the appropriate configuration:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
- ```bash
42
- python src/lerobot/scripts/train.py \
43
- --dataset.repo_id=your_dataset \
44
- --policy.type=pi0 \
45
- --output_dir=./outputs/pi0_training \
46
- --job_name=pi0_training \
47
- --policy.pretrained_path=lerobot/pi0_libero_finetuned \
48
- --policy.repo_id=your_repo_id \
49
- --policy.compile_model=true \
50
- --policy.gradient_checkpointing=true \
51
- --policy.dtype=bfloat16 \
52
- --steps=3000 \
53
- --policy.scheduler_decay_steps=3000 \
54
- --policy.device=cuda \
55
- --batch_size=32
56
  ```
57
 
58
- ## Citation
 
 
 
59
 
60
- If you use this model, please cite the original OpenPI work:
61
 
62
- ```bibtex
63
- @article{openpi2024,
64
- title={Open-World Robotic Manipulation with Vision-Language-Action Models},
65
- author={Physical Intelligence},
66
- year={2024},
67
- url={https://github.com/Physical-Intelligence/openpi}
68
- }
 
 
 
 
 
 
69
  ```
70
 
71
- ## Original Repository
 
 
 
 
 
72
 
73
- [OpenPI GitHub Repository](https://github.com/Physical-Intelligence/openpi)
74
 
75
- ## License
76
 
77
- This model follows the same license as the original OpenPI repository.
 
 
 
 
 
 
 
 
 
 
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: gemma
12
+ datasets:
13
+ - HuggingFaceVLA/libero
14
+ base_model:
15
+ - lerobot/pi0_libero_base
16
  ---
17
 
18
+ # π₀ (Pi0) (LeRobot)
19
 
20
+ π₀ is a Vision-Language-Action (VLA) foundation model from Physical Intelligence that jointly reasons over vision, language, and actions to control robots, serving as the base architecture that later enabled π₀.₅’s open-world generalization.
21
 
22
+ Checkpoint trained and evaluated on LIBERO tasks.
23
 
24
+ **Original paper:** π0: A Vision-Language-Action Flow Model for General Robot Controlion
25
+ **Reference implementation:** https://github.com/Physical-Intelligence/openpi
26
+ **LeRobot implementation:** Follows the original reference code for compatibility.
27
 
 
28
 
29
+ ## Model description
30
 
31
+ - **Inputs:** images (multi-view), proprio/state, optional language instruction
32
+ - **Outputs:** continuous actions
33
+ - **Training objective:** flow matching
34
+ - **Action representation:** continuous
35
+ - **Intended use:** Base model to fine tune on your specific use case
36
 
 
37
 
38
+ ## Quick start (inference on a real batch)
39
 
40
+ ### Installation
41
 
42
+ ```bash
43
+ pip install "lerobot[pi]@git+https://github.com/huggingface/lerobot.git"
44
+ ```
45
+ For full installation details (including optional video dependencies such as ffmpeg for torchcodec), see the official documentation: https://huggingface.co/docs/lerobot/installation
46
 
47
+ ### Load model + dataset, run `select_action`
48
 
49
+ ```python
50
+ import torch
51
+ from lerobot.datasets.lerobot_dataset import LeRobotDataset
52
+ from lerobot.policies.factory import make_pre_post_processors
53
+
54
+ # Swap this import per-policy
55
+ from lerobot.policies.pi0 import PI0Policy
56
+
57
+ # load a policy
58
+ model_id = "lerobot/pi0_libero_finetuned" # <- swap checkpoint
59
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
60
+
61
+ policy = PI0Policy.from_pretrained(model_id).to(device).eval()
62
+
63
+ preprocess, postprocess = make_pre_post_processors(
64
+ policy.config,
65
+ model_id,
66
+ preprocessor_overrides={"device_processor": {"device": str(device)}},
67
+ )
68
+ # load a lerobotdataset
69
+ dataset = LeRobotDataset("lerobot/libero")
70
+
71
+ # pick an episode
72
+ episode_index = 0
73
+
74
+ # each episode corresponds to a contiguous range of frame indices
75
+ from_idx = dataset.meta.episodes["dataset_from_index"][episode_index]
76
+ to_idx = dataset.meta.episodes["dataset_to_index"][episode_index]
77
+
78
+ # get a single frame from that episode (e.g. the first frame)
79
+ frame_index = from_idx
80
+ frame = dict(dataset[frame_index])
81
+
82
+ batch = preprocess(frame)
83
+ with torch.inference_mode():
84
+ pred_action = policy.select_action(frame)
85
+ # use your policy postprocess, this post process the action
86
+ # for instance unnormalize the actions, detokenize it etc..
87
+ pred_action = postprocess(pred_action)
88
+ ```
89
+
90
+
91
+ ## Training step (loss + backward)
92
+
93
+ If you’re training / fine-tuning, you typically call `forward(...)` to get a loss and then:
94
+
95
+ ```python
96
+ policy.train()
97
+ batch = dict(dataset[0])
98
+ batch = preprocess(batch)
99
+
100
+ loss, outputs = policy.forward(batch)
101
+ loss.backward()
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  ```
104
 
105
+ > Notes:
106
+ >
107
+ > - Some policies expose `policy(**batch)` or return a dict; keep this snippet aligned with the policy API.
108
+ > - Use your trainer script (`lerobot-train`) for full training loops.
109
 
 
110
 
111
+ ## How to train / fine-tune
112
+
113
+ ```bash
114
+ lerobot-train \
115
+ --dataset.repo_id=${HF_USER}/<dataset> \
116
+ --output_dir=./outputs/[RUN_NAME] \
117
+ --job_name=[RUN_NAME] \
118
+ --policy.repo_id=${HF_USER}/<desired_policy_repo_id> \
119
+ --policy.path=lerobot/[BASE_CHECKPOINT] \
120
+ --policy.dtype=bfloat16 \
121
+ --policy.device=cuda \
122
+ --steps=100000 \
123
+ --batch_size=4
124
  ```
125
 
126
+ Add policy-specific flags below:
127
+
128
+ - `-policy.chunk_size=...`
129
+ - `-policy.n_action_steps=...`
130
+ - `-policy.max_action_tokens=...`
131
+ - `-policy.gradient_checkpointing=true`
132
 
 
133
 
134
+ ## Evaluate in Simulation (LIBERO)
135
 
136
+ You can evaluate the model in Libero environment.
137
+
138
+ ```bash
139
+ lerobot-eval \
140
+ --policy.path=lerobot/pi0_libero_finetuned \
141
+ --env.type=libero \
142
+ --env.task=libero_object \
143
+ --eval.batch_size=1 \
144
+ --eval.n_episodes=20
145
+ ```