Skip to content

explainability

explainability

Hydra configuration for the explain endpoint.

ExplanationWriterConfig dataclass

ExplanationWriterConfig(save_raw_heatmaps=False, save_overlays=True, image_weight=0.5, overlay_image_format='png')

Settings for how explanations are written to disk.

Attributes:

Name Type Description
save_raw_heatmaps bool

Whether raw heatmap tensors are saved.

save_overlays bool

Whether overlay images are rendered and saved.

image_weight float

Blend weight of the camera image in overlays.

overlay_image_format str

Overlay image file extension without a dot.

ExplainabilityConfig dataclass

ExplainabilityConfig(_target_='versatil.explainability.runner.ExplainabilityRunner', checkpoint_path=MISSING, checkpoint_name=value, output_directory=None, device='auto', source=value, split='all', sample_stride=50, max_samples=None, data_path_override=None, batch_size=1, explanation_types=(lambda: list(VALID_EXPLANATION_TYPES))(), target_camera_keys=None, target_vision_module_names=None, channel_batch_size=32, online=InferenceClientConfig(), writer=ExplanationWriterConfig())

Hydra config for generating xAI insights on policy predictions.

Attributes:

Name Type Description
_target_ str

Import path instantiated by Hydra.

checkpoint_path str

Directory containing the checkpoint, config, and normalizer/tokenizer files used to restore the policy.

checkpoint_name str

Checkpoint filename inside checkpoint_path.

output_directory str | None

Optional directory for written explanation files. When None, outputs are written under checkpoint_path/explainability with a timestamped subdirectory.

device str

Torch device for attribution, or auto to prefer CUDA when available.

source str

Explanation source. dataset samples offline episodic windows from the checkpoint schema or data_path_override; online_inference starts the same inference client loop used by the test endpoint and explains ready observation windows before action prediction.

split str

Dataset split for offline explanations: train, val, or all.

sample_stride int

Explanation interval. In offline dataset mode, keep every Nth episodic dataset sample. In online inference mode, explain every Nth inference timestep.

max_samples int | None

Optional cap on the number of observation windows to explain. Offline mode applies the cap after sample_stride. Online mode applies it to ready inference windows and derives the inference-loop step budget from sample_stride.

data_path_override str | list[str] | None

Optional offline input location to explain instead of the data path stored in the checkpoint task config. None keeps the checkpoint's original task.dataset_schema paths. A single path ending in .zarr is treated as an existing replay buffer and sampled directly. A non-zarr path is treated as raw data in the same schema format as the checkpoint, for example a CSV episode-folder root, an HDF5 file, or a LeRobot dataset root. A list is only for raw schemas that already support multiple raw inputs, such as CSV dataset_folders or HDF5 hdf5_paths; multiple zarr paths are not supported. Raw overrides are converted to offline_dataset.zarr beside the first override path before episodic windows are sampled.

batch_size int

Number of sampled windows explained per attribution call.

explanation_types list[str]

Visual attribution methods to run. gradcam handles both CNN feature maps and ViT patch-token maps internally.

target_camera_keys list[str] | None

Optional camera-key allowlist. None explains all cameras exposed by visual modules.

target_vision_module_names list[str] | None

Optional visual module allowlist. Names include encoding-pipeline entries and decoder-owned VLM vision tower paths.

channel_batch_size int

Number of feature channels ablated per forward pass for Ablation-CAM.

online InferenceClientConfig

Socket inference client settings for the online source, nested under the online key (e.g. online.model_server_address, online.compression_type). See InferenceClientConfig.

writer ExplanationWriterConfig

Explanation writer settings, nested under the writer key (e.g. writer.save_raw_heatmaps, writer.image_weight). See ExplanationWriterConfig.