Ë
    S^(hêë  ã                   óæ  — d Z ddlZddlmZmZmZmZmZmZ ddl	Z
ddlZddlmZ ddlmZmZmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZmZ ddlmZmZmZm Z m!Z!m"Z" ddl#m$Z$ ddl%m&Z&m'Z'm(Z(m)Z) ddl*m+Z+m,Z,m-Z-m.Z.m/Z/ ddl0m1Z1  e«       rddlm2Z2  e.jf                  e4«      Z5dZ6dZ7de8de8dejr                  fd„Z:de8de8dejr                  fd„Z; G d„ dejx                  «      Z= G d„ dejx                  «      Z> G d„ de>«      Z? G d „ d!e>«      Z@ G d"„ d#ejx                  «      ZAe>e?e@d$œZB G d%„ d&ejx                  «      ZC G d'„ d(ejx                  «      ZD G d)„ d*e$«      ZEd+ZFd,ZG e,d-eF«       G d.„ d/eE«      «       ZH e,d0eF«       G d1„ d2eE«      «       ZI e,d3eF«       G d4„ d5eE«      «       ZJ e,d6eF«       G d7„ d8eE«      «       ZK e,d9eF«       G d:„ d;eE«      «       ZL e,d<eF«       G d=„ d>eE«      «       ZMg d?¢ZNy)@zà
PyTorch DistilBERT model adapted in part from Facebook, Inc XLM model (https://github.com/facebookresearch/XLM) and in
part from HuggingFace PyTorch version of Google AI Bert model (https://github.com/google-research/bert)
é    N)ÚDictÚListÚOptionalÚSetÚTupleÚUnion)Únn)ÚBCEWithLogitsLossÚCrossEntropyLossÚMSELossé   )Úget_activation)ÚPretrainedConfig)Úis_deepspeed_zero3_enabled)Ú#_prepare_4d_attention_mask_for_sdpa)Ú!flash_attn_supports_top_left_maskÚis_flash_attn_available)ÚBaseModelOutputÚMaskedLMOutputÚMultipleChoiceModelOutputÚQuestionAnsweringModelOutputÚSequenceClassifierOutputÚTokenClassifierOutput)ÚPreTrainedModel)Úapply_chunking_to_forwardÚ find_pruneable_heads_and_indicesÚ"is_torch_greater_or_equal_than_2_2Úprune_linear_layer)Úadd_code_sample_docstringsÚadd_start_docstringsÚ%add_start_docstrings_to_model_forwardÚloggingÚreplace_return_docstringsé   )ÚDistilBertConfig)Ú_flash_attention_forwardzdistilbert-base-uncasedr%   Ún_posÚdimÚoutc                 ó   — t        «       rZdd l}|j                  j                  |d¬«      5  t        j
                  j                  «       dk(  rt        | ||¬«       d d d «       y t        | ||¬«       y # 1 sw Y   y xY w)Nr   )Úmodifier_rank©r'   r(   r)   )r   Ú	deepspeedÚzeroÚGatheredParametersÚtorchÚdistributedÚget_rankÚ_create_sinusoidal_embeddings)r'   r(   r)   r-   s       úp/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/distilbert/modeling_distilbert.pyÚcreate_sinusoidal_embeddingsr5   G   sr   € Ü!Ô#Ûà�^‰^×.Ñ.¨sÀ!Ð.ÓDñ 	MÜ× Ñ ×)Ñ)Ó+¨qÒ0Ü-°E¸sÈÕL÷	Mð 	Mô 	&¨E°sÀÖD÷		Mð 	Mús   ¬0A4Á4A=c                 ó  — t        j                  t        | «      D ��cg c];  }t        |«      D �cg c]$  }|t        j                  dd|dz  z  |z  «      z  ‘Œ& c}‘Œ= c}}«      }d|_        t        j                  t        j                  |d d …dd d…f   «      «      |d d …dd d…f<   t        j                  t        j                  |d d …dd d…f   «      «      |d d …dd d…f<   |j                  «        y c c}w c c}}w )Ni'  é   Fr   r$   )
ÚnpÚarrayÚrangeÚpowerÚrequires_gradr0   ÚFloatTensorÚsinÚcosÚdetach_)r'   r(   r)   ÚposÚjÚposition_encs         r4   r3   r3   R   sØ   € Ü—8‘8ÔhmÐnsÓht×uÐadÔQVÐWZÓQ[Ö\ÈA˜c¤B§H¡H¨U°A¸¸a¹±LÀ3Ñ4FÓ$GÓGÔ\ÓuÓv€LØ€CÔÜ×$Ñ$¤R§V¡V¨Lº¸A¸D¸q¸D¸Ñ,AÓ%BÓC€CŠˆ1ˆ4ˆaˆ4ˆ�LÜ×$Ñ$¤R§V¡V¨Lº¸A¸D¸q¸D¸Ñ,AÓ%BÓC€CŠˆ1ˆ4ˆaˆ4ˆ�LØ‡K�K…Mùò	 ]ùÓus   žC;
°)C6ÁC;
Ã6C;
c                   ó|   ‡ — e Zd Zdefˆ fd„Zddej                  deej                     dej                  fd„Zˆ xZ	S )Ú
EmbeddingsÚconfigc                 ó
  •— t         ‰| �  «        t        j                  |j                  |j
                  |j                  ¬«      | _        t        j                  |j                  |j
                  «      | _	        t        j                  |j
                  d¬«      | _
        t        j                  |j                  «      | _        | j                  dt        j                  |j                  «      j!                  d«      d¬«       y )N)Úpadding_idxçê-�™—q=©ÚepsÚposition_ids)r$   éÿÿÿÿF)Ú
persistent)ÚsuperÚ__init__r	   Ú	EmbeddingÚ
vocab_sizer(   Úpad_token_idÚword_embeddingsÚmax_position_embeddingsÚposition_embeddingsÚ	LayerNormÚDropoutÚdropoutÚregister_bufferr0   ÚarangeÚexpand©ÚselfrF   Ú	__class__s     €r4   rP   zEmbeddings.__init__[   s´   ø€ Ü‰ÑÔÜ!Ÿ|™|¨F×,=Ñ,=¸v¿z¹zÐW]×WjÑWjÔkˆÔÜ#%§<¡<°×0NÑ0NÐPV×PZÑPZÓ#[ˆÔ äŸ™ f§j¡j°eÔ<ˆŒÜ—z‘z &§.¡.Ó1ˆŒØ×ÑØœEŸL™L¨×)GÑ)GÓH×OÑOÐPWÓXÐejð 	õ 	
ó    Ú	input_idsÚinput_embedsÚreturnc                 ó¢  — |�| j                  |«      }|j                  d«      }t        | d«      r| j                  dd…d|…f   }nPt	        j
                  |t        j                  |j                  ¬«      }|j                  d«      j                  |«      }| j                  |«      }||z   }| j                  |«      }| j                  |«      }|S )a­  
        Parameters:
            input_ids (torch.Tensor):
                torch.tensor(bs, max_seq_length) The token ids to embed.
            input_embeds (*optional*, torch.Tensor):
                The pre-computed word embeddings. Can only be passed if the input ids are `None`.


        Returns: torch.tensor(bs, max_seq_length, dim) The embedded tokens (plus position embeddings, no token_type
        embeddings)
        Nr$   rL   )ÚdtypeÚdevicer   )rT   ÚsizeÚhasattrrL   r0   r[   Úlongrf   Ú	unsqueezeÚ	expand_asrV   rW   rY   )r^   ra   rb   Ú
seq_lengthrL   rV   Ú
embeddingss          r4   ÚforwardzEmbeddings.forwardf   sÃ   € ð Ð Ø×/Ñ/°	Ó:ˆLà!×&Ñ& qÓ)ˆ
ô
 �4˜Ô(Ø×,Ñ,ªQ°°°¨^Ñ<‰Lä Ÿ<™<¨
¼%¿*¹*ÈY×M]ÑM]Ô^ˆLØ'×1Ñ1°!Ó4×>Ñ>¸yÓIˆLà"×6Ñ6°|ÓDÐà!Ð$7Ñ7ˆ
Ø—^‘^ JÓ/ˆ
Ø—\‘\ *Ó-ˆ
ØÐr`   ©N)
Ú__name__Ú
__module__Ú__qualname__r   rP   r0   ÚTensorr   rn   Ú__classcell__©r_   s   @r4   rE   rE   Z   s>   ø„ ð	
Ð/õ 	
ñ §¡ð ¸XÀeÇlÁlÑ=Sð Ð_d×_kÑ_k÷ r`   rE   c                   óè   ‡ — e Zd Zdefˆ fd„Zdee   fd„Z	 	 ddej                  dej                  dej                  dej                  d	e
ej                     d
edeej                  df   fd„Zˆ xZS )ÚMultiHeadSelfAttentionrF   c                 ó*  •— t         ‰| �  «        || _        |j                  | _        |j                  | _        t        j                  |j                  ¬«      | _        d| _	        | j                  | j                  z  dk7  r&t        d| j                  › d| j                  › d�«      ‚t        j                  |j                  |j                  ¬«      | _        t        j                  |j                  |j                  ¬«      | _        t        j                  |j                  |j                  ¬«      | _        t        j                  |j                  |j                  ¬«      | _        t!        «       | _        | j                  | j                  z  | _        y )N©ÚpFr   zself.n_heads: z must divide self.dim: ú evenly©Úin_featuresÚout_features)rO   rP   rF   Ún_headsr(   r	   rX   Úattention_dropoutrY   Ú	is_causalÚ
ValueErrorÚLinearÚq_linÚk_linÚv_linÚout_linÚsetÚpruned_headsÚattention_head_sizer]   s     €r4   rP   zMultiHeadSelfAttention.__init__‰   s  ø€ Ü‰ÑÔØˆŒà—~‘~ˆŒØ—:‘:ˆŒÜ—z‘z F×$<Ñ$<Ô=ˆŒØˆŒð �8‰8�d—l‘lÑ" aÒ'ä˜~¨d¯l©l¨^Ð;RÐSW×S[ÑS[ÐR\Ð\cÐdÓeÐeä—Y‘Y¨6¯:©:ÀFÇJÁJÔOˆŒ
Ü—Y‘Y¨6¯:©:ÀFÇJÁJÔOˆŒ
Ü—Y‘Y¨6¯:©:ÀFÇJÁJÔOˆŒ
Ü—y‘y¨V¯Z©ZÀfÇjÁjÔQˆŒä&)£eˆÔØ#'§8¡8¨t¯|©|Ñ#;ˆÕ r`   Úheadsc                 ó  — t        |«      dk(  ry t        || j                  | j                  | j                  «      \  }}t        | j                  |«      | _        t        | j                  |«      | _        t        | j                  |«      | _        t        | j                  |d¬«      | _	        | j                  t        |«      z
  | _        | j                  | j                  z  | _
        | j                  j                  |«      | _        y )Nr   r$   ©r(   )Úlenr   r   rŠ   r‰   r   r„   r…   r†   r‡   r(   Úunion)r^   r‹   Úindexs      r4   Úprune_headsz"MultiHeadSelfAttention.prune_headsŸ   sÆ   € Üˆu‹:˜Š?ØÜ7Ø�4—<‘< ×!9Ñ!9¸4×;LÑ;Ló
