§
    ®˜ºhWX  ã                   ó2  — d dl Z d dlZd dlmZmZ d dlmZmZmZ d dl	m
Z
mZmZmZmZ d dlmZ g d¢Zdej        deej        geej                 f         fd„Zdej        d	eej        eee
f         f         d
edeej        geej                 f         fd„Zdej        deeej                          deej                 deee
f         d	eej        eee
f         f         f
d„Zdefd„Z G d„ de¦  «        Zdej        dededeeej                          def
d„Z G d„ de¦  «        Z G d„ de¦  «        Z dej        dedededef
d„Z!dej        dededeeej                          def
d„Z"dej        dee         defd „Z#dej        dededefd!„Z$ ed"¦  «        ddfdej        deded#ed$eeeej                                   d%eeeej                                   defd&„Z%ej&        ej'        he%_(        ej)        he%_*        e j+        d'e
d(e
ded)         fd*„¦   «         Z,dej        d+e
dej        fd,„Z-dej        d'edej        fd-„Z.	 d6dej        d/ed'edeej                 d0eej/                 d1ed2e
de0ej        ef         fd3„Z1 G d4„ d5¦  «        Z2dS )7é    N)ÚABCÚabstractmethod)Ú	GeneratorÚIterableÚSequence)ÚAnyÚCallableÚcastÚOptionalÚUnion)Úalways_wrap_policyÚlambda_auto_wrap_policyÚtransformer_auto_wrap_policyÚsize_based_auto_wrap_policyÚenable_wrapÚwrapÚCustomPolicyÚModuleWrapPolicyÚroot_moduleÚfnc                 ó�   ‡‡‡— | hŠdt           j        dt          dt          t           j                 fˆˆˆfd„Š ‰| dd¦  «         dS )aQ  
    This applies ``fn`` to every module in the module tree of ``root_module``
    following a post-order traversal. If ``fn`` returns an :class:`nn.Module`,
    then this replaces the original module with the newly returned one in the
    tree. Otherwise, ``fn`` should return ``None``, in which case the module is
    not changed.
    ÚmoduleÚmodule_nameÚparent_modulec                 óˆ  •— |                       ¦   «         D ]+\  }}|‰vr"‰                     |¦  «          ‰||| ¦  «         Œ, ‰| ¦  «        }|�st          |t          j        ¦  «        sJ d|› d| › �¦   «         ‚|sJ d| › �¦   «         ‚t          |t          j        ¦  «        sJ d|› �¦   «         ‚t          |||¦  «         d S d S )Nz=Non-root modules should have their parent module set but got z for zTNon-root modules should have their module name set but got an empty module name for z.fn should return None or an nn.Module but got )Únamed_childrenÚaddÚ
