Skip to content

verification_base

allennlp.confidence_checks.verification_base

[SOURCE]


Code based almost entirely on https://github.com/awaelchli/pytorch-lightning-snippets/commit/7db53f774715d635c59ef56f21a17634d246b2c5

VerificationBase

class VerificationBase:
 | def __init__(self, model: nn.Module)

Base class for model verification. All verifications should run with any torch.nn.Module unless otherwise stated.

check

class VerificationBase:
 | ...
 | @abstractmethod
 | def check(self, *args, **kwargs) -> bool

Runs the actual test on the model. All verification classes must implement this. Arguments: args: Any positional arguments that are needed to run the test kwargs: Keyword arguments that are needed to run the test Returns: True if the test passes, and False otherwise. Some verifications can only be performed with a heuristic accuracy, thus the return value may not always reflect the true state of the system in these cases.