export
export
¶
Model export utilities for post-training compression.
export_policy
¶
Export an ExportablePolicy with dynamic batch dimension.
Runs one eager forward pass before tracing to materialize any lazily-initialized modules (e.g. FeatureProjection layers). torch.export's FX tracer silently drops nn.ModuleDict mutations, so all projection layers must exist before tracing begins.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exportable
|
ExportablePolicy
|
The ExportablePolicy wrapping the policy. |
required |
example_inputs
|
tuple[Tensor, ...]
|
Example input tensors for tracing. |
required |
Returns:
| Type | Description |
|---|---|
Module
|
Exported FX GraphModule. |
Source code in src/versatil/post_training_compression/export.py
build_example_inputs
¶
Build example inputs from observation space metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exportable
|
ExportablePolicy
|
ExportablePolicy defining required observation keys. |
required |
observation_space
|
ObservationSpace
|
Observation space with camera/proprio metadata. |
required |
observation_horizon
|
int
|
Number of temporal observation frames. |
required |
tokenizer
|
Tokenizer | None
|
Tokenizer for language token sequence length. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Tensor, ...]
|
Tuple of example input tensors matching exportable.observation_keys. |