isinstanceÚnnÚModuleÚsetattr)	r   r   r   Úchild_module_nameÚchild_moduleÚoptional_moduleÚ_post_order_apply_innerr   Úvisited_moduless	         €€€úc/var/www/html/services/rag-service/venv/lib/python3.11/site-packages/torch/distributed/fsdp/wrap.pyr%   z2_post_order_apply.<locals>._post_order_apply_inner-   s?  ø€ ð
 06×/DÒ/DÑ/FÔ/Fð 	Qð 	QÑ+Ð˜|Ø ?Ð2Ð2Ø×#Ò# LÑ1Ô1Ð1Ø'Ð'¨Ð6GÈÑPÔPÐPøØ˜"˜V™*œ*ˆØÐ&Ý˜m­R¬YÑ7Ô7ð ð ð0Ø ð0ð 0Ø'-ð0ð 0ñô ð ð ð ð ð5Ø,2ð5ð 5ñô ð õ ˜o­r¬yÑ9Ô9ð ð ØRÀÐRÐRñô ð õ �M ;°Ñ@Ô@Ð@Ð@Ð@ð 'Ð&ó    Ú N)r   r    Ústrr   )r   r   r%   r&   s    `@@r'   Ú_post_order_applyr+      s�   øøø€ ð (3 m€OðAÝ”	ðAåðAõ  ¥¤	Ô*ðAð Að Að Að Að Að Að Að0 Ð˜K¨¨TÑ2Ô2Ð2Ð2Ð2r(   Útarget_module_to_kwargsÚfsdp_fnÚreturnc                 ób   ‡ ‡‡— dt           j        dt          t           j                 fˆˆ ˆfd„}|S )z¶
    This constructs the "wrap" function to pass to :func:`_post_order_apply`
    based on ``target_module_to_kwargs``, which should be constructed from the
    wrapping policy.
    r   r.   c                 ó:   •— | ‰v r| ‰ur‰|          } ‰| fi |¤ŽS d S ©N© )r   Úkwargsr-   r   r,   s     €€€r'   r   z_construct_wrap_fn.<locals>.fnS   sB   ø€ ð Ð,Ð,Ð,°¸{Ð1JÐ1JØ,¨VÔ4ˆFØ�7˜6Ð,Ð, VÐ,Ð,Ð,Øˆtr(   )r   r    r   )r   r,   r-   r   s   ``` r'   Ú_construct_wrap_fnr4   H   sK   øøø€ ð•2”9ð ¥­"¬)Ô!4ð ð ð ð ð ð ð ð ð €Ir(   Úmodule_classesÚignored_modulesÚroot_kwargsc                 ó¾   — t          t          |¦  «        ¦  «        }|                      ¦   «         D ]+}||v rŒt          ||¦  «        r||vr|||<   d ||         d<   Œ,|S )NÚmixed_precision)ÚtupleÚsetÚmodulesr   )r   r5   r6   r7   r,   Úmodule_classes_tupler   s          r'   Ú$_run_mixed_precision_override_policyr>   ^   sˆ   € õ !¥ ^Ñ!4Ô!4Ñ5Ô5ÐØ×%Ò%Ñ'Ô'ð Fð FˆØ�_Ð$Ð$ØÝ˜Ð 4Ñ5Ô5ð 	FàÐ4Ð4Ð4à2=Ð'¨Ñ/ØAEÐ# FÔ+Ð,=Ñ>øØ"Ð"r(   c                  ó   — dS )zª
    A simple recursive wrap policy that always returns ``True``. This means
    that every submodule is wrapped by the wrapper class in
    :func:`_recursive_wrap`.
    Tr2   )Úargsr3   s     r'   r   r   r   s	   € ð ˆ4r(   c                   ó”   — e Zd ZdZedej        deej                 dee	e
f         deej        ee	e
f         f         fd„¦   «         ZdS )Ú_Policyzk
    This defines an abstract base class that represents a policy for applying
    a module-level API.
    r   r6   r7   r.   c                 ó   — dS )zˆ
        This should return a dict ``target_module_to_kwargs`` that maps from
        each target module to wrap to its kwargs.
        Nr2   )Úselfr   r6   r7   s       r'   Ú_run_policyz_Policy._run_policy�   s	   € ð 	ˆr(   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r    r;   Údictr*   r   rE   r2   r(   r'   rB   rB   {   sˆ   € € € € € ðð ð
 ð
à”Yð
ð ˜RœYœð
ð ˜#˜s˜(”^ð	
ð
 
ˆbŒi˜˜c 3˜hœÐ'Ô	(ð
ð 
ð 
ñ „^ð
ð 
ð 
r(   rB   r   ÚrecurseÚnonwrapped_numelc                 óD   — |rdS t          | t          |¦  «        ¦  «        S )a   
    This auto wrap policy wraps every module that is an instance of any type in
    ``module_classes`` as its own FSDP instance. The root module given by
    ``module`` is always wrapped as an FSDP instance regardless. Since the
    wrapping proceeds bottom up, each FSDP instance manages the parameters in
    its subtree excluding any already managed by a child FSDP instance.

    Args:
        module (nn.Module): Current module being considered.
        recurse (bool): If ``False``, then this function must decide whether
            ``module`` should be wrapped as an FSDP instance or not. If
            ``True``, then the function is still recursing down the module
            tree as a part of the DFS.
        nonwrapped_numel (int): Parameter numel not yet wrapped.
        module_classes (Set[Type[nn.Module]]): Set of module classes that are
            wrapped as FSDP instances.

    Returns:
        ``True`` if ``recurse=True``, and whether ``module`` should be wrapped
        if ``recurse=False``.
    T©r   r:   )r   rK   rL   r5   s       r'   Ú_module_wrap_policyrO   �   s)   € ð6 ð ØˆtÝ�f�e NÑ3Ô3Ñ4Ô4Ð4r(   c                   óÎ   ‡ — e Zd ZdZdeeej                          fd„Zdej        de	ej                 de
