Ablation activations
auto_circuit.utils.ablation_activations
Attributes
Classes
Functions
batch_src_ablations
batch_src_ablations(model: PatchableModel, dataloader: PromptDataLoader, ablation_type: AblationType = AblationType.RESAMPLE, clean_corrupt: Optional[Literal['clean', 'corrupt']] = None) -> Dict[BatchKey, Tensor]
Wrapper of src_ablations
that returns ablations for each batch in a dataloader.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
PatchableModel
|
The model to get the ablations for. |
required |
dataloader |
PromptDataLoader
|
The input data to get the ablations for. |
required |
ablation_type |
AblationType
|
The type of ablation to perform. |
RESAMPLE
|
clean_corrupt |
Optional[Literal['clean', 'corrupt']]
|
Whether to use the clean or corrupt inputs to calculate the ablations. |
None
|
Returns:
Type | Description |
---|---|
Dict[BatchKey, Tensor]
|
Source code in auto_circuit/utils/ablation_activations.py
src_ablations
src_ablations(model: PatchableModel, sample: Tensor | PromptDataLoader, ablation_type: AblationType = AblationType.RESAMPLE) -> Tensor
Get the activations used to ablate each Edge
in a
model, given a particular set of model inputs and an ablation type. See
AblationType
for the different types of
ablations that can be computed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
PatchableModel
|
The model to get the ablations for. |
required |
sample |
Tensor | PromptDataLoader
|
The data sample to get the ablations for. This is not used for all
|
required |
ablation_type |
AblationType
|
The type of ablation to perform. |
RESAMPLE
|
Returns:
Type | Description |
---|---|
Tensor
|