base
base
¶
Base checkpoint loader with shared config, tokenizer, and metadata access.
BaseCheckpointLoader
¶
Base class for policy checkpoint loaders.
Handles configuration loading, tokenizer setup, and provides shared property accessors for observation/action spaces, horizons, denoising thresholds, and depth clamp ranges.
Subclasses implement concrete checkpoint restoration.
Initialize the base checkpoint loader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
device
|
device
|
Device to load the model onto. |
required |
checkpoint_path
|
str
|
Path to the checkpoint directory. |
required |
Source code in src/versatil/checkpoint_loading/base.py
denoising_thresholds
property
¶
Get denoising thresholds filtered to predicted action keys only.
Returns:
| Type | Description |
|---|---|
dict[str, float]
|
Dict mapping VersatIL action key to threshold. Empty if none set. |
depth_clamp_ranges
property
¶
Get per-camera depth clamping ranges from normalizer statistics.
Returns:
| Type | Description |
|---|---|
dict[str, tuple[float, float]]
|
Mapping from depth camera key to its (min, max) clamping range; |
dict[str, tuple[float, float]]
|
cameras without normalizer statistics are omitted. |
strip_compiled_prefixes
¶
Remove torch.compile module prefixes from checkpoint keys.
Checkpoints saved from a compiled policy carry _orig_mod. segments in
their state-dict keys; loading them into an uncompiled module would
silently skip every affected weight under strict=False.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state_dict
|
dict[str, Tensor]
|
Checkpoint state dict, possibly from a compiled module. |
required |
Source code in src/versatil/checkpoint_loading/base.py
versatil_checkpoint_safe_globals
¶
Classes trusted when unpickling checkpoints with weights_only=True.
Lightning checkpoints embed the hyperparameters saved by
save_hyperparameters, which for VersatIL are config dataclasses.
Allowlisting exactly those classes keeps third-party checkpoints from
executing arbitrary pickled code while our own checkpoints load.