§
    ‚Štj”B  ã            
       óþ   — d Z ddlZddlZddlZddlmZmZ ddlmZ  ej	        e
¦  «        Z G d„ dej        ¦  «        Z G d„ d	¦  «        Zd
„ Z G d„ d¦  «        Z	 	 	 	 ddedz  dedz  dedz  dedz  fd„Zd„ ZdS )zACollection of utils to be used by backbones and their components.é    Né   )Úhf_apiÚlogging)Úmaybe_install_capturing_hooksc                   ó   — e Zd ZdZdZdS )ÚBackboneTypeÚtimmÚtransformersN)Ú__name__Ú
__module__Ú__qualname__ÚTIMMÚTRANSFORMERS© ó    úY/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/transformers/backbone_utils.pyr   r      s   € € € € € Ø€DØ!€L€L€Lr   r   c                   óê   ‡ — e Zd ZdZdedz  dedz  fd„Zd„ Zed„ ¦   «         Zej	        dee
         fd„¦   «         Zed	„ ¦   «         Zej	        deed
f         ee         z  fd„¦   «         Zˆ fd„Zˆ xZS )ÚBackboneConfigMixinzv
    A Mixin to support handling the `out_features` and `out_indices` attributes for the backbone configurations.
    Úout_featuresNÚout_indicesc                 ó–  ‡ — |‰ _         t          |t          ¦  «        rt          |¦  «        n|‰ _        ‰                      ¦   «          ‰ j         ‰ j        }}|€)|€'t          ‰ j        ¦  «        dz
  g}‰ j        d         g}n%|€|�ˆ fd„|D ¦   «         }n|€|�ˆ fd„|D ¦   «         }||c‰ _         ‰ _        ‰                      ¦   «          dS )ap  
        Sets output indices and features to new values and aligns them with the given `stage_names`.
        If one of the inputs is not given, find the corresponding `out_features` or `out_indices`
        for the given `stage_names`.

        Args:
            out_features (`list[str]`, *optional*):
                The names of the features for the backbone to output. Defaults to `config._out_features` if not provided.
            out_indices (`list[int]` or `tuple[int]`, *optional*):
                The indices of the features for the backbone to output. Defaults to `config._out_indices` if not provided.
        Nr   éÿÿÿÿc                 óD   •— g | ]}‰j                              |¦  «        ‘ŒS r   )Ústage_namesÚindex)Ú.0ÚlayerÚselfs     €r   ú