‰ˆˆuô (¨¯
©
°EÓ:ˆŒ
Ü'¨¯
©
°EÓ:ˆŒ
Ü'¨¯
©
°EÓ:ˆŒ
Ü)¨$¯,©,¸À1ÔEˆŒà—|‘|¤c¨%£jÑ0ˆŒØ×+Ñ+¨d¯l©lÑ:ˆŒØ ×-Ñ-×3Ñ3°EÓ:ˆÕr`   ÚqueryÚkeyÚvalueÚmaskÚ	head_maskÚoutput_attentionsrc   .c                 óö  ‡ ‡‡— |j                  «       \  Š}}|j                  d«      }	‰ j                  ‰ j                  z  Š‰dd|	f}
dt        j                  dt        j                  fˆˆˆ fd„}dt        j                  dt        j                  fˆˆˆ fd„} |‰ j                  |«      «      } |‰ j                  |«      «      } |‰ j                  |«      «      }|t        j                  ‰«      z  }t        j                  ||j                  dd«      «      }|dk(  j                  |
«      j                  |«      }|j                  |t        j                  t        j                   |j"                  «      j$                  «      «      }t&        j(                  j+                  |d	¬
«      }‰ j-                  |«      }|�||z  }t        j                  ||«      } ||«      }‰ j/                  |«      }|r||fS |fS )áÌ  
        Parameters:
            query: torch.tensor(bs, seq_length, dim)
            key: torch.tensor(bs, seq_length, dim)
            value: torch.tensor(bs, seq_length, dim)
            mask: torch.tensor(bs, seq_length)

        Returns:
            weights: torch.tensor(bs, n_heads, seq_length, seq_length) Attention weights context: torch.tensor(bs,
            seq_length, dim) Contextualized layer. Optional: only if `output_attentions=True`
        r$   Úxrc   c                 ó`   •— | j                  ‰d‰j                  ‰«      j                  dd«      S ©úseparate headsrM   r$   r7   ©Úviewr   Ú	transpose©rš   ÚbsÚdim_per_headr^   s    €€€r4   Úshapez-MultiHeadSelfAttention.forward.<locals>.shapeÌ   s)   ø€ à—6‘6˜"˜b $§,¡,°Ó=×GÑGÈÈ1ÓMÐMr`   c                 ó€   •— | j                  dd«      j                  «       j                  ‰d‰j                  ‰z  «      S ©zgroup headsr$   r7   rM   ©r    Ú
contiguousrŸ   r   r¡   s    €€€r4   Úunshapez/MultiHeadSelfAttention.forward.<locals>.unshapeÐ   s5   ø€ à—;‘;˜q !Ó$×/Ñ/Ó1×6Ñ6°r¸2¸t¿|¹|ÈlÑ?ZÓ[Ð[r`   r7   r   r   rM   r�   )rg   r(   r   r0   rs   r„   r…   r†   ÚmathÚsqrtÚmatmulr    rŸ   rk   Úmasked_fillÚtensorÚfinfore   Úminr	   Ú
functionalÚsoftmaxrY   r‡   )r^   r’   r“   r”   r•   r–   r—   Úq_lengthr(   Úk_lengthÚ
mask_reshpr¤   r©   ÚqÚkÚvÚscoresÚweightsÚcontextr¢   r£   s   `                  @@r4   rn   zMultiHeadSelfAttention.forward¯   s³  ú€ ð( "ŸJ™J›LÑˆˆH�cØ—8‘8˜A“;ˆð —x‘x 4§<¡<Ñ/ˆà˜!˜Q Ð)ˆ
ð	N”U—\‘\ð 	N¤e§l¡l÷ 	Nð	\”u—|‘|ð 	\¬¯©÷ 	\ñ �$—*‘*˜UÓ#Ó$ˆÙ�$—*‘*˜S“/Ó"ˆÙ�$—*‘*˜UÓ#Ó$ˆà”—	‘	˜,Ó'Ñ'ˆÜ—‘˜a §¡¨Q°Ó!2Ó3ˆØ˜‘	×Ñ 
Ó+×5Ñ5°fÓ=ˆØ×#Ñ#Ø”%—,‘,œuŸ{™{¨6¯<©<Ó8×<Ñ<Ó=ó
ˆô —-‘-×'Ñ'¨°BÐ'Ó7ˆØ—,‘,˜wÓ'ˆð Ð Ø 	Ñ)ˆGä—,‘,˜w¨Ó*ˆÙ˜'Ó"ˆØ—,‘,˜wÓ'ˆáØ˜WÐ%Ð%à�:Ðr`   ©NF)rp   rq   rr   r   rP   r   Úintr‘   r0   rs   r   Úboolr   rn   rt   ru   s   @r4   rw   rw   ˆ   s˜   ø„ ð<Ð/õ <ð,;  c¡ó ;ð, -1Ø"'ñ>à�|‰|ð>ð �\‰\ð>ð �|‰|ð	>ð
 �l‰lð>ð ˜EŸL™LÑ)ð>ð  ð>ð 
ˆu�|‰|˜SÐ Ñ	!÷>r`   rw   c                   óÔ   ‡ — e Zd ZdZˆ fd„Z	 	 ddej                  dej                  dej                  dej                  deej                     ded	e	ej                  d
f   fd„Z
ˆ xZS )ÚDistilBertFlashAttention2aS  
    DistilBert flash attention module. This module inherits from `MultiHeadSelfAttention` as the weights of the module
    stays untouched. The only required change would be on the forward pass where it needs to correctly call the public
    API of flash attention and deal with padding tokens in case the input contains any of them.
    c                 óB   •— t        ‰| �  |i |¤Ž t        «       | _        y ro   )rO   rP   r   Ú_flash_attn_uses_top_left_mask)r^   ÚargsÚkwargsr_   s      €r4   rP   z"DistilBertFlashAttention2.__init__÷   s#   ø€ Ü‰Ñ˜$Ð) &Ò)ô
 /PÓ.QˆÕ+r`   r’   r“   r”   r•   r–   r—   rc   .c           
      ó  ‡ ‡‡— |j                  «       \  Š}}‰ j                  ‰ j                  z  Šdt        j                  dt        j                  fˆˆˆ fd„}	 |	‰ j                  |«      «      }
 |	‰ j                  |«      «      } |	‰ j                  |«      «      }‰ j                  r‰ j                  j                  nd}|
j                  t        j                  k(  rÂt        j                  «       rt        j                  «       }nMt        ‰ j                  d«      r‰ j                  j                   }n ‰ j
                  j"                  j                  }t$        j'                  d|› d�«       |
j)                  |«      }
|j)                  |«      }|j)                  |«      }t+        |
|||||‰ j,                  ‰ j.                  ¬«      }|j1                  ‰|‰ j                  ‰z  «      }‰ j3                  |«      }|r||fS |fS )	r™   rš   rc   c                 ó@   •— | j                  ‰d‰j                  ‰«      S )r�   rM   )rŸ   r   ©rš   Ú
batch_sizer£   r^   s    €€€r4   Úreshapez2DistilBertFlashAttention2.forward.<locals>.reshape  s   ø€ à—6‘6˜* b¨$¯,©,¸ÓEÐEr`   ç        Ú_pre_quantization_dtypez¾The input hidden states seems to be silently casted in float32, this might be related to the fact you have upcasted embedding or layer norm layers in float32. We will cast back the input in ú.)rY   Úuse_top_left_maskr�   )rg   r(   r   r0   rs   r„   r…   r†   ÚtrainingrF   r€   re   Úfloat32Úis_autocast_enabledÚget_autocast_gpu_dtyperh   rË   ÚweightÚloggerÚwarning_onceÚtor&   rÂ   r�   rÉ   r‡   )r^   r’   r“   r”   r•   r–   r—   r³   r(   rÉ   Úquery_statesÚ
key_statesÚvalue_statesÚattn_dropoutÚtarget_dtypeÚattn_weightsÚattn_weights_reshapedÚattn_outputrÈ   r£   s   `                 @@r4   rn   z!DistilBertFlashAttention2.forwardÿ   s¶  ú€ ð( %*§J¡J£LÑ!ˆ
�H˜cà—x‘x 4§<¡<Ñ/ˆð	F”u—|‘|ð 	F¬¯©÷ 	Fñ ˜tŸz™z¨%Ó0Ó1ˆÙ˜TŸZ™Z¨›_Ó-ˆ
Ù˜tŸz™z¨%Ó0Ó1ˆà8<¿º�t—{‘{×4Ò4È3ˆð ×Ñ¤§¡Ò.Ü×(Ñ(Ô*Ü$×;Ñ;Ó=‘ä˜Ÿ™Ð&?Ô@Ø#Ÿ{™{×BÑB‘à#Ÿz™z×0Ñ0×6Ñ6�ä×Ñðà �> ð$ôð (Ÿ?™?¨<Ó8ˆLØ#Ÿ™ |Ó4ˆJØ'Ÿ?™?¨<Ó8ˆLä/ØØØØØØ Ø"×AÑAØ—n‘nô	
ˆð !-× 4Ñ 4°ZÀÈ4Ï<É<ÐZfÑKfÓ gÐØ—l‘lÐ#8Ó9ˆáØ Ð.Ð.à�>Ð!r`   r¼   )rp   rq   rr   Ú__doc__rP   r0   rs   r   r¾   r   rn   rt   ru   s   @r4   rÀ   rÀ   ð   sŽ   ø„ ñôRð -1Ø"'ñN"à�|‰|ðN"ð �\‰\ðN"ð �|‰|ð	N"ð
 �l‰lðN"ð ˜EŸL™LÑ)ðN"ð  ðN"ð 
