o
    ‰dËi³  ã                   @   s*   d dl Z h d£Zdefdd„Zdd„ ZdS )é    N>	   úblenderbot-smallÚmptÚoptÚbartÚbloomÚllamaÚmistralÚpegasusÚ
blenderbotÚattrc                 C   s    dd„ }t  || g| d¡ ¡S )zÑ
    Recursive `getattr`.

    Args:
        obj:
            A class instance holding the attribute.
        attr (`str`):
            The attribute that is to be retrieved, e.g. 'attribute1.attribute2'.
    c                 S   s
   t | |ƒS )N)Úgetattr)Úobjr   © r   új/lsinfo/ai/hellotax_ai/llm_service/venv_embed/lib/python3.10/site-packages/optimum/utils/modeling_utils.pyÚ_getattr*   s   
z!recurse_getattr.<locals>._getattrÚ.)Ú	functoolsÚreduceÚsplit)r   r   r   r   r   r   Úrecurse_getattr   s   r   c                 C   s>   d|vrt | ||ƒ dS | dd¡\}}tt| |ƒ||ƒ dS )z5A function to recursively set attributes to a module.r   é   N)Úsetattrr   Úrecurse_setattrr   )ÚmoduleÚnameÚvalueÚrestr   r   r   r   0   s   r   )r   ÚMODEL_TO_PATCH_FOR_PASTÚstrr   r   r   r   r   r   Ú<module>   s   