<listcomp>zJBackboneConfigMixin.set_output_features_output_indices.<locals>.<listcomp>B   s*   ø€ ÐSÐSÐS¸U˜4Ô+×1Ò1°%Ñ8Ô8ÐSÐSÐSr   c                 ó*   •— g | ]}‰j         |         ‘ŒS r   ©r   ©r   Úidxr   s     €r   r   zJBackboneConfigMixin.set_output_features_output_indices.<locals>.<listcomp>D   s!   ø€ ÐIÐIÐI°c˜DÔ,¨SÔ1ÐIÐIÐIr   )Ú_out_featuresÚ
isinstanceÚtupleÚlistÚ_out_indicesÚverify_out_features_out_indicesÚlenr   )r   r   r   s   `  r   Ú"set_output_features_output_indicesz6BackboneConfigMixin.set_output_features_output_indices&   s  ø€ ð  *ˆÔÝ1;¸KÍÑ1OÔ1OÐ`�D Ñ-Ô-Ð-ÐU`ˆÔð 	×,Ò,Ñ.Ô.Ð.ð %)Ô$6¸Ô8I�kˆØÐ <Ð#7Ý˜tÔ/Ñ0Ô0°1Ñ4Ð5ˆKØ Ô,¨RÔ0Ð1ˆLˆLØÐ  \Ð%=ØSÐSÐSÐSÀlÐSÑSÔSˆKˆKØÐ! kÐ&=ØIÐIÐIÐI¸[ÐIÑIÔIˆLð 1=¸kÐ-ˆÔ˜DÔ-Ø×,Ò,Ñ.Ô.Ð.Ð.Ð.r   c                 ó  ‡ — ‰ j         €t          d¦  «        ‚‰ j        ��t          ‰ j        t          f¦  «        s$t          dt          ‰ j        ¦  «        › �¦  «        ‚t          ˆ fd„‰ j        D ¦   «         ¦  «        rt          d‰ j         › d‰ j        › �¦  «        ‚t          ‰ j        ¦  «        t          t          ‰ j        ¦  «        ¦  «        k    rt          d‰ j        › �¦  «        ‚‰ j        ˆ fd„‰ j         D ¦   «         x}k    rt          d	|› d‰ j        › �¦  «        ‚‰ j	        ��]t          ‰ j	        t          ¦  «        s$t          d
t          ‰ j	        ¦  «        › �¦  «        ‚t          ˆ fd„‰ j	        D ¦   «         ¦  «        }t          ˆ fd„|D ¦   «         ¦  «        rt          d‰ j         › d‰ j	        › �¦  «        ‚t          |¦  «        t          t          |¦  «        ¦  «        k    r/d‰ j	        › �}||‰ j	        k    rd|› d�ndz  }t          |¦  «        ‚|t          t          |¦  «        ¦  «        k    rId„ t          t          |‰ j	        ¦  «        d„ ¬¦  «        D ¦   «         }t          d|› d‰ j	        › �¦  «        ‚‰ j        �k‰ j	        �ft          ‰ j        ¦  «        t          ‰ j	        ¦  «        k    rt          d¦  «        ‚‰ j        ˆ fd„‰ j	        D ¦   «         k    rt          d¦  «        ‚dS dS dS )z_
        Verify that out_indices and out_features are valid for the given stage_names.
        Nz2Stage_names must be set for transformers backbonesz out_features must be a list got c              3   ó*   •K  — | ]}|‰j         vV — Œd S ©Nr!   ©r   Úfeatr   s     €r   ú	<genexpr>zFBackboneConfigMixin.verify_out_features_out_indices.<locals>.<genexpr>T   s+   øè è € ÐOÐO°D�4˜tÔ/Ð/ÐOÐOÐOÐOÐOÐOr   z.out_features must be a subset of stage_names: z got z2out_features must not contain any duplicates, got c                 ó&   •— g | ]}|‰j         v ¯|‘ŒS r   ©r$   r/   s     €r   r   zGBackboneConfigMixin.verify_out_features_out_indices.<locals>.<listcomp>[   s&   ø€ Ð aÐ aÐ a¨$ÀdÈdÔN`ÐF`ÐF` ÐF`ÐF`ÐF`r   z@out_features must be in the same order as stage_names, expected z out_indices must be a list, got c              3   óV   •K  — | ]#}|d k     r|t          ‰j        ¦  «        z  n|V — Œ$dS )r   N)r*   r   r"   s     €r   r1   zFBackboneConfigMixin.verify_out_features_out_indices.<locals>.<genexpr>e   sB   øè è € Ð$rÐ$rÐY\ÀCÈ!ÂGÀG S­3¨tÔ/?Ñ+@Ô+@Ñ%@Ð%@ÐQTÐ$rÐ$rÐ$rÐ$rÐ$rÐ$rr   c              3   ób   •K  — | ])}|t          t          ‰j        ¦  «        ¦  «        v¯%|V — Œ*d S r.   )Úranger*   r   r"   s     €r   r1   zFBackboneConfigMixin.verify_out_features_out_indices.<locals>.<genexpr>f   s@   øè è € Ð^Ð^˜3°cÅÅsÈ4ÔK[ÑG\ÔG\ÑA]ÔA]Ð6]Ð6]�3Ð6]Ð6]Ð6]Ð6]Ð^Ð^r   z2out_indices must be valid indices for stage_names z, got z1out_indices must not contain any duplicates, got z(equivalent to z))Ú c                 ó   — g | ]\  }}|‘ŒS r   r   )r   Ú_r#   s      r   r   zGBackboneConfigMixin.verify_out_features_out_indices.<locals>.<listcomp>o   s)   € ð #ð #ð #Ù"˜A˜s�Cð#ð #ð #r   c                 ó   — | d         S )Nr   r   )Úxs    r   ú<lambda>zEBackboneConfigMixin.verify_out_features_out_indices.<locals>.<lambda>p   s   € ÐefÐghÔei€ r   )Úkeyz?out_indices must be in the same order as stage_names, expected zHout_features and out_indices should have the same length if both are setc                 ó*   •— g | ]}‰j         |         ‘ŒS r   r!   r"   s     €r   r   zGBackboneConfigMixin.verify_out_features_out_indices.<locals>.<listcomp>y   s!   ø€ Ð%YÐ%YÐ%YÀ dÔ&6°sÔ&;Ð%YÐ%YÐ%Yr   zQout_features and out_indices should correspond to the same stages if both are set)r   Ú
ValueErrorr$   r%   r'   ÚtypeÚanyr*   Úsetr(   r&   ÚsortedÚzip)r   Úsorted_featsÚpositive_indicesÚmsgÚsorted_negatives   `    r   r)   z3BackboneConfigMixin.verify_out_features_out_indicesJ   s”  ø€ ð ÔÐ#ÝÐQÑRÔRÐRàÔÑ)Ý˜dÔ0µ4°'Ñ:Ô:ð `Ý Ð!^ÅDÈÔI[ÑD\ÔD\Ð!^Ð!^Ñ_Ô_Ð_ÝÐOÐOÐOÐO¸DÔ<NÐOÑOÔOÑOÔOð Ý ØpÀTÔEUÐpÐpÐ\`Ô\nÐpÐpñô ð õ �4Ô%Ñ&Ô&­#­c°$Ô2DÑ.EÔ.EÑ*FÔ*FÒFÐFÝ Ð!jÐVZÔVhÐ!jÐ!jÑkÔkÐkØÔ!Ø aÐ aÐ aÐ a°$Ô2BÐ aÑ aÔ aÐa�òð õ !Ø~ÐWcÐ~Ð~ÐjnÔj|Ð~Ð~ñô ð ð ÔÑ(Ý˜dÔ/µÑ6Ô6ð _Ý Ð!]ÅDÈÔIZÑD[ÔD[Ð!]Ð!]Ñ^Ô^Ð^å$Ð$rÐ$rÐ$rÐ$rÐ`dÔ`qÐ$rÑ$rÔ$rÑrÔrÐÝÐ^Ð^Ð^Ð^Ð"2Ð^Ñ^Ô^Ñ^Ô^ð Ý ØtÈÔIYÐtÐtÐaeÔarÐtÐtñô ð õ Ð#Ñ$Ô$­­CÐ0@Ñ,AÔ,AÑ(BÔ(BÒBÐBØ]È$ÔJ[Ð]Ð]�ØÐAQÐUYÔUfÒAfÐAfÐ=Ð)9Ð=Ð=Ð=Ð=ÐlnÑn�Ý  ‘o”oÐ%Ø¥5­Ð0@Ñ)AÔ)AÑ#BÔ#BÒBÐBð#ð #Ý&,­SÐ1AÀ4ÔCTÑ-UÔ-UÐ[iÐ[iÐ&jÑ&jÔ&jð#ñ #ô #�õ !ØÐVeÐÐÐlpÔl}ÐÐñô ð ð ÔÐ)¨dÔ.?Ð.KÝ�4Ô%Ñ&Ô&­#¨dÔ.?Ñ*@Ô*@Ò@Ð@Ý Ð!kÑlÔlÐlØÔ!Ð%YÐ%YÐ%YÐ%YÀtÔGXÐ%YÑ%YÔ%YÒYÐYÝ Ð!tÑuÔuÐuð	 *Ð)Ð.KÐ.Kð ZÐYr   c                 ó   — | j         S r.   r3   ©r   s    r   r   z BackboneConfigMixin.out_features|   s   € àÔ!Ð!r   c                 ó4   — |                       |d¬¦  «         dS )ú€
        Set the out_features attribute. This will also update the out_indices attribute to match the new out_features.
        N©r   r   )r+   ©r   r   s     r   r   z BackboneConfigMixin.out_features€   s$   € ð
 	×/Ò/¸\ÐW[Ð/Ñ\Ô\Ð\Ð\Ð\r   c                 ó   — | j         S r.   )r(   rJ   s    r   r   zBackboneConfigMixin.out_indices‡   s   € àÔ Ð r   .c                 óZ   — |�t          |¦  «        n|}|                      d|¬¦  «         dS )ú
        Set the out_indices attribute. This will also update the out_features attribute to match the new out_indices.
        NrM   )r'   r+   ©r   r   s     r   r   zBackboneConfigMixin.out_indices‹   s:   € ð
 ,7Ð+B•d˜;Ñ'Ô'Ð'ÈˆØ×/Ò/¸TÈ{Ð/Ñ[Ô[Ð[Ð[Ð[r   c                 ó¬   •— t          ¦   «                              ¦   «         }|                     dd¦  «        |d<   |                     dd¦  «        |d<   |S )z¿
        Serializes this instance to a Python dictionary. Override the default `to_dict()` from `PreTrainedConfig` to
        include the `out_features` and `out_indices` attributes.
        r$   Nr   r(   r   )ÚsuperÚto_dictÚpop)r   ÚoutputÚ	__class__s     €r   rU   zBackboneConfigMixin.to_dict“   sM   ø€ õ
 ‘”—’Ñ"Ô"ˆØ!'§¢¨O¸TÑ!BÔ!Bˆˆ~ÑØ &§