eef         de
ej        e
eef         f         fd„Zd	„ Zdefˆ fd
„Zˆ xZS )r   z{
    This policy applies to every module of the specified module classes,
    passing in the kwargs given to the root.
    r5   c                 óZ   — t          |¦  «        }|| _        t          |¦  «        | _        d S r1   )r;   Ú_module_classesr*   Ú_module_classes_str)rD   r5   Úmodule_classes_sets      r'   Ú__init__zModuleWrapPolicy.__init__µ   s/   € Ý  Ñ0Ô0ÐØ1ˆÔÝ#&Ð'9Ñ#:Ô#:ˆÔ Ð Ð r(   r   r6   r7   r.   c                 ó¸   — t          | j        ¦  «        }i }|                     ¦   «         D ].}||v rŒt          ||¦  «        rt	          j        |¦  «        ||<   Œ/|S r1   )r:   rR   r<   r   Úcopy)rD   r   r6   r7   r5   r,   r   s          r'   rE   zModuleWrapPolicy._run_policyº   st   € õ ˜tÔ3Ñ4Ô4ˆØCEÐØ!×)Ò)Ñ+Ô+ð 	Ið 	IˆFØ˜Ð(Ð(ØÝ˜F NÑ3Ô3ð Iå26´)¸KÑ2HÔ2HÐ'¨Ñ/øØ&Ð&r(   c                 ó2   — t          ||d| j        ¬¦  «        S )Néÿÿÿÿ)rL   r5   )rO   rR   )rD   r   rK   r@   r3   s        r'   Ú__call__zModuleWrapPolicy.__call__Ê   s%   € å"Ø�G¨bÀÔAUð
ñ 
ô 
ð 	
r(   c                 ó\   •— t          ¦   «                              ¦   «         d| j        › d�z   S )Nú(ú))ÚsuperÚ__repr__rS   )rD   Ú	__class__s    €r'   r_   zModuleWrapPolicy.__repr__Ð   s-   ø€ Ý‰wŒw×ÒÑ!Ô!Ð$C¨Ô(@Ð$CÐ$CÐ$CÑCÐCr(   )rF   rG   rH   rI   r   Útyper   r    rU   r;   rJ   r*   r   rE   rZ   r_   Ú__classcell__)r`   s   @r'   r   r   ¯   sì   ø€ € € € € ðð ð
; x°°R´Y´Ô'@ð ;ð ;ð ;ð ;ð
'à”Yð'ð ˜RœYœð'ð ˜#˜s˜(”^ð	'ð
 
ˆbŒi˜˜c 3˜hœÐ'Ô	(ð'ð 'ð 'ð 'ð 
ð 
ð 
ðD˜#ð Dð Dð Dð Dð Dð Dð Dð Dð Dð Dr(   r   c                   óÌ   — e Zd ZdZdeej        geee	e
ef         f         f         fd„Zdej        deej                 de	e
ef         de	ej        e	e
ef         f         fd„Zd	S )
r   aý  
    This policy takes in a lambda function that maps a given ``nn.Module`` to
    either ``False``, ``True``, or a kwarg dictionary.
    - If the function returns ``False`` or an empty dictionary, then the module
      does not have the API applied.
    - If the function returns ``True``, then the module has the API applied
      with the root's kwargs.
    - If the function returns a non-empty dictionary, then the module has the
      API applied, and the dictionary overrides the root's kwargs.

    Example::

        >>> # xdoctest: +SKIP("undefined variables")
        >>> model = init_transformer_model(...)
        >>> def lambda_fn(module: nn.Module):
        >>>     if module is model.lm_head:
        >>>         return {"sharding_strategy": ShardingStrategy.SHARD_GRAD_OP}
        >>>     elif isinstance(module, TransformerBlock):
        >>>         return True
        >>>     return False
        >>> policy = CustomPolicy(lambda_fn)
        >>> fsdp_model = FSDP(model, auto_wrap_policy=policy)
    Ú	lambda_fnc                 ó   — || _         d S r1   )Ú
_lambda_fn)rD   rd   s     r'   rU   zCustomPolicy.__init__í   s   € Ø#ˆŒˆˆr(   r   r6   r7   r.   c                 óT  — i }|                      ¦   «         D ]�}||v rŒ|                      |¦  «        }t          |t          t          f¦  «        st          d|› �¦  «        ‚|sŒMt          j        |¦  «        }t          |t          ¦  «        r|                     |¦  «         |||<   Œ‘|S )Nz_The lambda_fn passed to CustomPolicy should return False/True or a kwarg dict, but it returned )r<   rf   r   rJ   ÚboolÚ
ValueErrorrW   Úupdate)rD   r   r6   r7   r,   r   Úresr3   s           r'   rE   zCustomPolicy._run_policyð   sÙ   € ð DFÐØ!×)Ò)Ñ+Ô+ð 	5ð 	5ˆFØ˜Ð(Ð(ØØ—/’/ &Ñ)Ô)ˆCÝ˜c¥D­$ <Ñ0Ô0ð Ý ðIØCFðIð Iñô ð ð ð ØÝ”Y˜{Ñ+Ô+ˆFÝ˜#�tÑ$Ô$ð #ð —’˜cÑ"Ô"Ð"Ø.4Ð# FÑ+Ð+Ø&Ð&r(   N)rF   rG   rH   rI   r	   r   r    r   rh   rJ   r*   r   rU   r;   rE   r2   r(   r'   r   r   Ô   s·   € € € € € ðð ð0$ (¨B¬I¨;¸¸dÀDÈÈcÈÄNÐ>RÔ8SÐ+SÔ"Tð $ð $ð $ð $ð'à”Yð'ð ˜RœYœð'ð ˜#˜s˜(”^ð	'ð
 
ˆbŒi˜˜c 3˜hœÐ'Ô	(ð'ð 'ð 'ð 'ð 'ð 'r(   r   rd   c                 ó    — |rdS  || ¦  «        S )aU  
    A convenient auto wrap policy to wrap submodules based on an arbitrary user
    function. If `lambda_fn(submodule) == True``, the submodule will be wrapped as
    a `wrapper_cls` unit.

    Return if a module should be wrapped during auto wrapping.

    The first three parameters are required by :func:`_recursive_wrap`.

    Args:
        module (nn.Module): Current module being considered.
        recurse (bool): If ``False``, then this function must decide whether
            ``module`` should be wrapped as an FSDP instance or not. If
            ``True``, then the function is still recursing down the module
            tree as a part of the DFS.
        nonwrapped_numel (int): Parameter numel not yet wrapped.

        lambda_fn (Callable[[nn.Module], bool]): If this returns ``True``, then
            this module will be wrapped.
    Tr2   )r   rK   rL   rd   s       r'   r   r     s!   € ð. ð ØˆtØˆ9�VÑÔÐr(   Útransformer_layer_clsc                 ó&   — t          | |||¦  «        S )a-  
    See :func:`_module_wrap_policy`, where ``transformer_layer_cls`` is the
    same as ``module_classes``. Note that shared parameters must be wrapped in
    the same FSDP instance, so this auto wrap policy can help wrap shared
    embeddings into the same FSDP instance for transformer models.
    )rO   )r   rK   rL   rm   s       r'   r   r   '  s   € õ ˜v wÐ0@ÐBWÑXÔXÐXr(   c                 óD   — |rdS t          | t          |¦  «        ¦  «        S )NTrN   )r   r5   rK   r@   r3   s        r'   Ú_wrap_module_cls_individuallyrp   6  s+   € ð ð 9àˆtõ ˜&¥%¨Ñ"7Ô"7Ñ8Ô8Ð8r(   c                 óB   ‡ ‡‡— t          ˆ ˆˆfd„|D ¦   «         ¦  «        S )zv
    A policy that wraps ``module`` if any policy in the passed in iterable of
    ``policies`` returns ``True``.
    c              3   ó4   •K  — | ]} |‰‰‰¬ ¦  «        V — ŒdS )©r   rK   rL   Nr2   )Ú.0Úpolicyr   rL   rK   s     €€€r'   ú	<genexpr>z_or_policy.<locals>.<genexpr>L  sI   øè è € ð ð àð 	ˆ�f gÐ@PÐQÑQÔQðð ð ð ð ð r(   )Úany)r   rK   rL   Úpoliciess   ``` r'   Ú
_or_policyry   B  sI   øøø€ õ ð ð ð ð ð ð àðñ ô ñ ô ð r(   g    „×—AÚmin_num_paramsÚforce_leaf_modulesÚexclude_wrap_modulesc                 óÖ   — |€t           j        n|}|€t           j        n|}|}||k    }|r |ot          | t	          |¦  «        ¦  «         S |ot          | t	          |¦  «        ¦  «         S )aÃ  
    A size-based auto wrap policy.

    Args:
        module (nn.Module): Current module being considered.
        recurse (bool): If ``False``, then this function must decide whether
            ``module`` should be wrapped as an FSDP instance or not. If
            ``True``, then the function is still recursing down the module
            tree as a part of the DFS.
        nonwrapped_numel (int): Parameter numel not yet wrapped.

        min_num_params (int): Customizable policy input that controls the size
            threshold over which a module is ready to be wrapped. This is in
            units of numel.
        force_leaf_modules (Optional[set[type[nn.Module]]]): Set of module types to keep
            as leaves, i.e. their children will never be wrapped.
        exclude_wrap_modules (Optional[set[type[nn.Module]]]): Set of module types to be
            excluded in wrapping.

    Returns:
        Whether ``module`` should be wrapped.
    )r   ÚFORCE_LEAF_MODULESÚEXCLUDE_WRAP_MODULESr   r:   )r   rK   rL   rz   r{   r|   Úmin_nonwrapped_numelÚis_larges           r'   r   r   R  s™   € ðB Ð%õ 	$Ô6Ð6àð ð  Ð'õ 	$Ô8Ð8à!ð ð *ÐØÐ#7Ò7€HØð PàÐM¥
¨6µ5Ð9KÑ3LÔ3LÑ MÔ MÐMÐMð ÐO¥
¨6µ5Ð9MÑ3NÔ3NÑ OÔ OÐOÐOr(   Úwrapper_clsÚwrapper_kwargs)NNNc              +   óh   K  — d| i|¥}t          di |¤Ž5  dV — ddd¦  «         dS # 1 swxY w Y   dS )aÑ  
    Context manager to wrap modules using a wrapper.

    Useful for when you'd like to apply the same configuration arguments to all
    child modules that you wrap. A particularly important use case is wrapping
    large layers so that they get sharded (in-place) during initialization, to
    avoid running out of system memory. Large layers can indicate that they
    should be sharded via the ``wrap`` annotation and this context manager can
    provide the exact configuration for these nested instances.

    Usage::

        with enable_wrap(wrapper_cls, **params):
            # Wraps layer in FSDP by default if within context
            self.l1 = wrap(torch.nn.Linear(5, 5))

    Args:
        wrapper_cls:
            Class that `wrap` annotation will `wrap` modules with, such as
            `FullyShardedDataParallel`.
        **wrapper_kwargs:
            Configuration settings that will be passed to all ``wrap``
            instances inside the context
    r‚   Nr2   )Ú_ConfigAutoWrap)r‚   rƒ   r3   s      r'   r   r   �  sŸ   è è € ð: 	�{ðà
ð€Fõ 
Ð	"Ð	"˜6Ð	"Ð	"ð ð Øˆˆˆðð ð ñ ô ð ð ð ð ð ð ð øøøð ð ð ð ð ð s   •'§+®+Úwrap_overridesc                 óŠ   — t           j        r6t           j        €J ‚i t           j        ¥|¥}t	          | t           j        fi |¤ŽS | S )a  
    Annotate that a module should be wrapped. Annotated modules will only be
    wrapped if inside of an :func:`enable_wrap` context manager. This allows
    a module to be initialized both with and without a wrapper without code
    change.

    The class that this function wraps the passed in ``nn.Module`` with is the
    passed in ``wrapper_cls`` argument into ``enable_wrap``. Both
    ``enable_wrap`` and ``wrap`` can take in kwargs specifying how to construct
    the ``wrapper_cls`` instance. In the case of duplicate kwargs in
    ``enable_wrap`` and ``wrap``, the argument passed into ``wrap`` will be
    respected.

    Usage::

        with enable_wrap(wrapper_cls=FSDP, **fsdp_config):
            # Wraps layer in FSDP by default if within context
            self.l1 = wrap(torch.nn.Linear(5, 5))

    Args:
        module (nn.Module): module to wrap (if in :func:`enable_wrap` context)
        **wrap_overrides: configuration overrides that will take priority over
            the values provided by the :func:`enable_wrap` context
    )r…   Úin_autowrap_contextr‚   r3   Ú_wrap)r   r†   s     r'   r   r   ±  sa   € õ2 Ô*ð 
ÝÔ*Ð6Ð6Ð6àE�OÔ2ÐE°nÐEˆÝØÝÔ'ð
ð 
ð ð
ð 
ð 	
ð
 €Mr(   c                 ód   — |€J ‚t          | d¦  «        ri |¥| j        ¥} || fi |¤ŽS  || fi |¤ŽS )NÚ_wrap_overrides)Úhasattrr‹   )r   r‚   r3   Ú	overridess       r'   r‰   r‰   Ö  se   € ØÐ"Ð"Ð"ÝˆvÐ(Ñ)Ô)ð 0ð
 9�vÐ8 Ô!7Ð8ˆ	Øˆ{˜6Ð/Ð/ YÐ/Ð/Ð/àˆ;�vÐ(Ð( Ð(Ð(Ð(r(   FÚauto_wrap_policyÚignored_paramsÚonly_wrap_childrenr3   c           
      óN  ‡— |€
J d¦   «         ‚|€
J d¦   «         ‚|                       ¦   «         D ]@\  }}||v rŒ
	 t          |t          t          |¦  «        ¦  «        rJ ‚Œ1# t          $ r Y Œ=w xY wt          ˆfd„|                      ¦   «         D ¦   «         ¦  «        }	|€J ‚ || d|	¬¦  «        rud}
|                      ¦   «         D ]5\  }}||v rŒ
t          d
||||‰dœ|¤Ž\  }}t          | ||¦  «         |
|z  }
Œ6|	|
z
  }|s || d	|¬¦  «        rt          | |fi |¤Ž|	fS | |
fS | dfS )aÚ  
    Wraps submodules of ``module`` for which ``auto_wrap_policy`` returns
    ``True`` with ``wrapper_cls``.

    Args:
        module (nn.Module): Module to recursively wrap.
        auto_wrap_policy (Callable): A callable representing a policy that
            determines which modules to recursively wrap with ``wrapper_cls``.
        ignored_modules (set[torch.nn.Module]): Modules to ignore when
            wrapping.
        ignored_params (set[torch.nn.Parameter]): Parameters to ignore when
            wrapping; these should be the parameters contained in the modules
            in ``ignored_modules``.
    Returns:
        (nn.Module, int):
            ``module`` after wrapping and the numel recursively wrapped.
    NzMust specify auto_wrap_policy.zMust specify wrapper_clsc              3   óH   •K  — | ]}|‰v¯|                      ¦   «         V — Œd S r1   )Únumel)rt   Úpr�   s     €r'   rv   z"_recursive_wrap.<locals>.<genexpr>
  s>   øè è € ð ð Ø°!¸>Ð2IÐ2Iˆ�Š‰	Œ	Ð2IÐ2IÐ2IÐ2Iðð r(   Trs   r   )r   rŽ   r‚   r6   r�   Fr2   )Únamed_modulesr   r
   ra   Ú	TypeErrorÚsumÚ
parametersr   Ú_recursive_wrapr!   r‰   )r   rŽ   r‚   r6   r�   r�   r3   Ú_ÚchildrL   Útotal_wrapped_numelÚnameÚwrapped_childÚnum_wrapped_paramsÚ	remainders       `          r'   r™   r™   ã  s  ø€ ð4 Ð'Ð'Ð)IÑ'Ô'Ð'ØÐ"Ð"Ð$>Ñ"Ô"Ð"à×(Ò(Ñ*Ô*ð ð ‰ˆˆ5Ø�OÐ#Ð#Øð	Ý! %­­d°KÑ)@Ô)@ÑAÔAÐAÐAÐAÐAøÝð 	ð 	ð 	àˆDð	øøøõ
 ð ð ð ð Ø!×,Ò,Ñ.Ô.ðñ ô ñ ô Ðð Ð'Ð'Ð'ØÐ˜v¨tÐFVÐWÑWÔWð /ØÐà!×0Ò0Ñ2Ô2ð 	6ð 	6‰KˆD�%Ø˜Ð'Ð'ØÝ0?ð 1ØØ!1Ø'Ø /Ø-ð1ð 1ð ð1ð 1Ñ-ˆMÐ-õ �F˜D -Ñ0Ô0Ð0àÐ#5Ñ5ÐÐð %Ð':Ñ:ˆ	Ø!ð 	/Ð&6Ð&6Ø 5¸9ð'
ñ '
ô '
ð 	/õ ˜ Ð7Ð7°Ð7Ð7Ð9IÐIÐIàÐ.Ð.Ð.Ø�1ˆ9Ðs   ¹%AÁ
A,Á+A,c                   óÎ   — e Zd ZU dZdZeed<   dZee	         ed<   i Z
eeef         ed<   deeef         fd„Zededdfd	„¦   «         Zedd
„¦   «         Zdd„Zdedededdfd„ZdS )r…   zŒ
    Helper class to wrap modules based on default config args via a context manager.
    See :func:`enable_wrap` for more information.
    Frˆ   Nr‚   r3   c                 ó   — || _         d S r1   ©r3   )rD   r3   s     r'   rU   z_ConfigAutoWrap.__init__7  s   € ØˆŒˆˆr(   r.   c                 óü   — t           j        rt          d¦  «        ‚dt           _        d|                      ¦   «         v s
J d¦   «         ‚t	          t
          | d         ¦  «        t           _        | d= | t           _        d S )Nz]You are already within an autowrap context and we currently do not supported nested autowrap.Tr‚   z9Expected to pass in wrapper_cls arg into _ConfigAutoWrap.)r…   rˆ   ÚNotImplementedErrorÚkeysr
   r	   r‚   r3   r£   s    r'   Úenable_autowrap_contextz'_ConfigAutoWrap.enable_autowrap_context:  s   € åÔ.ð 	Ý%Øoñô ð ð /3�Ô+à §¢¡¤Ð-Ð-Ð-ØGñ .Ô-Ð-õ '+­8°V¸MÔ5JÑ&KÔ&K�Ô#Ø�=Ð!à!'�ÔÐÐr(   c                  óN   — dt           _        d t           _        i t           _        d S )NF)r…   rˆ   r‚   r3   r2   r(   r'   Údisable_autowrap_contextz(_ConfigAutoWrap.disable_autowrap_contextJ  s    € à.3�Ô+Ø&*�Ô#Ø!#�ÔÐÐr(   c                 ó:   — |                       | j        ¦  «         d S r1   )r§   r3   )rD   s    r'   Ú	__enter__z_ConfigAutoWrap.__enter__P  s   € Ø×$Ò$ T¤[Ñ1Ô1Ð1Ð1Ð1r(   Úexc_typeÚexc_valÚexc_tbc                 ó.   — |                       ¦   «          d S r1   )r©   )rD   r¬   r­   r®   s       r'   Ú__exit__z_ConfigAutoWrap.__exit__S  s   € Ø×%Ò%Ñ'Ô'Ð'Ð'Ð'r(   )r.   N)rF   rG   rH   rI   rˆ   rh   Ú__annotations__r‚   r   r	   r3   rJ   r*   r   rU   Ústaticmethodr§   r©   r«   r°   r2   r(   r'   r…   r…   -  s  € € € € € € ðð ð
 !&Ð˜Ð%Ð%Ñ%Ø&*€K�˜(Ô#Ð*Ð*Ñ*Ø€FˆD��c�ŒNÐÐÑð  c¨3 h¤ð ð ð ð ð ð(¨ð (°ð (ð (ð (ñ „\ð(ð ð$ð $ð $ñ „\ð$ð
2ð 2ð 2ð 2ð( ð (¨sð (¸Cð (ÀDð (ð (ð (ð (ð (ð (r(   r…   )F)3Ú
contextlibrW   Úabcr   r   Úcollections.abcr   r   r   Útypingr   r	   r
   r   r   Útorch.nnr   Ú__all__r    r+   rJ   r*   r4   ra   r;   r>   rh   r   rB   ÚintrO   r   r   r   r   rp   ry   r   Ú
ModuleListÚ
ModuleDictr   ÚMultiheadAttentionr~   Úcontextmanagerr   r   r‰   Ú	Parameterr:   r™   r…   r2   r(   r'   ú<module>r¿      sÆ  ðð Ð Ð Ð Ø €€€Ø #Ð #Ð #Ð #Ð #Ð #Ð #Ð #Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7à Ð Ð Ð Ð Ð ð	ð 	ð 	€ð&3Ø”ð&3à�"”)�˜h r¤yÔ1Ð1Ô2ð&3ð &3ð &3ð &3ðRØ”ðà! "¤)¨T°#°s°(¬^Ð";Ô<ðð ðð ˆrŒyˆk˜8 B¤IÔ.Ð.Ô/ð	ð ð ð ð,#Ø”ð#à˜T "¤)œ_Ô-ð#ð ˜œ”^ð#ð �c˜3�h”ð	#ð
 " "¤)¨T°#°s°(¬^Ð";Ô<ð#ð #ð #ð #ð(¨4ð ð ð ð ðð ð ð ð ˆcñ ô ð ð(5ØŒIð5àð5ð ð5ð ˜˜RœYœÔ(ð	5ð
 
ð5ð 5ð 5ð 5ð@"Dð "Dð "Dð "Dð "D�wñ "Dô "Dð "DðJ4'ð 4'ð 4'ð 4'ð 4'�7ñ 4'ô 4'ð 4'ðnØŒIðØ $ðØ8;ðØHPðà	ðð ð ð ð8YØŒIðYàðYð ðYð ˜t B¤IœÔ/ð	Yð
 
ðYð Yð Yð Yð	9ØŒIð	9Ø'/°¤~ð	9Ø@Dð	9ð 	9ð 	9ð 	9ðØŒIðàðð ðð
 
ðð ð ð ð* ˜#˜c™(œ(Ø9=Ø;?ð3Pð 3PØŒIð3Pàð3Pð ð3Pð
 ð3Pð !  T¨"¬)¤_Ô!5Ô6ð3Pð # 3 t¨B¬I¤Ô#7Ô8ð3Pð 
ð3Pð 3Pð 3Pð 3Pðn 57´MÀ2Ä=Ð3QÐ Ô 0Ø24Ô2GÐ1HÐ Ô .ð Ôð Øð Ø+.ð àÐÔ ð ð  ð  ñ Ôð ðF"�”ð "¨cð "°b´ið "ð "ð "ð "ðJ
)�"”)ð 
)¨(ð 
)ÀÄð 
)ð 
)ð 
)ð 
)ð&  %ðGð GØŒIðGàðGð ðGð ˜œ”^ð	Gð
 ˜œÔ%ðGð ðGð ðGð ˆ2Œ9�cˆ>ÔðGð Gð Gð GðT'(ð '(ð '(ð '(ð '(ñ '(ô '(ð '(ð '(ð '(r(   