pi0
pi0
¶
Pi0/Pi0.5 interleaved VLM-expert decoder with joint attention.
References
Pi0: https://github.com/Physical-Intelligence/openpi
Pi0Decoder
¶
Pi0Decoder(input_keys, action_space, action_heads, observation_space, observation_horizon, prediction_horizon, device, vlm_backbone, expert_hidden_size, expert_intermediate_size, expert_number_of_heads, expert_number_of_key_value_heads, expert_number_of_layers, expert_head_dimension, time_conditioning=value, min_period=0.004, max_period=4.0, proprioceptive_feature_key=None, normalization_type=value, activation=value, dropout=0.0)
Bases: BaseInterleavedVLMDecoder
Pi0/Pi0.5 decoder with pretrained VLM backbone and learned action expert.
Each VLM layer is paired 1:1 with an expert layer via joint self-attention. Pi0 variant fuses timestep into action tokens via MLP before the expert layers. Pi0.5 variant modulates each expert layer via adaptive normalization.
Initialize Pi0 decoder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_keys
|
list[str]
|
Feature keys from the encoding pipeline. |
required |
action_space
|
ActionSpace
|
Action space configuration. |
required |
action_heads
|
dict[str, ActionHead]
|
Exactly one joint action prediction head. |
required |
observation_space
|
ObservationSpace
|
Observation space configuration. |
required |
observation_horizon
|
int
|
Number of observation timesteps. |
required |
prediction_horizon
|
int
|
Number of action steps to predict. |
required |
device
|
str
|
Device string. |
required |
vlm_backbone
|
GenerativeVLM
|
Generative VLM backbone that builds the raw
observation prefix with shape |
required |
expert_hidden_size
|
int
|
Expert network hidden dimension. |
required |
expert_intermediate_size
|
int
|
Expert feedforward intermediate dimension. |
required |
expert_number_of_heads
|
int
|
Number of attention heads in expert layers. |
required |
expert_number_of_key_value_heads
|
int
|
Number of K/V heads in expert layers. |
required |
expert_number_of_layers
|
int
|
Number of expert layers (must match VLM layers). |
required |
expert_head_dimension
|
int
|
Per-head dimension in expert layers. |
required |
time_conditioning
|
str
|
Timestep conditioning mode (use TimeConditioning enum values). |
value
|
min_period
|
float
|
Minimum period for sinusoidal timestep embedding. |
0.004
|
max_period
|
float
|
Maximum period for sinusoidal timestep embedding. |
4.0
|
proprioceptive_feature_key
|
str | None
|
Feature key for proprioceptive state. When set, the feature is prepended to the VLM prefix. |
None
|
normalization_type
|
str
|
Normalization layer type. |
value
|
activation
|
str
|
Activation function for expert feedforward layers. |
value
|
dropout
|
float
|
Dropout rate. |
0.0
|
Source code in src/versatil/models/decoding/decoders/factory/pi0.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
build_action_expert
¶
Reference pretrained VLM layers and create expert layers.
Note
This is called by BaseInterleavedVLMDecoder.set_vlm_backbone()
after the full VLM backbone is attached.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vlm_layers
|
ModuleList
|
VLM transformer layers (referenced directly, not copied). |
required |
rotary_emb
|
Module
|
VLM rotary positional encoding module. |
required |
vlm_hidden_dimension
|
int
|
VLM hidden dimension. |
required |
vlm_text_config
|
PretrainedConfig
|
VLM text model config. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If VLM and expert layer counts don't match. |
Source code in src/versatil/models/decoding/decoders/factory/pi0.py
forward
¶
Forward pass through interleaved VLM + expert layers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
dict[str, Tensor]
|
Encoded observation features from the encoding pipeline. |
required |
actions
|
dict[str, Tensor] | None
|
Noisy action tensors keyed by action name. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Tensor]
|
Predicted action tensors keyed by action name. |