¢
¨>¸4Ñ @Ô @ˆˆ}ÑØˆr   )r   r   r   Ú__doc__r'   r+   r)   Úpropertyr   ÚsetterÚstrr   r&   ÚintrU   Ú__classcell__©rX   s   @r   r   r   !   s/  ø€ € € € € ðð ð"/à˜T‘kð"/ð ˜D‘[ð"/ð "/ð "/ð "/ðH0vð 0vð 0vðd ð"ð "ñ „Xð"ð Ôð]¨¨c¬ð ]ð ]ð ]ñ Ôð]ð ð!ð !ñ „Xð!ð Ôð\ u¨S°#¨X¤¸¸c¼Ñ'Bð \ð \ð \ñ Ôð\ðð ð ð ð ð ð ð ð r   r   c                 óF   ‡ — t          j        ‰ ¦  «        ˆ fd„¦   «         }|S )a»  
    Wrapper for backbone forwards. Backbones always compute `hidden_states` to build their feature maps, so
    this forces `output_hidden_states=True` on the wrapped forward and then removes `hidden_states` from the
    returned object unless the caller explicitly requested them.

    NOTE: We assume a `can_return_tuple` decorator to be applied before so that we always expect a dict like
          object to remove the hidden states.
    c                 óè   •— |                      dt          | j        dd¦  «        ¦  «        }d|d<    ‰| g|¢R i |¤Ž}|s3d„ |                     ¦   «         D ¦   «         } t	          |¦  «        di |¤Ž}|S )NÚoutput_hidden_statesFTc                 ó&   — i | ]\  }}|d k    ¯||“ŒS )Úhidden_statesr   )r   ÚkÚvs      r   ú
<dictcomp>z@filter_output_hidden_states.<locals>.wrapper.<locals>.<dictcomp>®   s(   € Ð#\Ð#\Ð#\©T¨Q°ÀqÈOÒG[ÐG[ A qÐG[ÐG[ÐG[r   r   )ÚgetÚgetattrÚconfigÚitemsr@   )r   ÚargsÚkwargsrb   rW   Úfiltered_output_dataÚforward_functions         €r   Úwrapperz,filter_output_hidden_states.<locals>.wrapper¨   s˜   ø€ à%ŸzšzÐ*@Å'È$Ì+ÐWmÐotÑBuÔBuÑvÔvÐØ)-ˆÐ%Ñ&Ø!Ð! $Ð8¨Ð8Ð8Ð8°Ð8Ð8ˆØ#ð 	:Ø#\Ð#\°V·\²\±^´^Ð#\Ñ#\Ô#\Ð Ø!•T˜&‘\”\Ð9Ð9Ð$8Ð9Ð9ˆFØˆr   )Ú	functoolsÚwraps)ro   rp   s   ` r   Úfilter_output_hidden_statesrs   ž   s;   ø€ õ „_Ð%Ñ&Ô&ðð ð ð ñ 'Ô&ðð €Nr   c                   ó`  ‡ — e Zd ZU dZedz  ed<   dZeed<   dˆ fd„Zˆ fd„Z	dd„Z
dd	„Zed
„ ¦   «         Zej        dee         fd„¦   «         Zed„ ¦   «         Zej        dee         ee         z  fd„¦   «         Zed„ ¦   «         Zed„ ¦   «         Zd„ Z	 	 	 ddedz  dedz  dedz  fd„Zˆ xZS )ÚBackboneMixinNÚbackbone_typeTÚhas_attentionsÚreturnc                 óŒ  •—  t          ¦   «         j        |i |¤Ž |                     dd¦  «        }|�t          j        | _        nt          j        | _        | j        t          j        k    r|                      |¬¦  «         dS | j        t          j        k    r|                      ¦   «          dS t          d| j        › d�¦  «        ‚)z¬
        Method to initialize the backbone. This method is called by the constructor of the base class after the
        pretrained model weights have been loaded.
        Útimm_backboneN)Úbackbonezbackbone_type z not supported.)
rT   Ú__init__rV   r   r   rv   r   Ú_init_timm_backboneÚ_init_transformers_backboner?   )r   rl   rm   rz   rX   s       €r   r|   zBackboneMixin.__init__¼   sÇ   ø€ ð
 	�‰ŒÔ˜$Ð) &Ð)Ð)Ð)ØŸ
š
 ?°DÑ9Ô9ˆØÐ$Ý!-Ô!2ˆDÔÐå!-Ô!:ˆDÔàÔ¥Ô!2Ò2Ð2Ø×$Ò$¨mÐ$Ñ<Ô<Ð<Ð<Ð<ØÔ¥<Ô#<Ò<Ð<Ø×,Ò,Ñ.Ô.Ð.Ð.Ð.åÐQ¨dÔ.@ÐQÐQÐQÑRÔRÐRr   c                 óf   •— t          ¦   «                              ¦   «          t          | ¦  «         dS )a•  
        Override `post_init` to always install capturing hooks, as backbone will ALWAYS capture outputs. We need to do
        it in `post_init`, as modules need to be already instantiated.
        It avoids some mixups with `torch.compile`, as the first hook installation will need/create a graph break,
        which can clash with external user call such as `model = torch.compile(model...)`.
        N)rT   Ú	post_initr   )r   rX   s    €r   r€   zBackboneMixin.post_initÏ   s/   ø€ õ 	‰Œ×ÒÑÔÐÝ% dÑ+Ô+Ð+Ð+Ð+r   c                 óü  — t          | j        dd¦  «        }t          | j        dd¦  «        }d„ |j        j        D ¦   «         | _        d„ |j        j        D ¦   «         | _        t          |j        j        ¦  «        }|j                             ¦   «         }|�||k    rt          d|› d�¦  «        ‚|�|| j        k    rt          d|› d	�¦  «        ‚| j        | j        _        | j         
                    ||¦  «         dS )
