peal.adaptors.projection_adaptor.ProjectionAdaptor¶
- class peal.adaptors.projection_adaptor.ProjectionAdaptor[source]¶
Bases:
AdaptorTraining-free repair: project dictionary components out of the classifier head.
- Parameters:
adaptor_config (
ProjectionAdaptorConfig) – SeeProjectionAdaptorConfig.base_diris created and the sparse dictionary is built immediately.- Variables:
config (
ProjectionAdaptorConfig)sparse_dictionary – Dictionary object returned by
get_sparse_dictionary.
Methods
Evaluate the predictor, install the projection hook and evaluate again.
- __init__(adaptor_config)[source]¶
Create
base_dirand instantiate the sparse dictionary.- Parameters:
adaptor_config (ProjectionAdaptorConfig)
- run()[source]¶
Evaluate the predictor, install the projection hook and evaluate again.
Loads
model.cplfrombase_model_config.model_path(either a picklednn.Moduleor a state dict that is loaded into a freshly builtModelTrainermodel), builds the dataloader ofconfig.partitionand prints overall, per-group, worst-group and average group accuracy (the latter always divides by 4). It then wraps the final linear layer (model.fcormodel.model.model.fc) withprojection_wrap_modeland prints the same statistics again.- Returns:
Results are only printed; the hook stays registered on the in-memory model and nothing is written to disk.
- Return type: