easydel.infra.factory#

class easydel.infra.factory.ConfigType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

MODULE_CONFIG = 'module-config'#
class easydel.infra.factory.ModuleRegistration(module: type[easydel.infra.base_module.EasyDeLBaseModule], config: type[easydel.infra.base_config.EasyDeLBaseConfig], embedding_layer_names: Optional[List[str]] = None, layernorm_names: Optional[List[str]] = None)[source]#

Bases: object

config: type[easydel.infra.base_config.EasyDeLBaseConfig]#
embedding_layer_names: Optional[List[str]] = None#
layernorm_names: Optional[List[str]] = None#
module: type[easydel.infra.base_module.EasyDeLBaseModule]#
class easydel.infra.factory.Registry[source]#

Bases: object

property config_registry#
get_config(config_type: str, config_field: ConfigType = ConfigType.MODULE_CONFIG) Type[source]#

Get registered configuration class.

get_module_registration(task_type: Union[TaskType, Literal['causal-language-model', 'sequence-classification', 'vision-language-model', 'audio-classification', 'base-module', 'sequence-to-sequence']], model_type: str) ModuleRegistration[source]#
register_config(config_type: str, config_field: ConfigType = ConfigType.MODULE_CONFIG) callable[source]#

Register a configuration class.

Parameters
  • config_type – Identifier for the configuration

  • config_field – Type of configuration registry

Returns

Decorator function

register_module(task_type: TaskType, config: EasyDeLBaseConfig, model_type: str, embedding_layer_names: Optional[List[str]] = None, layernorm_names: Optional[List[str]] = None) callable[source]#

Register a module for a specific task.

Parameters
  • task_type – Type of task

  • config – Configuration for the module

  • model_type – Identifier for the model

  • embedding_layer_names – Names of embedding layers

  • layernorm_names – Names of layer normalization layers

Returns

Decorator function

property task_registry#
class easydel.infra.factory.TaskType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

AUDIO_CLASSIFICATION = 'audio-classification'#
BASE_MODULE = 'base-module'#
BASE_VISION = 'vision-module'#
CAUSAL_LM = 'causal-language-model'#
IMAGE_CLASSIFICATION = 'image-classification'#
IMAGE_TEXT_TO_TEXT = 'image-text-to-text'#
SEQUENCE_CLASSIFICATION = 'sequence-classification'#
SEQUENCE_TO_SEQUENCE = 'sequence-to-sequence'#
SPEECH_SEQUENCE_TO_SEQUENCE = 'speech-sequence-to-sequence'#
VISION_LM = 'vision-language-model'#
ZERO_SHOT_IMAGE_CLASSIFICATION = 'zero-shot-image-classification'#
easydel.infra.factory.register_config(config_type: str, config_field: ConfigType = ConfigType.MODULE_CONFIG) callable#

Register a configuration class.

Parameters
  • config_type – Identifier for the configuration

  • config_field – Type of configuration registry

Returns

Decorator function

easydel.infra.factory.register_module(task_type: TaskType, config: EasyDeLBaseConfig, model_type: str, embedding_layer_names: Optional[List[str]] = None, layernorm_names: Optional[List[str]] = None) callable#

Register a module for a specific task.

Parameters
  • task_type – Type of task

  • config – Configuration for the module

  • model_type – Identifier for the model

  • embedding_layer_names – Names of embedding layers

  • layernorm_names – Names of layer normalization layers

Returns

Decorator function