zj
        Initialize the backbone model from timm. The backbone must already be loaded to backbone
        r   Nr   c                 ó   — g | ]
}|d          ‘ŒS )Úmoduler   ©r   Ústages     r   r   z5BackboneMixin._init_timm_backbone.<locals>.<listcomp>æ   s   € ÐTÐTÐT°˜E (œOÐTÐTÐTr   c                 ó   — g | ]
}|d          ‘ŒS )Únum_chsr   r„   s     r   r   z5BackboneMixin._init_timm_backbone.<locals>.<listcomp>ç   s   € ÐVÐVÐV°%˜U 9Ô-ÐVÐVÐVr   z!Config has `out_features` set to z‰ which doesn't match `out_features` from backbone's feature_info. Please check if your checkpoint has correct out features/indices saved.z Config has `stage_names` set to z� which doesn't match `stage_names` from backbone's feature_info. Please check if your checkpoint has correct `stage_names` saved.)ri   rj   Úfeature_infoÚinfor   Únum_featuresr'   r   Úmodule_namer?   r+   )r   r{   Úout_features_from_configÚstage_names_from_configr   r   s         r   r}   z!BackboneMixin._init_timm_backboneÛ   s=  € õ
 $+¨4¬;¸ÈÑ#MÔ#MÐ Ý")¨$¬+°}ÀdÑ"KÔ"KÐð
 UÐT¸Ô9NÔ9SÐTÑTÔTˆÔØVÐV¸8Ô;PÔ;UÐVÑVÔVˆÔå˜8Ô0Ô<Ñ=Ô=ˆØÔ,×8Ò8Ñ:Ô:ˆà#Ð/Ð4LÐP\Ò4\Ð4\ÝðxÐ4Lð xð xð xñô ð ð
 #Ð.Ð3JÈdÔN^Ò3^Ð3^ÝðqÐ3Jð qð qð qñô ð ð #'Ô"2ˆŒÔØŒ×6Ò6°|À[ÑQÔQÐQÐQÐQr   c                 óh   — | j         j        | _        | j                              ¦   «          d | _        d S r.   )rj   r   r)   rŠ   rJ   s    r   r~   z)BackboneMixin._init_transformers_backboneü   s1   € Øœ;Ô2ˆÔØŒ×3Ò3Ñ5Ô5Ð5à ˆÔÐÐr   c                 ó   — | j         j        S r.   )rj   r$   rJ   s    r   r   zBackboneMixin.out_features  s   € àŒ{Ô(Ð(r   r   c                 ó   — || j         _        dS )rL   N)rj   r   rN   s     r   r   zBackboneMixin.out_features  s   € ð
 $0ˆŒÔ Ð Ð r   c                 ó   — | j         j        S r.   )rj   r(   rJ   s    r   r   zBackboneMixin.out_indices  s   € àŒ{Ô'Ð'r   r   c                 ó   — || j         _        dS )rQ   N)rj   r   rR   s     r   r   zBackboneMixin.out_indices  s   € ð
 #.ˆŒÔÐÐr   c                 óD   ‡ — ˆ fd„t          ‰ j        ¦  «        D ¦   «         S )Nc                 ó2   •— i | ]\  }}|‰j         |         “ŒS r   )rŠ   )r   Úir…   r   s      €r   rg   z6BackboneMixin.out_feature_channels.<locals>.<dictcomp>  s'   ø€ ÐXÐXÐX±°°5��tÔ(¨Ô+ÐXÐXÐXr   )Ú	enumerater   rJ   s   `r   Úout_feature_channelsz"BackboneMixin.out_feature_channels  s+   ø€ ð YÐXÐXÐX½IÀdÔFVÑ<WÔ<WÐXÑXÔXÐXr   c                 ó*   ‡ — ˆ fd„‰ j         D ¦   «         S )Nc                 ó*   •— g | ]}‰j         |         ‘ŒS r   )r—   )r   Únamer   s     €r   r   z*BackboneMixin.channels.<locals>.<listcomp>   s!   ø€ ÐNÐNÐN°D�Ô)¨$Ô/ÐNÐNÐNr   )r   rJ   s   `r   ÚchannelszBackboneMixin.channels  s    ø€ àNÐNÐNÐN¸DÔ<MÐNÑNÔNÐNr   c                 ó  ‡— | j         s|                     dd ¦  «         | j        t          j        k    rKt          t          j        | j        ¦  «        j	        ¦  «        Šˆfd„| 
                    ¦   «         D ¦   «         } | |i |¤ŽS )NÚoutput_attentionsc                 ó$   •— i | ]\  }}|‰v ¯	||“ŒS r   r   )r   re   rf   Ú	signatures      €r   rg   z>BackboneMixin.forward_with_filtered_kwargs.<locals>.<dictcomp>'  s$   ø€ ÐHÐHÐH™t˜q !¸¸i¸¸�a˜¸¸¸r   )rw   rV   rv   r   r   ÚdictÚinspectrŸ   ÚforwardÚ
