o
    TÃi@  ã                   @   sb   d dl mZmZ d dlmZmZmZ d dlZd dlm	Z	 G dd„ de	ƒZ
G dd„ dejjeƒZdS )	é    )ÚABCÚabstractstaticmethod)ÚAnyÚDictÚTypeN)ÚDeepSpeedConfigModelc                   @   s   e Zd ZU eed< dS )ÚDSModuleConfigÚ
max_tokensN)Ú__name__Ú
__module__Ú__qualname__ÚintÚ__annotations__© r   r   ú\/home/ubuntu/.local/lib/python3.10/site-packages/deepspeed/inference/v2/modules/ds_module.pyr      s   
 r   c                       sx   e Zd ZdZedefdd„ƒZedee fdd„ƒZ	edede
fdd	„ƒZi fded
eeef ddf‡ fdd„Z‡  ZS )ÚDSModuleBasezç
    Base class for all DeepSpeed Inference modules. This class establishes
    the basic attributes of a DSModule. Only abstract functionality modules should inherit
    directly from this class, not specific implementations.
    Úreturnc                   C   ó   dS )zâ
        Return a memorable, human-readable name for this module.

        This will be used as a key in custom inference configurations and should only
        be implemented by the children of functionality modules.
        Nr   r   r   r   r   Úname   ó   zDSModuleBase.namec                   C   r   )z´
        Return the associated config class for this module.

        This should be implemented (along with the config class) by an abstract functionality
        module.
        Nr   r   r   r   r   Úconfig_class$   r   zDSModuleBase.config_classÚconfigc                 C   r   )a  
        Return whether or not this module supports the given config.

        This should be implemented by the children of functionality modules and should report
        whether it would be feasible to instantiate this module with the given config.
        Nr   )r   r   r   r   Úsupports_config.   r   zDSModuleBase.supports_configÚimplementation_configNc                    s   t ƒ  ¡  || _|| _dS )z>
        Initialize the module with the given config.
        N)ÚsuperÚ__init__Ú_configÚ_implementation_config)Úselfr   r   ©Ú	__class__r   r   r   8   s   

zDSModuleBase.__init__)r
   r   r   Ú__doc__r   Ústrr   r   r   r   Úboolr   r   r   r   Ú__classcell__r   r   r   r   r      s    		.	r   )Úabcr   r   Útypingr   r   r   ÚtorchÚdeepspeed.runtime.config_utilsr   r   ÚnnÚModuler   r   r   r   r   Ú<module>   s   