Skip to content

checks

allennlp.common.checks

[SOURCE]


Functions and exceptions for checking that AllenNLP and its models are configured correctly.

ConfigurationError

class ConfigurationError(Exception):
 | def __init__(self, message: str)

The exception raised by any AllenNLP object when it's misconfigured (e.g. missing properties, invalid properties, unknown properties).

ExperimentalFeatureWarning

class ExperimentalFeatureWarning(RuntimeWarning)

A warning that you are using an experimental feature that may change or be deleted.

log_pytorch_version_info

def log_pytorch_version_info()

check_dimensions_match

def check_dimensions_match(
    dimension_1: int,
    dimension_2: int,
    dim_1_name: str,
    dim_2_name: str
) -> None

parse_cuda_device

def parse_cuda_device(cuda_device: Union[str, int, List[int]]) -> int

Disambiguates single GPU and multiple GPU settings for cuda_device param.

check_for_gpu

def check_for_gpu(
    device: Union[int, torch.device, List[Union[int, torch.device]]]
)

check_for_java

def check_for_java() -> bool