parametersrk   )r   rl   rm   rŸ   s      @r   Úforward_with_filtered_kwargsz*BackboneMixin.forward_with_filtered_kwargs"  s‡   ø€ ØÔ"ð 	2Ø�JŠJÐ*¨DÑ1Ô1Ð1ØÔ¥Ô!2Ò2Ð2Ý�WÔ.¨t¬|Ñ<Ô<ÔGÑHÔHˆIØHÐHÐHÐH v§|¢|¡~¤~ÐHÑHÔHˆFØˆt�TÐ$˜VÐ$Ð$Ð$r   rb   r�   Úreturn_dictc                 ó    — t          d¦  «        ‚)Nz7This method should be implemented by the derived class.)ÚNotImplementedError)r   Úpixel_valuesrb   r�   r¥   s        r   r¢   zBackboneMixin.forward*  s   € õ "Ð"[Ñ\Ô\Ð\r   )rx   N)NNN)r   r   r   rv   r   Ú__annotations__rw   Úboolr|   r€   r}   r~   rZ   r   r[   r'   r\   r   r&   r]   r—   r›   r¤   r¢   r^   r_   s   @r   ru   ru   µ   sô  ø€ € € € € € Ø)-€M�< $Ñ&Ð-Ð-Ñ-ð  €N�DÐÐÑðSð Sð Sð Sð Sð Sð&
,ð 
,ð 
,ð 
,ð 
,ðRð Rð Rð RðB!ð !ð !ð !ð ð)ð )ñ „Xð)ð Ôð0¨¨c¬ð 0ð 0ð 0ñ Ôð0ð ð(ð (ñ „Xð(ð Ôð. u¨S¤z°D¸´IÑ'=ð .ð .ð .ñ Ôð.ð ðYð Yñ „XðYð
 ðOð Oñ „XðOð%ð %ð %ð -1Ø)-Ø#'ð]ð ]ð # T™kð]ð   $™;ð	]ð
 ˜D‘[ð]ð ]ð ]ð ]ð ]ð ]ð ]ð ]r   ru   Údefault_backboneÚdefault_config_typeÚdefault_config_kwargsÚtimm_default_kwargsc                 ó   — ddl m} ddlm} |                     dd¦  «        }|                     di ¦  «        }	|                     d¦  «        �|                     d¦  «        n|}
|                     dd ¦  «         |�|r|
�| €|	s |d	         dd|
i|¤Ž} nö|
�x| €vt          ¦   «                              |
¦  «        rD|                     |
¦  «        \  }}||d
                  }| 	                    |	¦  «          |di |¤Ž} n� |d	         dd|
