Skip to content

confidence_checks

allennlp.training.callbacks.confidence_checks

[SOURCE]


ConfidenceChecksCallback

@TrainerCallback.register("sanity_checks")
@TrainerCallback.register("confidence_checks")
class ConfidenceChecksCallback(TrainerCallback)

Performs model confidence checks.

Checks performed:

  • NormalizationBiasVerification for detecting invalid combinations of bias and normalization layers. See allennlp.confidence_checks.normalization_bias_verification for more details.

Note: Any new confidence checks should also be added to this callback.

on_start

class ConfidenceChecksCallback(TrainerCallback):
 | ...
 | def on_start(
 |     self,
 |     trainer: "GradientDescentTrainer",
 |     is_primary: bool = True,
 |     **kwargs
 | ) -> None

on_batch

class ConfidenceChecksCallback(TrainerCallback):
 | ...
 | def on_batch(
 |     self,
 |     trainer: "GradientDescentTrainer",
 |     batch_inputs: List[TensorDict],
 |     batch_outputs: List[Dict[str, Any]],
 |     batch_metrics: Dict[str, Any],
 |     epoch: int,
 |     batch_number: int,
 |     is_training: bool,
 |     is_primary: bool = True,
 |     batch_grad_norm: Optional[float] = None,
 |     **kwargs
 | ) -> None

ConfidenceCheckError

class ConfidenceCheckError(Exception):
 | def __init__(self, message) -> None

The error type raised when a confidence check fails.