pipeline
pipeline
¶
Encoding pipeline for multi-modal observation encoding and fusion.
EncodingPipeline
¶
Bases: Module
Pipeline that encodes inputs and fuses them hierarchically.
All encoder outputs and fusion outputs are available in the final feature dictionary — nothing is consumed or removed.
Initialize the encoding pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
encoders
|
dict[str, EncodingMixin]
|
Dictionary of instantiated encoders keyed by name. |
required |
observation_space
|
ObservationSpace
|
Observation space with task metadata. |
required |
fusion_stages
|
list[FusionModule] | None
|
List of instantiated fusion modules. |
None
|
Source code in src/versatil/models/encoding/pipeline.py
set_output_dtype
¶
Pin the dtype of features emitted by forward.
Called once by the workspace after Hydra instantiation, with the
pipeline-wide precision (experiment.precision).
Source code in src/versatil/models/encoding/pipeline.py
forward
¶
Encode observations through all encoders and apply fusion stages.
Runs non-conditional encoders first, then conditional encoders (which may depend on earlier outputs as conditioning), then fusion modules. All outputs are kept in the returned dictionary. Encoders whose input keys are missing from the observation are skipped with a warning.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
dict[str, Tensor]
|
Dictionary mapping observation keys to tensors. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Tensor]
|
Dictionary mapping prefixed feature names to tensors. Includes all |
dict[str, Tensor]
|
encoder outputs and all fusion outputs. |
Source code in src/versatil/models/encoding/pipeline.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | |
get_feature_names
¶
get_features
¶
get_features_to_dimensions
¶
Get a dictionary of feature names to dimensions.
set_tokenizer
¶
Set tokenizer and validate vocab sizes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tokenizer
|
Tokenizer | None
|
Tokenizer instance from data pipeline (can be None). |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If observation tokenizer vocab size doesn't match encoder vocab sizes. |
Source code in src/versatil/models/encoding/pipeline.py
__repr__
¶
Pretty print the pipeline structure.