i|	¤Ž} n|| €3|�1t                               d|› d�¦  «         |pi } ||         di |¤Ž} nGt          | t          ¦  «        r2|                      d
¦  «        }||         }|                     | ¦  «        } | |fS )Nr   )ÚPreTrainedConfig)ÚCONFIG_MAPPINGÚuse_timm_backboneTÚbackbone_kwargsr{   Úuse_pretrained_backbonerz   Ú
model_typezG`backbone_config` is `None`. Initializing the config with the default `z` vision config.r   )Úconfiguration_utilsr°   Úmodels.autor±   rV   rh   r   Úrepo_existsÚget_config_dictÚupdateÚloggerr‰   r%   r    Ú	from_dict)Úbackbone_configr«   r¬   r­   r®   rm   r°   r±   r²   r³   r{   Úconfig_dictr9   Úconfig_classÚbackbone_model_types                  r   Ú%consolidate_backbone_kwargs_to_configrÁ   4  s  € ð 6Ð5Ð5Ð5Ð5Ð5Ø+Ð+Ð+Ð+Ð+Ð+àŸ
š
Ð#6¸Ñ=Ô=ÐØ—j’jÐ!2°BÑ7Ô7€OØ)/¯ª°JÑ)?Ô)?Ð)Kˆv�zŠz˜*Ñ%Ô%Ð%ÐQa€HØ
‡J‚JÐ(¨$Ñ/Ô/Ð/ð
 	Ð'Øð 	(àÐ ØÐ#Øð $ð :˜.¨Ô9ÐcÐcÀ8ÐcÐObÐcÐcˆˆØ	Ð	 /Ð"9Ý‰8Œ8×Ò Ñ)Ô)ð 	dØ-×=Ò=¸hÑGÔG‰NˆK˜Ø)¨+°lÔ*CÔDˆLØ×Ò˜Ñ/Ô/Ð/Ø*˜lÐ9Ð9¨[Ð9Ð9ˆOˆOà=˜n¨_Ô=ÐcÐcÀxÐcÐSbÐcÐcˆOˆOØ	Ð	 Ð%8Ð%DÝ�ŠØ{ÐViÐ{Ð{Ð{ñ	
ô 	
ð 	
ð !6Ð ;¸ÐØ=˜.Ð)<Ô=ÐVÐVÐ@UÐVÐVˆˆÝ	�O¥TÑ	*Ô	*ð BØ-×1Ò1°,Ñ?Ô?ÐØ%Ð&9Ô:ˆØ&×0Ò0°ÑAÔAˆà˜FÐ"Ð"r   c                 ó’   — ddl m} t          | dd¦  «        }|€|                     | ¬¦  «        }n|                     |¬¦  «        }|S )a>  
    Loads the backbone model from a config object.

    If the config is from the backbone model itself, then we return a backbone model with randomly initialized
    weights.

    If the config is from the parent model of the backbone model itself, then we load the pretrained backbone weights
    if specified.
    r   )ÚAutoBackboner½   N)rj   )r
   rÃ   ri   Úfrom_config)rj   rÃ   r½   r{   s       r   Úload_backbonerÅ   f  sa   € ð *Ð)Ð)Ð)Ð)Ð)å˜fÐ&7¸Ñ>Ô>€OàÐØ×+Ò+°6Ð+Ñ:Ô:ˆˆà×+Ò+°?Ð+ÑCÔCˆØ€Or   )NNNN)rY   Úenumrq   r¡   Úutilsr   r   Úutils.output_capturingr   Ú
get_loggerr   r»   ÚEnumr   r   rs   ru   r\   r    rÁ   rÅ   r   r   r   ú<module>rË      s†  ðð HÐ Gà €€€Ø Ð Ð Ð Ø €€€à "Ð "Ð "Ð "Ð "Ð "Ð "Ð "Ø AÐ AÐ AÐ AÐ AÐ Að 
ˆÔ	˜HÑ	%Ô	%€ð"ð "ð "ð "ð "�4”9ñ "ô "ð "ð
zð zð zð zð zñ zô zð zðzð ð ð.|]ð |]ð |]ð |]ð |]ñ |]ô |]ð |]ðB $(Ø&*Ø)-Ø'+ð/#ð /#à˜D‘jð/#ð ˜t™ð/#ð   $™;ð	/#ð
  ™ð/#ð /#ð /#ð /#ðdð ð ð ð r   