gliner.utils module¶

gliner.utils.load_config_as_namespace(config_file)[source]¶

Load YAML/JSON config file as nested Namespace.

Parameters:

config_file (str | Path) – Path to config file

Returns:

Nested argparse.Namespace

Return type:

Namespace

Example

>>> config = load_config_as_namespace("config.yaml")
>>> print(config.model.model_name)
>>> print(config.training.lr_encoder)
gliner.utils.dict_to_namespace(d)[source]¶

Recursively convert dict to Namespace.

gliner.utils.namespace_to_dict(namespace)[source]¶

Convert Namespace back to dict.

gliner.utils.is_module_available(module_name)[source]¶

Checks whether the specified Python module is available.

Parameters:

module_name (str) – The name of the module to check.

Returns:

True if the module is available, False otherwise.

Return type:

bool

exception gliner.utils.MissedPackageException[source]¶

Bases: Exception

Raised when the requested decoder model is not supported.