Update README.md
Browse files
README.md
CHANGED
|
@@ -26,4 +26,60 @@ export LEROBOT_HOME=/PATH/TO/LEROBOT_HOME
|
|
| 26 |
uv run scripts/serve_policy.py policy:checkpoint \
|
| 27 |
--policy.config=pi0_fast_bridge_fft_pt_tokenizer \
|
| 28 |
--policy.dir=$THE_MODEL_PATH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
```
|
|
|
|
| 26 |
uv run scripts/serve_policy.py policy:checkpoint \
|
| 27 |
--policy.config=pi0_fast_bridge_fft_pt_tokenizer \
|
| 28 |
--policy.dir=$THE_MODEL_PATH
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
### DataConfig
|
| 32 |
+
```python
|
| 33 |
+
@dataclasses.dataclass(frozen=True)
|
| 34 |
+
class LeRobotBridgeDataConfig(DataConfigFactory):
|
| 35 |
+
use_quantile_norm: bool = True
|
| 36 |
+
|
| 37 |
+
# Action keys that will be used to read the action sequence from the dataset.
|
| 38 |
+
action_sequence_keys: Sequence[str] = ("action",)
|
| 39 |
+
|
| 40 |
+
prompt_from_task: bool = True
|
| 41 |
+
|
| 42 |
+
@override
|
| 43 |
+
def create(self, assets_dirs: pathlib.Path, model_config: _model.BaseModelConfig) -> DataConfig:
|
| 44 |
+
# Make inputs look like they come from the Libero environment
|
| 45 |
+
repack_transform = _transforms.Group(
|
| 46 |
+
inputs=[
|
| 47 |
+
_transforms.RepackTransform(
|
| 48 |
+
{
|
| 49 |
+
"observation/primary_image": "observation.images.image_0",
|
| 50 |
+
# "observation/left_yellow_image": "observation.images.image_1",
|
| 51 |
+
# "observation/right_blue_image": "observation.images.image_2",
|
| 52 |
+
# "observation/wirst_image": "observation.images.image_3",
|
| 53 |
+
"observation/state": "observation.state",
|
| 54 |
+
"actions": "action",
|
| 55 |
+
"prompt": "prompt",
|
| 56 |
+
}
|
| 57 |
+
)
|
| 58 |
+
]
|
| 59 |
+
)
|
| 60 |
+
|
| 61 |
+
# Prepare data for policy training
|
| 62 |
+
# Convert images to uint8 numpy arrays, add masks
|
| 63 |
+
data_transforms = _transforms.Group(
|
| 64 |
+
inputs=[
|
| 65 |
+
bridge_policy.BridgeInputs(
|
| 66 |
+
action_dim=model_config.action_dim,
|
| 67 |
+
model_type=model_config.model_type,
|
| 68 |
+
)
|
| 69 |
+
],
|
| 70 |
+
outputs=[bridge_policy.BridgeOutputs()],
|
| 71 |
+
)
|
| 72 |
+
|
| 73 |
+
# Model transforms include things like tokenizing the prompt and action targets
|
| 74 |
+
model_transforms = ModelTransformFactory()(model_config)
|
| 75 |
+
|
| 76 |
+
return dataclasses.replace(
|
| 77 |
+
self.create_base_config(assets_dirs),
|
| 78 |
+
repack_transforms=repack_transform,
|
| 79 |
+
data_transforms=data_transforms,
|
| 80 |
+
model_transforms=model_transforms,
|
| 81 |
+
use_quantile_norm=self.use_quantile_norm,
|
| 82 |
+
action_sequence_keys=self.action_sequence_keys,
|
| 83 |
+
prompt_from_task=self.prompt_from_task,
|
| 84 |
+
)
|
| 85 |
```
|