compressed_runtime
compressed_runtime
¶
Compressed policy inference runtime.
CompressedPolicyRuntime
¶
Bases: PolicyRuntime
Inference runtime for compressed policy checkpoints.
Initialize the compressed policy runtime.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
device
|
device
|
Device to load the model onto. |
required |
checkpoint_path
|
str
|
Path to the compressed checkpoint directory
containing compression_metadata.json, the model artifact
(Torch Export |
required |
compile_model
|
bool
|
Whether to compile the model with torch.compile before inference. For PT2E models on CPU this enables inductor int8 kernel fusion and is essential for performance. For other workflows it applies standard inductor compilation. |
True
|
Source code in src/versatil/inference/policy_runtime/compressed_runtime.py
run_inference
¶
Run compressed policy inference with normalization.
Normalizes observations, optionally tokenizes, converts to positional tensors, runs the compressed model, and converts output back to an unnormalized action dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obs_dict
|
dict[str, Tensor]
|
Observation dictionary for the policy. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Tensor]
|
Unnormalized action dictionary. |