ˆu�|‰|˜SÐ Ñ	!÷N"r`   rÀ   c                   óÚ   ‡ — e Zd Zdefˆ fd„Z	 	 ddej                  dej                  dej                  dej                  deej                     ded	e	ej                  d
f   fˆ fd„Z
ˆ xZS )ÚDistilBertSdpaAttentionrF   c                 ó`   •— t         ‰| �  |¬«       |j                  | _        t         | _        y )N)rF   )rO   rP   r€   Údropout_probr   Úrequire_contiguous_qkvr]   s     €r4   rP   z DistilBertSdpaAttention.__init__Q  s,   ø€ Ü‰Ñ ÐÔ'Ø"×4Ñ4ˆÔÜ*LÐ&LˆÕ#r`   r’   r“   r”   r•   r–   r—   rc   .c                 ó\  •‡ ‡‡— |s|�)t         j                  d«       t        ‰‰ �  ||||||«      S |j	                  «       \  Š}}‰ j
                  ‰ j                  z  Šdt        j                  dt        j                  fˆˆˆ fd„}dt        j                  dt        j                  fˆˆˆ fd„}	 |‰ j                  |«      «      }
 |‰ j                  |«      «      } |‰ j                  |«      «      }‰ j                  rK|
j                  j                  dk(  r2|�0|
j                  «       }
|j                  «       }|j                  «       }t        j                   j"                  j%                  |
|||‰ j&                  r‰ j(                  ndd¬	«      } |	|«      }‰ j+                  |«      }|fS )
r™   aŽ  DistilBertSdpaAttention is used but `torch.nn.functional.scaled_dot_product_attention` does not support `output_attentions=True` or `head_mask`. Falling back to the manual attention implementation, but specifying the manual implementation will be required from Transformers version v5.0.0 onwards. This warning can be removed using the argument `attn_implementation="eager"` when loading the model.rš   rc   c                 ó`   •— | j                  ‰d‰j                  ‰«      j                  dd«      S rœ   rž   rÇ   s    €€€r4   r¤   z.DistilBertSdpaAttention.forward.<locals>.shape}  s+   ø€ à—6‘6˜* b¨$¯,©,¸ÓE×OÑOÐPQÐSTÓUÐUr`   c                 ó€   •— | j                  dd«      j                  «       j                  ‰d‰j                  ‰z  «      S r¦   r§   rÇ   s    €€€r4   r©   z0DistilBertSdpaAttention.forward.<locals>.unshape�  s6   ø€ à—;‘;˜q !Ó$×/Ñ/Ó1×6Ñ6°zÀ2ÀtÇ|Á|ÐVbÑGbÓcÐcr`   ÚcudarÊ   F)Ú	attn_maskÚ	dropout_pr�   )rÓ   rÔ   rO   rn   rg   r(   r   r0   rs   r„   r…   r†   rã   rf   Útyper¨   r	   r±   Úscaled_dot_product_attentionrÎ   râ   r‡   )r^   r’   r“   r”   r•   r–   r—   Ú_r¤   r©   r¶   r·   r¸   rÝ   rÈ   r£   r_   s   `             @@€r4   rn   zDistilBertSdpaAttention.forwardV  s„  û€ ñ(  	Ð 5Ü×Ñðdôô ‘7‘?ØØØØØØ!óð ð !Ÿ:™:›<Ñˆ
�A�qØ—x‘x 4§<¡<Ñ/ˆð	V”U—\‘\ð 	V¤e§l¡l÷ 	Vð	d”u—|‘|ð 	d¬¯©÷ 	dñ �$—*‘*˜UÓ#Ó$ˆÙ�$—*‘*˜S“/Ó"ˆÙ�$—*‘*˜UÓ#Ó$ˆð
 ×&Ò&¨1¯8©8¯=©=¸FÒ+BÀtÐGWØ—‘“ˆAØ—‘“ˆAØ—‘“ˆAä—h‘h×)Ñ)×FÑFØØØØØ+/¯=ª=�d×'Ò'¸cØð Gó 
ˆñ ˜kÓ*ˆØ—l‘l ;Ó/ˆàˆ~Ðr`   r¼   ©rp   rq   rr   r   rP   r0   rs   r   r¾   r   rn   rt   ru   s   @r4   rà   rà   P  s˜   ø„ ðMÐ/õ Mð -1Ø"'ñGà�|‰|ðGð �\‰\ðGð �|‰|ð	Gð
 �l‰lðGð ˜EŸL™LÑ)ðGð  ðGð 
ˆu�|‰|˜SÐ Ñ	!÷Gñ Gr`   rà   c                   ó”   ‡ — e Zd Zdefˆ fd„Zdej                  dej                  fd„Zdej                  dej                  fd„Zˆ xZ	S )ÚFFNrF   c                 ó�  •— t         ‰| �  «        t        j                  |j                  ¬«      | _        |j
                  | _        d| _        t        j                  |j                  |j                  ¬«      | _
        t        j                  |j                  |j                  ¬«      | _        t        |j                  «      | _        y )Nry   r$   r|   )rO   rP   r	   rX   rY   Úchunk_size_feed_forwardÚseq_len_dimrƒ   r(   Ú
hidden_dimÚlin1Úlin2r   Ú
activationr]   s     €r4   rP   zFFN.__init__¡  s‚   ø€ Ü‰ÑÔÜ—z‘z F§N¡NÔ3ˆŒØ'-×'EÑ'EˆÔ$ØˆÔÜ—I‘I¨&¯*©*À6×CTÑCTÔUˆŒ	Ü—I‘I¨&×*;Ñ*;È&Ï*É*ÔUˆŒ	Ü(¨×):Ñ):Ó;ˆ�r`   Úinputrc   c                 óZ   — t        | j                  | j                  | j                  |«      S ro   )r   Úff_chunkrñ   rò   )r^   r÷   s     r4   rn   zFFN.forwardª  s%   € Ü(¨¯©¸×8TÑ8TÐVZ×VfÑVfÐhmÓnÐnr`   c                 óŽ   — | j                  |«      }| j                  |«      }| j                  |«      }| j                  |«      }|S ro   )rô   rö   rõ   rY   )r^   r÷   rš   s      r4   rù   zFFN.ff_chunk­  s=   € Ø�I‰I�eÓˆØ�O‰O˜AÓˆØ�I‰I�a‹LˆØ�L‰L˜‹OˆØˆr`   )
rp   rq   rr   r   rP   r0   rs   rn   rù   rt   ru   s   @r4   rï   rï      sI   ø„ ð<Ð/õ <ðo˜UŸ\™\ð o¨e¯l©ló oð˜eŸl™lð ¨u¯|©|÷ r`   rï   )ÚeagerÚflash_attention_2Úsdpac                   ó®   ‡ — e Zd Zdefˆ fd„Z	 	 	 d
dej                  deej                     deej                     dede	ej                  df   f
d	„Z
ˆ xZS )ÚTransformerBlockrF   c                 ó˜  •— t         ‰| �  «        |j                  |j                  z  dk7  r&t	        d|j                  › d|j                  › d�«      ‚t        |j                     |«      | _        t        j                  |j                  d¬«      | _
        t        |«      | _        t        j                  |j                  d¬«      | _        y )Nr   zconfig.n_heads z must divide config.dim r{   rI   )Únormalized_shaperK   )rO   rP   r(   r   r‚   ÚDISTILBERT_ATTENTION_CLASSESÚ_attn_implementationÚ	attentionr	   rW   Úsa_layer_normrï   ÚffnÚoutput_layer_normr]   s     €r4   rP   zTransformerBlock.__init__½  sŸ   ø€ Ü‰ÑÔð �:‰:˜Ÿ™Ñ&¨!Ò+Ü˜¨v¯~©~Ð.>Ð>VÐW]×WaÑWaÐVbÐbiÐjÓkÐkä5°f×6QÑ6QÑRÐSYÓZˆŒÜŸ\™\¸6¿:¹:È5ÔQˆÔä�v“;ˆŒÜ!#§¡¸v¿z¹zÈuÔ!UˆÕr`   rš   rè   r–   r—   rc   .c                 ó(  — | j                  ||||||¬«      }|r|\  }}n.t        |«      t        urt        dt        |«      › d�«      ‚|d   }| j	                  ||z   «      }| j                  |«      }| j                  ||z   «      }|f}|rf|z   }|S )ae  
        Parameters:
            x: torch.tensor(bs, seq_length, dim)
            attn_mask: torch.tensor(bs, seq_length)

        Returns:
            sa_weights: torch.tensor(bs, n_heads, seq_length, seq_length) The attention weights ffn_output:
            torch.tensor(bs, seq_length, dim) The output of the transformer block contextualization.
        )r’   r“   r”   r•   r–   r—   z$sa_output must be a tuple but it is z typer   )r  rê   ÚtupleÚ	TypeErrorr  r  r  )	r^   rš   rè   r–   r—   Ú	sa_outputÚ
sa_weightsÚ
ffn_outputÚoutputs	            r4   rn   zTransformerBlock.forwardÊ  s¼   € ð" —N‘NØØØØØØ/ð #ó 
ˆ	ñ Ø$-Ñ!ˆI‘zä�I‹¤eÑ+ÜÐ"FÄtÈIÃÐFWÐW\Ð ]Ó^Ð^à! !™ˆIØ×&Ñ& y°1¡}Ó5ˆ	ð —X‘X˜iÓ(ˆ
Ø#'×#9Ñ#9¸*ÀyÑ:PÓ#Qˆ
à�ˆÙØ �] VÑ+ˆFØˆr`   )NNFrí   ru   s   @r4   rÿ   rÿ   ¼  sv   ø„ ðVÐ/õ Vð  -1Ø,0Ø"'ñ)à�<‰<ð)ð ˜EŸL™LÑ)ð)ð ˜EŸL™LÑ)ð	)ð
  ð)ð 
ˆu�|‰|˜SÐ Ñ	!÷)r`   rÿ   c                   óÊ   ‡ — e Zd Zdefˆ fd„Z	 	 	 	 	 ddej                  deej                     deej                     dededee   d	e	e
eej                  d
f   f   fd„Zˆ xZS )ÚTransformerrF   c                 óä   •— t         ‰| �  «        |j                  | _        t        j                  t        |j                  «      D �cg c]  }t        |«      ‘Œ c}«      | _        d| _        y c c}w r¼   )	rO   rP   Ún_layersr	   Ú
ModuleListr:   rÿ   ÚlayerÚgradient_checkpointing)r^   rF   rì   r_   s      €r4   rP   zTransformer.__init__÷  sQ   ø€ Ü‰ÑÔØŸ™ˆŒÜ—]‘]ÄeÈFÏOÉOÓF\Ö#]ÀÔ$4°VÕ$<Ò#]Ó^ˆŒ
Ø&+ˆÕ#ùò $^s   ÁA-rš   rè   r–   r—   Úoutput_hidden_statesÚreturn_dictrc   .c                 ó  — |rdnd}|rdnd}|}	t        | j                  «      D ]³  \  }
}|r||	fz   }| j                  r/| j                  r#| j	                  |j
                  |	|||
   |«      }n ||	|||
   |«      }|d   }	|r1t        |«      dk7  rt        dt        |«      › �«      ‚|d   }||fz   }Œ�t        |«      dk7  sŒžt        dt        |«      › �«      ‚ |r||	fz   }|st        d	„ |	||fD «       «      S t        |	||¬
«      S )aò  
        Parameters:
            x: torch.tensor(bs, seq_length, dim) Input sequence embedded.
            attn_mask: torch.tensor(bs, seq_length) Attention mask on the sequence.

        Returns:
            hidden_state: torch.tensor(bs, seq_length, dim) Sequence of hidden states in the last (top)
            layer all_hidden_states: Tuple[torch.tensor(bs, seq_length, dim)]
                Tuple of length n_layers with the hidden states from each layer.
                Optional: only if output_hidden_states=True
            all_attentions: Tuple[torch.tensor(bs, n_heads, seq_length, seq_length)]
                Tuple of length n_layers with the attention weights from each layer
                Optional: only if output_attentions=True
        © NrM   r7   z7The length of the layer_outputs should be 2, but it is r   r$   z7The length of the layer_outputs should be 1, but it is c              3   ó&   K  — | ]	  }|€Œ|–— Œ y ­wro   r  )Ú.0r¸   s     r4   ú	<genexpr>z&Transformer.forward.<locals>.<genexpr>=  s   è ø€ Òg˜qÐYZÑYfœÑgùs   ‚Š)Úlast_hidden_stateÚhidden_statesÚ
attentions)
Ú	enumerater  r  rÎ   Ú_gradient_checkpointing_funcÚ__call__rŽ   r‚   r	  r   )r^   rš   rè   r–   r—   r  r  Úall_hidden_statesÚall_attentionsÚhidden_stateÚiÚlayer_moduleÚlayer_outputsr  s                 r4   rn   zTransformer.forwardý  sX  € ñ. #7™B¸DÐÙ0™°dˆàˆÜ(¨¯©Ó4ò 	u‰OˆAˆ|Ù#Ø$5¸¸Ñ$GÐ!à×*Ò*¨t¯}ª}Ø $× AÑ AØ ×)Ñ)Ø ØØ˜a‘LØ%ó!‘ñ !-Ø ØØ˜a‘LØ%ó	!�ð )¨Ñ,ˆLá Ü�}Ó%¨Ò*Ü$Ð'^Ô_bÐcpÓ_qÐ^rÐ%sÓtÐtà*¨1Ñ-�
Ø!/°:°-Ñ!?‘ä�}Ó%¨Ó*Ü$Ð'^Ô_bÐcpÓ_qÐ^rÐ%sÓtÐtð=	uñB  Ø 1°\°OÑ CÐáÜÑg \Ð3DÀnÐ$UÔgÓgÐgÜØ*Ð:KÐXfô
ð 	
r`   )NNFFN)rp   rq   rr   r   rP   r0   rs   r   r¾   r   r   r   rn   rt   ru   s   @r4   r  r  ö  s¤   ø„ ð,Ð/õ ,ð -1Ø,0Ø"'Ø%*Ø&*ñC
à�<‰<ðC
ð ˜EŸL™LÑ)ðC
ð ˜EŸL™LÑ)ð	C
ð
  ðC
ð #ðC
ð ˜d‘^ðC
ð 
ˆ  e§l¡l°CÐ&7Ñ 8Ð8Ñ	9÷C
r`   r  c                   óH   — e Zd ZdZeZdZdZdZdZ	dZ
dej                  fd„Zy)ÚDistilBertPreTrainedModelz†
    An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
    models.
    NÚ
distilbertTÚmodulec                 óä  — t        |t        j                  «      rm|j                  j                  j                  d| j                  j                  ¬«       |j                  �%|j                  j                  j                  «        yyt        |t        j                  «      rz|j                  j                  j                  d| j                  j                  ¬«       |j                  �2|j                  j                  |j                     j                  «        yyt        |t        j                  «      rJ|j                  j                  j                  «        |j                  j                  j                  d«       yt        |t        «      ra| j                  j                  rJt!        | j                  j"                  | j                  j$                  |j&                  j                  «       yyy)zInitialize the weights.rÊ   )ÚmeanÚstdNg      ð?)Ú
isinstancer	   rƒ   rÒ   ÚdataÚnormal_rF   Úinitializer_rangeÚbiasÚzero_rQ   rH   rW   Úfill_rE   Úsinusoidal_pos_embdsr5   rU   r(   rV   )r^   r,  s     r4   Ú_init_weightsz'DistilBertPreTrainedModel._init_weightsQ  sM  € ä�fœbŸi™iÔ(ð �M‰M×Ñ×&Ñ&¨C°T·[±[×5RÑ5RÐ&ÔSØ�{‰{Ð&Ø—‘× Ñ ×&Ñ&Õ(ð 'ä˜¤§¡Ô-Ø�M‰M×Ñ×&Ñ&¨C°T·[±[×5RÑ5RÐ&ÔSØ×!Ñ!Ð-Ø—‘×"Ñ" 6×#5Ñ#5Ñ6×<Ñ<Õ>ð .ä˜¤§¡Ô-Ø�K‰K×Ñ×"Ñ"Ô$Ø�M‰M×Ñ×$Ñ$ SÕ)Ü˜¤
Ô+°·±×0PÒ0PÜ(Ø—‘×3Ñ3°T·[±[·_±_Àf×F`ÑF`×FgÑFgõð 1QÐ+r`   )rp   rq   rr   rÞ   r%   Úconfig_classÚload_tf_weightsÚbase_model_prefixÚsupports_gradient_checkpointingÚ_supports_flash_attn_2Ú_supports_sdpar	   ÚModuler8  r  r`   r4   r*  r*  D  s:   „ ñð
 $€LØ€OØ$ÐØ&*Ð#Ø!ÐØ€Nð B§I¡Iô r`   r*  aD  

    This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
    library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
    etc.)

    This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
    Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
    and behavior.

    Parameters:
        config ([`DistilBertConfig`]): Model configuration class with all the parameters of the model.
            Initializing with a config file does not load the weights associated with the model, only the
            configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
a‡  
    Args:
        input_ids (`torch.LongTensor` of shape `({0})`):
            Indices of input sequence tokens in the vocabulary.

            Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
            [`PreTrainedTokenizer.__call__`] for details.

            [What are input IDs?](../glossary#input-ids)
        attention_mask (`torch.FloatTensor` of shape `({0})`, *optional*):
            Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:

            - 1 for tokens that are **not masked**,
            - 0 for tokens that are **masked**.

            [What are attention masks?](../glossary#attention-mask)
        head_mask (`torch.FloatTensor` of shape `(num_heads,)` or `(num_layers, num_heads)`, *optional*):
            Mask to nullify selected heads of the self-attention modules. Mask values selected in `[0, 1]`:

            - 1 indicates the head is **not masked**,
            - 0 indicates the head is **masked**.

        inputs_embeds (`torch.FloatTensor` of shape `({0}, hidden_size)`, *optional*):
            Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This
            is useful if you want more control over how to convert `input_ids` indices into associated vectors than the
            model's internal embedding lookup matrix.
        output_attentions (`bool`, *optional*):
            Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
            tensors for more detail.
        output_hidden_states (`bool`, *optional*):
            Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
            more detail.
        return_dict (`bool`, *optional*):
            Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
zfThe bare DistilBERT encoder/transformer outputting raw hidden-states without any specific head on top.c                   óÜ  ‡ — e Zd Zdefˆ fd„Zdej                  fd„Zdefd„Z	dej                  fd„Z
dej                  fd	„Zd
eeeee      f   fd„Z eej#                  d«      «       eeee¬«      	 	 	 	 	 	 	 ddeej0                     deej0                     deej0                     deej0                     dee   dee   dee   deeeej0                  df   f   fd„«       «       Zˆ xZS )ÚDistilBertModelrF   c                 óÔ   •— t         ‰| �  |«       t        |«      | _        t	        |«      | _        |j                  dk(  | _        |j                  dk(  | _        | j                  «        y )Nrü   rý   )
rO   rP   rE   rm   r  Útransformerr  Ú_use_flash_attention_2Ú	_use_sdpaÚ	post_initr]   s     €r4   rP   zDistilBertModel.__init__   s[   ø€ Ü‰Ñ˜Ô ä$ VÓ,ˆŒÜ& vÓ.ˆÔØ&,×&AÑ&AÐEXÑ&XˆÔ#Ø×4Ñ4¸Ñ>ˆŒð 	�‰Õr`   rc   c                 ó.   — | j                   j                  S ©z1
        Returns the position embeddings
        )rm   rV   ©r^   s    r4   Úget_position_embeddingsz'DistilBertModel.get_position_embeddings«  s   € ð �‰×2Ñ2Ð2r`   Únew_num_position_embeddingsc                 óÚ  — || j                   j                  z
  }|dk(  ryt        j                  d|› d�«       || j                   _        | j                  j
                  j                  j                  «       }t        j                  | j                   j                  | j                   j                  «      | j                  _        | j                   j                  rKt        | j                   j                  | j                   j                  | j
                  j                  ¬«       n‹t        j                  «       5  |dkD  r8t        j                  |«      | j                  j
                  j                  d|  n1t        j                  |d| «      | j                  j
                  _        ddd«       | j                  j
                  j!                  | j"                  «       y# 1 sw Y   Œ9xY w)áÒ  
        Resizes position embeddings of the model if `new_num_position_embeddings != config.max_position_embeddings`.

        Arguments:
            new_num_position_embeddings (`int`):
                The number of new position embedding matrix. If position embeddings are learned, increasing the size
                will add newly initialized vectors at the end, whereas reducing the size will remove vectors from the
                end. If position embeddings are not learned (*e.g.* sinusoidal position embeddings), increasing the
                size will add correct vectors at the end following the position encoding algorithm, whereas reducing
                the size will remove vectors from the end.
        r   Nz(Setting `config.max_position_embeddings=z`...r,   )rF   rU   rÓ   Úinform   rV   rÒ   Úcloner	   rQ   r(   r7  r5   r0   Úno_gradÚ	ParameterrÕ   rf   )r^   rK  Únum_position_embeds_diffÚold_position_embeddings_weights       r4   Úresize_position_embeddingsz*DistilBertModel.resize_position_embeddings±  su  € ð $?ÀÇÁ×AdÑAdÑ#dÐ ð $ qÒ(Øä�‰Ð>Ð?ZÐ>[Ð[_Ð`ÔaØ.Iˆ�‰Ô+à)-¯©×)LÑ)L×)SÑ)S×)YÑ)YÓ)[Ð&ä.0¯l©l¸4¿;¹;×;^Ñ;^Ð`d×`kÑ`k×`oÑ`oÓ.pˆ�‰Ô+à�;‰;×+Ò+Ü(Ø—k‘k×9Ñ9¸t¿{¹{¿¹ÐTX×TlÑTl×TsÑTsöô —‘“ñ Ø+¨aÒ/Ü]_×]iÑ]iØ6ó^�D—O‘O×7Ñ7×>Ñ>Ð?YÐAYÐ@YÑZô BDÇÁØ6Ð7PÐ8PÐQóB�D—O‘O×7Ñ7Ô>÷ð 	�‰×+Ñ+×.Ñ.¨t¯{©{Õ;÷ð ús   Ä:A/G!Ç!G*c                 ó.   — | j                   j                  S ro   ©rm   rT   rI  s    r4   Úget_input_embeddingsz$DistilBertModel.get_input_embeddingsÛ  s   € Ø�‰×.Ñ.Ð.r`   Únew_embeddingsc                 ó&   — || j                   _        y ro   rV  ©r^   rX  s     r4   Úset_input_embeddingsz$DistilBertModel.set_input_embeddingsÞ  s   € Ø*8ˆ�‰Õ'r`   Úheads_to_prunec                 ó˜   — |j                  «       D ]7  \  }}| j                  j                  |   j                  j	                  |«       Œ9 y)z�
        Prunes heads of the model. heads_to_prune: dict of {layer_num: list of heads to prune in this layer} See base
        class PreTrainedModel
        N)ÚitemsrC  r  r  r‘   )r^   r\  r  r‹   s       r4   Ú_prune_headszDistilBertModel._prune_headsá  sG   € ð
 +×0Ñ0Ó2ò 	G‰LˆE�5Ø×Ñ×"Ñ" 5Ñ)×3Ñ3×?Ñ?ÀÕFñ	Gr`   úbatch_size, num_choices©Ú
checkpointÚoutput_typer9  ra   Úattention_maskr–   Úinputs_embedsr—   r  r  .c                 óØ  — |�|n| j                   j                  }|�|n| j                   j                  }|�|n| j                   j                  }|�|�t	        d«      ‚|�#| j                  ||«       |j                  «       }n!|�|j                  «       d d }nt	        d«      ‚|�|j                  n|j                  }	|d u }
| j                  || j                   j                  «      }| j                  ||«      }| j                  r|�d|v r|nd }nD|€t        j                  ||	¬«      }| j                  r|
r|st        ||j                   |d   ¬«      }| j#                  ||||||¬«      S )	NzDYou cannot specify both input_ids and inputs_embeds at the same timerM   z5You have to specify either input_ids or inputs_embedsr   )rf   r$   )Útgt_len)rš   rè   r–   r—   r  r  )rF   r—   r  Úuse_return_dictr‚   Ú%warn_if_padding_and_no_attention_maskrg   rf   Úget_head_maskÚnum_hidden_layersrm   rD  r0   ÚonesrE  r   re   rC  )r^   ra   rd  r–   re  r—   r  r  Úinput_shaperf   Úhead_mask_is_nonerm   s               r4   rn   zDistilBertModel.forwardé  s‰  € ð  2CÐ1NÑ-ÐTX×T_ÑT_×TqÑTqÐà$8Ð$DÑ È$Ï+É+×JjÑJjð 	ð &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆàÐ  ]Ð%>ÜÐcÓdÐdØÐ"Ø×6Ñ6°yÀ.ÔQØ#Ÿ.™.Ó*‰KØÐ&Ø'×,Ñ,Ó.¨s°Ð3‰KäÐTÓUÐUà%.Ð%:�×!Ò!À×@TÑ@Tˆà%¨Ð-Ðà×&Ñ& y°$·+±+×2OÑ2OÓPˆ	à—_‘_ Y°Ó>ˆ
à×&Ò&Ø0>Ð0JÈqÐTbÑOb™^Ðim‰NàÐ%Ü!&§¡¨KÀÔ!G�à�~Š~Ñ"3Ñ<MÜ!DØ" J×$4Ñ$4¸kÈ!¹nô"�ð ×ÑØØ$ØØ/Ø!5Ø#ð  ó 
ð 	
r`   )NNNNNNN)rp   rq   rr   r   rP   r	   rQ   rJ  r½   rT  rW  r[  r   r   r_  r!   ÚDISTILBERT_INPUTS_DOCSTRINGÚformatr   Ú_CHECKPOINT_FOR_DOCr   Ú_CONFIG_FOR_DOCr   r0   rs   r¾   r   r   rn   rt   ru   s   @r4   rA  rA  ›  sW  ø„ ð
	Ð/õ 	ð3¨¯©ó 3ð(<Àcó (<ðT/ b§l¡ló /ð9°2·<±<ó 9ðG¨4°°T¸$¸s¹)±_Ð0DÑ+Eó Gñ +Ð+F×+MÑ+MÐNgÓ+hÓiÙØ&Ø#Ø$ôð -1Ø15Ø,0Ø04Ø,0Ø/3Ø&*ñ4
à˜EŸL™LÑ)ð4
ð ! §¡Ñ.ð4
ð ˜EŸL™LÑ)ð	4
ð
   §¡Ñ-ð4
ð $ D™>ð4
ð ' t™nð4
ð ˜d‘^ð4
ð 
ˆ  e§l¡l°CÐ&7Ñ 8Ð8Ñ	9ò4
óó jô4
r`   rA  z?DistilBert Model with a `masked language modeling` head on top.c                   óà  ‡ — e Zd ZdgZdefˆ fd„Zdej                  fd„Zde	fd„Z
dej                  fd„Zd	ej                  fd
„Z eej!                  d«      «       eeee¬«      	 	 	 	 	 	 	 	 ddeej.                     deej.                     deej.                     deej.                     deej0                     dee   dee   dee   deeeej.                  df   f   fd„«       «       Zˆ xZS )ÚDistilBertForMaskedLMzvocab_projector.weightrF   c                 óÒ  •— t         ‰| �  |«       t        |j                  «      | _        t	        |«      | _        t        j                  |j                  |j                  «      | _	        t        j                  |j                  d¬«      | _        t        j                  |j                  |j                  «      | _        | j                  «        t        j                  «       | _        y )NrI   rJ   )rO   rP   r   rö   rA  r+  r	   rƒ   r(   Úvocab_transformrW   Úvocab_layer_normrR   Úvocab_projectorrF  r   Úmlm_loss_fctr]   s     €r4   rP   zDistilBertForMaskedLM.__init__-  sš   ø€ Ü‰Ñ˜Ô ä(¨×):Ñ):Ó;ˆŒä)¨&Ó1ˆŒÜ!Ÿy™y¨¯©°V·Z±ZÓ@ˆÔÜ "§¡¨V¯Z©Z¸UÔ CˆÔÜ!Ÿy™y¨¯©°V×5FÑ5FÓGˆÔð 	�‰Ôä×/Ñ/Ó1ˆÕr`   rc   c                 ó6   — | j                   j                  «       S rH  ©r+  rJ  rI  s    r4   rJ  z-DistilBertForMaskedLM.get_position_embeddings<  ó   € ð �‰×6Ñ6Ó8Ð8r`   rK  c                 ó:   — | j                   j                  |«       y©rM  N©r+  rT  ©r^   rK  s     r4   rT  z0DistilBertForMaskedLM.resize_position_embeddingsB  ó   € ð 	�‰×2Ñ2Ð3NÕOr`   c                 ó   — | j                   S ro   ©rx  rI  s    r4   Úget_output_embeddingsz+DistilBertForMaskedLM.get_output_embeddingsP  s   € Ø×#Ñ#Ð#r`   rX  c                 ó   — || _         y ro   rƒ  rZ  s     r4   Úset_output_embeddingsz+DistilBertForMaskedLM.set_output_embeddingsS  s
   € Ø-ˆÕr`   r`  ra  ra   rd  r–   re  Úlabelsr—   r  r  .c	           	      óð  — |�|n| j                   j                  }| j                  |||||||¬«      }	|	d   }
| j                  |
«      }| j	                  |«      }| j                  |«      }| j                  |«      }d}|�@| j                  |j                  d|j                  d«      «      |j                  d«      «      }|s|f|	dd z   }|�|f|z   S |S t        |||	j                  |	j                  ¬«      S )a£  
        labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
            Labels for computing the masked language modeling loss. Indices should be in `[-100, 0, ...,
            config.vocab_size]` (see `input_ids` docstring) Tokens with indices set to `-100` are ignored (masked), the
            loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
        N©ra   rd  r–   re  r—   r  r  r   rM   r$   ©ÚlossÚlogitsr  r  )rF   rh  r+  rv  rö   rw  rx  ry  rŸ   rg   r   r  r  )r^   ra   rd  r–   re  r‡  r—   r  r  Údlbrt_outputr  Úprediction_logitsÚmlm_lossr  s                 r4   rn   zDistilBertForMaskedLM.forwardV  s*  € ð. &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆà—‘ØØ)ØØ'Ø/Ø!5Ø#ð 'ó 
ˆð % Q™ˆØ ×0Ñ0°Ó?ÐØ ŸO™OÐ,=Ó>ÐØ ×1Ñ1Ð2CÓDÐØ ×0Ñ0Ð1BÓCÐàˆØÐØ×(Ñ(Ð):×)?Ñ)?ÀÐDU×DZÑDZÐ[]ÓD^Ó)_Ðag×alÑalÐmoÓapÓqˆHáØ'Ð)¨L¸¸Ð,<Ñ<ˆFØ-5Ð-A�X�K &Ñ(ÐMÀvÐMäØØ$Ø&×4Ñ4Ø#×.Ñ.ô	
ð 	
r`   ©NNNNNNNN)rp   rq   rr   Ú_tied_weights_keysr   rP   r	   rQ   rJ  r½   rT  r?  r„  r†  r!   ro  rp  r   rq  r   rr  r   r0   rs   Ú
LongTensorr¾   r   r   rn   rt   ru   s   @r4   rt  rt  &  s[  ø„ ð
 3Ð3Ðð2Ð/õ 2ð9¨¯©ó 9ðPÀcó Pð$ r§y¡yó $ð.°B·I±Ió .ñ +Ð+F×+MÑ+MÐNgÓ+hÓiÙØ&Ø"Ø$ôð -1Ø15Ø,0Ø04Ø-1Ø,0Ø/3Ø&*ñ/
à˜EŸL™LÑ)ð/
ð ! §¡Ñ.ð/
ð ˜EŸL™LÑ)ð	/
ð
   §¡Ñ-ð/
ð ˜×)Ñ)Ñ*ð/
ð $ D™>ð/
ð ' t™nð/
ð ˜d‘^ð/
ð 
ˆ~˜u U§\¡\°3Ð%6Ñ7Ð7Ñ	8ò/
óó jô/
r`   rt  z¢
    DistilBert Model transformer with a sequence classification/regression head on top (a linear layer on top of the
    pooled output) e.g. for GLUE tasks.
    c                   óš  ‡ — e Zd Zdefˆ fd„Zdej                  fd„Zdefd„Z	 e
ej                  d«      «       eeee¬«      	 	 	 	 	 	 	 	 dd	eej&                     d
eej&                     deej&                     deej&                     deej(                     dee   dee   dee   deeeej&                  df   f   fd„«       «       Zˆ xZS )Ú#DistilBertForSequenceClassificationrF   c                 ó˜  •— t         ‰| �  |«       |j                  | _        || _        t	        |«      | _        t        j                  |j                  |j                  «      | _	        t        j                  |j                  |j                  «      | _
        t        j                  |j                  «      | _        | j                  «        y ro   )rO   rP   Ú
num_labelsrF   rA  r+  r	   rƒ   r(   Úpre_classifierÚ
classifierrX   Úseq_classif_dropoutrY   rF  r]   s     €r4   rP   z,DistilBertForSequenceClassification.__init__–  s‰   ø€ Ü‰Ñ˜Ô Ø ×+Ñ+ˆŒØˆŒä)¨&Ó1ˆŒÜ Ÿi™i¨¯
©
°F·J±JÓ?ˆÔÜŸ)™) F§J¡J°×0AÑ0AÓBˆŒÜ—z‘z &×"<Ñ"<Ó=ˆŒð 	�‰Õr`   rc   c                 ó6   — | j                   j                  «       S rH  r{  rI  s    r4   rJ  z;DistilBertForSequenceClassification.get_position_embeddings£  r|  r`   rK  c                 ó:   — | j                   j                  |«       yr~  r  r€  s     r4   rT  z>DistilBertForSequenceClassification.resize_position_embeddings©  r�  r`   zbatch_size, sequence_lengthra  ra   rd  r–   re  r‡  r—   r  r  .c	           	      ó¤  — |�|n| j                   j                  }| j                  |||||||¬«      }	|	d   }
|
dd…df   }| j                  |«      } t	        j
                  «       |«      }| j                  |«      }| j                  |«      }d}|��‡| j                   j                  €�| j                  dk(  rd| j                   _        nl| j                  dkD  rL|j                  t        j                  k(  s|j                  t        j                  k(  rd| j                   _        nd| j                   _        | j                   j                  dk(  rIt        «       }| j                  dk(  r& ||j                  «       |j                  «       «      }nŒ |||«      }n‚| j                   j                  dk(  r=t!        «       } ||j#                  d| j                  «      |j#                  d«      «      }n,| j                   j                  dk(  rt%        «       } |||«      }|s|f|	dd z   }|�|f|z   S |S t'        |||	j(                  |	j*                  ¬	«      S )
a�  
        labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
            Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
            config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
            `config.num_labels > 1` a classification loss is computed (Cross-Entropy).
        Nr‰  r   r$   Ú
regressionÚsingle_label_classificationÚmulti_label_classificationrM   rŠ  )rF   rh  r+  r—  r	   ÚReLUrY   r˜  Úproblem_typer–  re   r0   ri   r½   r   Úsqueezer   rŸ   r
   r   r  r  )r^   ra   rd  r–   re  r‡  r—   r  r  Údistilbert_outputr%  Úpooled_outputrŒ  r‹  Úloss_fctr  s                   r4   rn   z+DistilBertForSequenceClassification.forward·  s  € ð. &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆà ŸO™OØØ)ØØ'Ø/Ø!5Ø#ð ,ó 
Ðð )¨Ñ+ˆØ$¢Q¨ TÑ*ˆØ×+Ñ+¨MÓ:ˆØ!œŸ™›	 -Ó0ˆØŸ™ ]Ó3ˆØ—‘ Ó/ˆàˆØÑØ�{‰{×'Ñ'Ð/Ø—?‘? aÒ'Ø/;�D—K‘KÕ,Ø—_‘_ qÒ(¨f¯l©l¼e¿j¹jÒ.HÈFÏLÉLÔ\a×\eÑ\eÒLeØ/L�D—K‘KÕ,à/K�D—K‘KÔ,à�{‰{×'Ñ'¨<Ò7Ü"›9�Ø—?‘? aÒ'Ù# F§N¡NÓ$4°f·n±nÓ6FÓG‘Dá# F¨FÓ3‘DØ—‘×)Ñ)Ð-JÒJÜ+Ó-�Ù §¡¨B°·±Ó @À&Ç+Á+ÈbÃ/ÓR‘Ø—‘×)Ñ)Ð-IÒIÜ,Ó.�Ù ¨Ó/�áØ�YÐ!2°1°2Ð!6Ñ6ˆFØ)-Ð)9�T�G˜fÑ$ÐE¸vÐEä'ØØØ+×9Ñ9Ø(×3Ñ3ô	
ð 	
r`   r�  )rp   rq   rr   r   rP   r	   rQ   rJ  r½   rT  r!   ro  rp  r   rq  r   rr  r   r0   rs   r’  r¾   r   r   rn   rt   ru   s   @r4   r”  r”  Ž  s<  ø„ ðÐ/õ ð9¨¯©ó 9ðPÀcó Pñ +Ð+F×+MÑ+MÐNkÓ+lÓmÙØ&Ø,Ø$ôð -1Ø15Ø,0Ø04Ø-1Ø,0Ø/3Ø&*ñC
à˜EŸL™LÑ)ðC
ð ! §¡Ñ.ðC
ð ˜EŸL™LÑ)ð	C
ð
   §¡Ñ-ðC
ð ˜×)Ñ)Ñ*ðC
ð $ D™>ðC
ð ' t™nðC
ð ˜d‘^ðC
ð 
Ð'¨¨u¯|©|¸SÐ/@Ñ)AÐAÑ	BòC
óó nôC
r`   r”  zã
    DistilBert Model with a span classification head on top for extractive question-answering tasks like SQuAD (a
    linear layers on top of the hidden-states output to compute `span start logits` and `span end logits`).
    c                   óº  ‡ — e Zd Zdefˆ fd„Zdej                  fd„Zdefd„Z	 e
ej                  d«      «       eeee¬«      	 	 	 	 	 	 	 	 	 dd	eej&                     d
eej&                     deej&                     deej&                     deej&                     deej&                     dee   dee   dee   deeeej&                  df   f   fd„«       «       Zˆ xZS )ÚDistilBertForQuestionAnsweringrF   c                 óX  •— t         ‰| �  |«       t        |«      | _        t	        j
                  |j                  |j                  «      | _        |j                  dk7  rt        d|j                  › �«      ‚t	        j                  |j                  «      | _        | j                  «        y )Nr7   z)config.num_labels should be 2, but it is )rO   rP   rA  r+  r	   rƒ   r(   r–  Ú
qa_outputsr‚   rX   Ú
qa_dropoutrY   rF  r]   s     €r4   rP   z'DistilBertForQuestionAnswering.__init__  s‚   ø€ Ü‰Ñ˜Ô ä)¨&Ó1ˆŒÜŸ)™) F§J¡J°×0AÑ0AÓBˆŒØ×Ñ Ò!ÜÐHÈ×IZÑIZÐH[Ð\Ó]Ð]ä—z‘z &×"3Ñ"3Ó4ˆŒð 	�‰Õr`   rc   c                 ó6   — | j                   j                  «       S rH  r{  rI  s    r4   rJ  z6DistilBertForQuestionAnswering.get_position_embeddings  r|  r`   rK  c                 ó:   — | j                   j                  |«       yr~  r  r€  s     r4   rT  z9DistilBertForQuestionAnswering.resize_position_embeddings  r�  r`   r`  ra  ra   rd  r–   re  Ústart_positionsÚend_positionsr—   r  r  .c
           	      óZ  — |	�|	n| j                   j                  }	| j                  |||||||	¬«      }
|
d   }| j                  |«      }| j	                  |«      }|j                  dd¬«      \  }}|j                  d«      j                  «       }|j                  d«      j                  «       }d}|�Á|�¿t        |j                  «       «      dkD  r|j                  d«      }t        |j                  «       «      dkD  r|j                  d«      }|j                  d«      }|j                  d|«      }|j                  d|«      }t        j                  |¬«      } |||«      } |||«      }||z   dz  }|	s||f|
dd z   }|�|f|z   S |S t        ||||
j                  |
j                  ¬	«      S )
a  
        start_positions (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
            Labels for position (index) of the start of the labelled span for computing the token classification loss.
            Positions are clamped to the length of the sequence (`sequence_length`). Position outside of the sequence
            are not taken into account for computing the loss.
        end_positions (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
            Labels for position (index) of the end of the labelled span for computing the token classification loss.
            Positions are clamped to the length of the sequence (`sequence_length`). Position outside of the sequence
            are not taken into account for computing the loss.
        Nr‰  r   r$   rM   r�   )Úignore_indexr7   )r‹  Ústart_logitsÚ
end_logitsr  r  )rF   rh  r+  rY   r©  Úsplitr¢  r¨   rŽ   rg   Úclampr	   r   r   r  r  )r^   ra   rd  r–   re  r­  r®  r—   r  r  r£  r  rŒ  r±  r²  Ú
total_lossÚignored_indexr¥  Ú
start_lossÚend_lossr  s                        r4   rn   z&DistilBertForQuestionAnswering.forward,  sÔ  € ð8 &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆà ŸO™OØØ)ØØ'Ø/Ø!5Ø#ð ,ó 
Ðð *¨!Ñ,ˆàŸ™ ]Ó3ˆØ—‘ Ó/ˆØ#)§<¡<°°r <Ó#:Ñ ˆ�jØ#×+Ñ+¨BÓ/×:Ñ:Ó<ˆØ×'Ñ'¨Ó+×6Ñ6Ó8ˆ
àˆ
ØÐ&¨=Ð+Dä�?×'Ñ'Ó)Ó*¨QÒ.Ø"1×"9Ñ"9¸"Ó"=�Ü�=×%Ñ%Ó'Ó(¨1Ò,Ø -× 5Ñ 5°bÓ 9�à(×-Ñ-¨aÓ0ˆMØ-×3Ñ3°A°}ÓEˆOØ)×/Ñ/°°=ÓAˆMä×*Ñ*¸ÔFˆHÙ! ,°Ó@ˆJÙ 
¨MÓ:ˆHØ$ xÑ/°1Ñ4ˆJáØ" JÐ/Ð2CÀAÀBÐ2GÑGˆFØ/9Ð/E�Z�M FÑ*ÐQÈ6ÐQä+ØØ%Ø!Ø+×9Ñ9Ø(×3Ñ3ô
ð 	
r`   )	NNNNNNNNN)rp   rq   rr   r   rP   r	   rQ   rJ  r½   rT  r!   ro  rp  r   rq  r   rr  r   r0   rs   r¾   r   r   rn   rt   ru   s   @r4   r§  r§    sQ  ø„ ðÐ/õ ð9¨¯©ó 9ðPÀcó Pñ +Ð+F×+MÑ+MÐNgÓ+hÓiÙØ&Ø0Ø$ôð -1Ø15Ø,0Ø04Ø26Ø04Ø,0Ø/3Ø&*ñD
à˜EŸL™LÑ)ðD
ð ! §¡Ñ.ðD
ð ˜EŸL™LÑ)ð	D
ð
   §¡Ñ-ðD
ð " %§,¡,Ñ/ðD
ð   §¡Ñ-ðD
ð $ D™>ðD
ð ' t™nðD
ð ˜d‘^ðD
ð 
Ð+¨U°5·<±<ÀÐ3DÑ-EÐEÑ	FòD
óó jôD
r`   r§  z©
    DistilBert Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g.
    for Named-Entity-Recognition (NER) tasks.
    c                   ó|  ‡ — e Zd Zdefˆ fd„Zdej                  fd„Zdefd„Z	 e
e«       eeee¬«      	 	 	 	 	 	 	 	 ddeej$                     d	eej$                     d
eej$                     deej$                     deej&                     dee   dee   dee   deeeej$                  df   f   fd„«       «       Zˆ xZS )Ú DistilBertForTokenClassificationrF   c                 ó,  •— t         ‰| �  |«       |j                  | _        t        |«      | _        t        j                  |j                  «      | _        t        j                  |j                  |j                  «      | _
        | j                  «        y ro   )rO   rP   r–  rA  r+  r	   rX   rY   rƒ   Úhidden_sizer˜  rF  r]   s     €r4   rP   z)DistilBertForTokenClassification.__init__�  sg   ø€ Ü‰Ñ˜Ô Ø ×+Ñ+ˆŒä)¨&Ó1ˆŒÜ—z‘z &§.¡.Ó1ˆŒÜŸ)™) F×$6Ñ$6¸×8IÑ8IÓJˆŒð 	�‰Õr`   rc   c                 ó6   — | j                   j                  «       S rH  r{  rI  s    r4   rJ  z8DistilBertForTokenClassification.get_position_embeddingsŒ  r|  r`   rK  c                 ó:   — | j                   j                  |«       yr~  r  r€  s     r4   rT  z;DistilBertForTokenClassification.resize_position_embeddings’  r�  r`   ra  ra   rd  r–   re  r‡  r—   r  r  .c	           	      ó¤  — |�|n| j                   j                  }| j                  |||||||¬«      }	|	d   }
| j                  |
«      }
| j	                  |
«      }d}|�<t        «       } ||j                  d| j                  «      |j                  d«      «      }|s|f|	dd z   }|�|f|z   S |S t        |||	j                  |	j                  ¬«      S )zÛ
        labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
            Labels for computing the token classification loss. Indices should be in `[0, ..., config.num_labels - 1]`.
        N©rd  r–   re  r—   r  r  r   rM   r$   rŠ  )rF   rh  r+  rY   r˜  r   rŸ   r–  r   r  r  )r^   ra   rd  r–   re  r‡  r—   r  r  ÚoutputsÚsequence_outputrŒ  r‹  r¥  r  s                  r4   rn   z(DistilBertForTokenClassification.forward   sð   € ð* &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆà—/‘/ØØ)ØØ'Ø/Ø!5Ø#ð "ó 
