colossalai.registry.registry
- class colossalai.registry.registry.Registry(name, third_party_library=None)[source]
This is a registry class used to register classes and modules so that a universal object builder can be enabled.
- Parameters
name (str) – The name of the registry .
third_party_library (list, optional) – List of third party libraries which are used in the initialization of the register module.
- register_module(module_class)[source]
Registers a module represented in module_class.
- Parameters
module_class (class) – The module to be registered.
- Returns
The module to be registered, so as to use it normally if via importing.
- Return type
class
- Raises
AssertionError – Raises an AssertionError if the module has already been registered before.
- get_module(module_name)[source]
Retrieves a module with name module_name and returns the module if it has already been registered before.
- Parameters
module_name (str) – The name of the module to be retrieved.
- Returns
The retrieved module or None.
- Return type
object- Raises
NameError – Raises a NameError if the module to be retrieved has neither been
registered directly nor as third party modules before. –
- has(module_name)[source]
Searches for a module with name module_name and returns a boolean value indicating whether the module has been registered directly or as third party modules before.
- Parameters
module_name (str) – The name of the module to be searched for.
- Returns
A boolean value indicating whether the module has been registered directly or as third party modules before.
- Return type
bool