Skip to content

compressed_policy

compressed_policy

Restore a policy checkpoint after post-training-compression, along with its metadata.

CompressedCheckpointLoader

CompressedCheckpointLoader(device, checkpoint_path)

Bases: BaseCheckpointLoader

Restore compressed policy checkpoint state.

Initialize and restore compressed checkpoint state.

Source code in src/versatil/checkpoint_loading/compressed_policy.py
def __init__(
    self,
    device: torch.device,
    checkpoint_path: str,
) -> None:
    """Initialize and restore compressed checkpoint state."""
    super().__init__(device=device, checkpoint_path=checkpoint_path)
    self._input_keys: list[str] = []
    self._output_keys: list[str] = []
    self._metadata: dict[str, Any] = {}
    self._artifact_format = ArtifactFormat.TORCH_EXPORT_PT2.value
    self._normalizer: LinearNormalizer = LinearNormalizer()
    self._model_path = ""
    self._workflow: str | None = None
    self._load_compressed_checkpoint()

input_keys property

input_keys

Get the input key ordering from metadata.

output_keys property

output_keys

Get the output key ordering from metadata.

artifact_format property

artifact_format

Get the serialized artifact format.

metadata property

metadata

Get the loaded compression metadata.

model_path property

model_path

Get the compressed model artifact path.

normalizer property

normalizer

Get the compressed model normalizer.

workflow property

workflow

Get the serialized quantization workflow.

depth_clamp_ranges property

depth_clamp_ranges

Get per-camera depth clamping ranges from the compressed normalizer.