ˆð " !™*ˆàŸ,™, Ó7ˆØ—‘ Ó1ˆàˆØÐÜ'Ó)ˆHÙ˜FŸK™K¨¨D¯O©OÓ<¸f¿k¹kÈ"»oÓNˆDáØ�Y ¨¨ Ñ,ˆFØ)-Ð)9�T�G˜fÑ$ÐE¸vÐEä$ØØØ!×/Ñ/Ø×)Ñ)ô	
ð 	
r`   r�  )rp   rq   rr   r   rP   r	   rQ   rJ  r½   rT  r!   ro  r   rq  r   rr  r   r0   rs   r’  r¾   r   r   rn   rt   ru   s   @r4   rº  rº  y  s%  ø„ ð	Ð/õ 	ð9¨¯©ó 9ðPÀcó Pñ +Ð+FÓGÙØ&Ø)Ø$ôð -1Ø15Ø,0Ø04Ø-1Ø,0Ø/3Ø&*ñ.
à˜EŸL™LÑ)ð.
ð ! §¡Ñ.ð.
ð ˜EŸL™LÑ)ð	.
ð
   §¡Ñ-ð.
ð ˜×)Ñ)Ñ*ð.
ð $ D™>ð.
ð ' t™nð.
ð ˜d‘^ð.
ð 
Ð$ e¨E¯L©L¸#Ð,=Ñ&>Ð>Ñ	?ò.
óó Hô.
r`   rº  z«
    DistilBert Model with a multiple choice classification head on top (a linear layer on top of the pooled output and
    a softmax) e.g. for RocStories/SWAG tasks.
    c                   ó˜  ‡ — e Zd Zdefˆ fd„Zdej                  fd„Zdefd„Z	 e
ej                  d«      «       eee¬«      	 	 	 	 	 	 	 	 dd	eej$                     d
eej$                     deej$                     deej$                     deej&                     dee   dee   dee   deeeej$                  df   f   fd„«       «       Zˆ xZS )ÚDistilBertForMultipleChoicerF   c                 óT  •— t         ‰| �  |«       t        |«      | _        t	        j
                  |j                  |j                  «      | _        t	        j
                  |j                  d«      | _        t	        j                  |j                  «      | _        | j                  «        y )Nr$   )rO   rP   rA  r+  r	   rƒ   r(   r—  r˜  rX   r™  rY   rF  r]   s     €r4   rP   z$DistilBertForMultipleChoice.__init__ß  so   ø€ Ü‰Ñ˜Ô ä)¨&Ó1ˆŒÜ Ÿi™i¨¯
©
°F·J±JÓ?ˆÔÜŸ)™) F§J¡J°Ó2ˆŒÜ—z‘z &×"<Ñ"<Ó=ˆŒð 	�‰Õr`   rc   c                 ó6   — | j                   j                  «       S rH  r{  rI  s    r4   rJ  z3DistilBertForMultipleChoice.get_position_embeddingsê  r|  r`   rK  c                 ó:   — | j                   j                  |«       y)aË  
        Resizes position embeddings of the model if `new_num_position_embeddings != config.max_position_embeddings`.

        Arguments:
            new_num_position_embeddings (`int`)
                The number of new position embeddings. If position embeddings are learned, increasing the size will add
                newly initialized vectors at the end, whereas reducing the size will remove vectors from the end. If
                position embeddings are not learned (*e.g.* sinusoidal position embeddings), increasing the size will
                add correct vectors at the end following the position encoding algorithm, whereas reducing the size
                will remove vectors from the end.
        Nr  r€  s     r4   rT  z6DistilBertForMultipleChoice.resize_position_embeddingsð  r�  r`   z(batch_size, num_choices, sequence_length)rc  r9  ra   rd  r–   re  r‡  r—   r  r  .c	           	      ó  — |�|n| j                   j                  }|�|j                  d   n|j                  d   }	|�!|j                  d|j	                  d«      «      nd}|�!|j                  d|j	                  d«      «      nd}|�1|j                  d|j	                  d«      |j	                  d«      «      nd}| j                  |||||||¬«      }
|
d   }|dd…df   }| j                  |«      } t        j                  «       |«      }| j                  |«      }| j                  |«      }|j                  d|	«      }d}|�t        «       } |||«      }|s|f|
dd z   }|�|f|z   S |S t        |||
j                  |
j                  ¬«      S )aW  
        labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
            Labels for computing the multiple choice classification loss. Indices should be in `[0, ...,
            num_choices-1]` where `num_choices` is the size of the second dimension of the input tensors. (See
            `input_ids` above)

        Returns:

        Examples:

        ```python
        >>> from transformers import AutoTokenizer, DistilBertForMultipleChoice
        >>> import torch

        >>> tokenizer = AutoTokenizer.from_pretrained("distilbert-base-cased")
        >>> model = DistilBertForMultipleChoice.from_pretrained("distilbert-base-cased")

        >>> prompt = "In Italy, pizza served in formal settings, such as at a restaurant, is presented unsliced."
        >>> choice0 = "It is eaten with a fork and a knife."
        >>> choice1 = "It is eaten while held in the hand."
        >>> labels = torch.tensor(0).unsqueeze(0)  # choice0 is correct (according to Wikipedia ;)), batch size 1

        >>> encoding = tokenizer([[prompt, choice0], [prompt, choice1]], return_tensors="pt", padding=True)
        >>> outputs = model(**{k: v.unsqueeze(0) for k, v in encoding.items()}, labels=labels)  # batch size is 1

        >>> # the linear classifier still needs to be trained
        >>> loss = outputs.loss
        >>> logits = outputs.logits
        ```Nr$   rM   éþÿÿÿrÀ  r   rŠ  )rF   rh  r¤   rŸ   rg   r+  r—  r	   r   rY   r˜  r   r   r  r  )r^   ra   rd  r–   re  r‡  r—   r  r  Únum_choicesrÁ  r%  r¤  rŒ  Úreshaped_logitsr‹  r¥  r  s                     r4   rn   z#DistilBertForMultipleChoice.forwardþ  s¾  € ðX &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆØ,5Ð,A�i—o‘o aÒ(À}×GZÑGZÐ[\ÑG]ˆà>GÐ>S�I—N‘N 2 y§~¡~°bÓ'9Ô:ÐY]ˆ	ØM[ÐMg˜×,Ñ,¨R°×1DÑ1DÀRÓ1HÔIÐmqˆð Ð(ð ×Ñ˜r =×#5Ñ#5°bÓ#9¸=×;MÑ;MÈbÓ;QÔRàð 	ð —/‘/ØØ)ØØ'Ø/Ø!5Ø#ð "ó 
ˆð ˜q‘zˆØ$¢Q¨ TÑ*ˆØ×+Ñ+¨MÓ:ˆØ!œŸ™›	 -Ó0ˆØŸ™ ]Ó3ˆØ—‘ Ó/ˆà Ÿ+™+ b¨+Ó6ˆàˆØÐÜ'Ó)ˆHÙ˜O¨VÓ4ˆDáØ%Ð'¨'°!°"¨+Ñ5ˆFØ)-Ð)9�T�G˜fÑ$ÐE¸vÐEä(ØØ"Ø!×/Ñ/Ø×)Ñ)ô	
ð 	
r`   r�  )rp   rq   rr   r   rP   r	   rQ   rJ  r½   rT  r!   ro  rp  r#   r   rr  r   r0   rs   r’  r¾   r   r   rn   rt   ru   s   @r4   rÄ  rÄ  ×  s;  ø„ ð	Ð/õ 	ð9¨¯©ó 9ðPÀcó Pñ +Ø#×*Ñ*Ð+UÓVóñ Ð+DÐSbÔcð -1Ø15Ø,0Ø04Ø-1Ø,0Ø/3Ø&*ñT
à˜EŸL™LÑ)ðT
ð ! §¡Ñ.ðT
ð ˜EŸL™LÑ)ð	T
ð
   §¡Ñ-ðT
ð ˜×)Ñ)Ñ*ðT
ð $ D™>ðT
ð ' t™nðT
ð ˜d‘^ðT
ð 
Ð(¨%°·±¸cÐ0AÑ*BÐBÑ	CòT
ó dóôT
r`   rÄ  )rt  rÄ  r§  r”  rº  rA  r*  )OrÞ   rª   Útypingr   r   r   r   r   r   Únumpyr8   r0   r	   Útorch.nnr
   r   r   Úactivationsr   Úconfiguration_utilsr   Úintegrations.deepspeedr   Úmodeling_attn_mask_utilsr   Úmodeling_flash_attention_utilsr   r   Úmodeling_outputsr   r   r   r   r   r   Úmodeling_utilsr   Úpytorch_utilsr   r   r   r   Úutilsr   r    r!   r"   r#   Úconfiguration_distilbertr%   r&   Ú
get_loggerrp   rÓ   rq  rr  r½   rs   r5   r3   r?  rE   rw   rÀ   rà   rï   r  rÿ   r  r*  ÚDISTILBERT_START_DOCSTRINGro  rA  rt  r”  r§  rº  rÄ  Ú__all__r  r`   r4   ú<module>rÜ     s‡  ðñ ó
 ß :× :ã Û Ý ß AÑ Aå )Ý 3Ý @Ý Kß h÷÷ õ .÷ó ÷õ õ 7ñ ÔÝJð 
ˆ×	Ñ	˜HÓ	%€Ø/Ð Ø$€ðE¨ð E°#ð E¸E¿L¹Ló Eð¨ð °3ð ¸U¿\¹\ó ô+�—‘ô +ô\e˜RŸY™Yô eôP]"Ð 6ô ]"ô@MÐ4ô Mô`ˆ"�)‰)ô ð, $Ø2Ø#ñ Ð ô7�r—y‘yô 7ôtJ
�"—)‘)ô J
ô\ ô ðDÐ ð "Ð ñJ ØlØóôD
Ð/ó D
ó	ðD
ñN ØIØóôa
Ð5ó a
ó	ða
ñH ðð óôk
Ð*Có k
óðk
ñ\ ðð óôl
Ð%>ó l
óðl
ñ^ ðð óôT
Ð'@ó T
óðT
ñn ðð óôx
Ð";ó x
óðx
òv�r`   