hezar.utils.registry_utils module

hezar.utils.registry_utils.get_module_class(name: str, registry_type: RegistryType | str)[source]

Get module class based on registry name

Parameters:
  • name – Module’s key name in its registry

  • registry_type – Type of the module e.g, model, dataset, preprocessor, embedding, etc

Returns:

A class corresponding to the given module

hezar.utils.registry_utils.get_module_config_class(name: str, registry_type: RegistryType | str)[source]

Get the config class for a given module based on its registry name.

Parameters:
  • name (str) – Module’s registry name

  • registry_type (str) – Registry type

Returns:

A class of type hezar.Config

hezar.utils.registry_utils.get_registry_key_by_module_class(module_class: type, registry_type: RegistryType | str)[source]

Given the module class, return the registry key if exists

Parameters:
  • module_class – The module class (raw class, not the name or object)

  • registry_type – The registry type

Returns:

The corresponding key for the class in its registry

hezar.utils.registry_utils.get_registry_point(registry_key: str, registry_type: RegistryType | str)[source]

Get the registry item by registry key name in a specific registry

Parameters:
  • registry_key – Module’s name in the registry

  • registry_type – Module’s registry container type

Returns:

A Registry object

hezar.utils.registry_utils.list_available_datasets()[source]
hezar.utils.registry_utils.list_available_embeddings()[source]
hezar.utils.registry_utils.list_available_metrics()[source]
hezar.utils.registry_utils.list_available_models()[source]
hezar.utils.registry_utils.list_available_preprocessors()[source]