Ë
    ÛÓ^jà›  ã                   óê  — d Z ddl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 ddlmZ ddlmZmZmZmZmZmZ ddlm Z m!Z! ddl"m#Z# ddl$m%Z% ddl&m'Z'm(Z(m)Z) ddl*m+Z+m,Z, ddl-m.Z. ddl/m0Z0  e)jb                  e2«      Z3de4de4dejj                  fd„Z6de4de4dejj                  fd„Z7 G d„ dejp                  «      Z9	 	 d@dejp                  dejj                  dejj                  d ejj                  d!ejj                  dz  d"e:dz  d#e:d$e#e'   fd%„Z; G d&„ d'ejp                  «      Z< G d(„ d)ejp                  «      Z= G d*„ d+e«      Z> G d,„ d-ejp                  «      Z?e( G d.„ d/e!«      «       Z@e( G d0„ d1e@«      «       ZA e(d2¬3«       G d4„ d5e@«      «       ZB e(d6¬3«       G d7„ d8e@«      «       ZCe( G d9„ d:e@«      «       ZDe( G d;„ d<e@«      «       ZEe( G d=„ d>e@«      «       ZFg d?¢ZGy)Azà
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)
é    )ÚCallableN)Únn)ÚBCEWithLogitsLossÚCrossEntropyLossÚMSELossé   )Úinitialization)Úget_activation)ÚPreTrainedConfig)Úis_deepspeed_zero3_enabled)Úcreate_bidirectional_mask)ÚGradientCheckpointingLayer)ÚBaseModelOutputÚMaskedLMOutputÚMultipleChoiceModelOutputÚQuestionAnsweringModelOutputÚSequenceClassifierOutputÚTokenClassifierOutput)ÚALL_ATTENTION_FUNCTIONSÚPreTrainedModel)ÚUnpack)Úapply_chunking_to_forward)ÚTransformersKwargsÚauto_docstringÚlogging)Úcan_return_tupleÚmerge_with_config_defaults)Úcapture_outputsé   )ÚDistilBertConfigÚn_posÚdimÚoutc                 ó  — t        «       rddd l}|j                  j                  |d¬«      5  t        j
                  j                  «       dk(  rt        | ||¬«      cd d d «       S 	 d d d «       y t        | ||¬«      S # 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       ú}/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/transformers/models/distilbert/modeling_distilbert.pyÚcreate_sinusoidal_embeddingsr/   >   s„   € Ü!Ô#Ûà�^‰^×.Ñ.¨sÀ!Ð.ÓDñ 	TÜ× Ñ ×)Ñ)Ó+¨qÒ0Ü4¸5ÀcÈsÔS÷	Tñ 	TØ0÷	Tð 	Tô -°5¸cÀsÔKÐK÷		Tð 	Tús   ¬/A=Á=B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                  «        |S c c}w c c}}w )Ni'  é   Fr   r   )
ÚnpÚarrayÚrangeÚpowerÚrequires_gradr*   ÚFloatTensorÚsinÚcosÚdetach_)r!   r"   r#   ÚposÚjÚposition_encs         r.   r-   r-   I   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Ø€Jùò ]ùÓus   žC<
°)C7ÁC<
Ã7C<
c            	       óž   ‡ — e Zd Zdefˆ fd„Z	 	 d	dej                  dej                  dz  dej                  dz  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_bufferr*   ÚarangeÚexpand©Úselfr@   Ú	__class__s     €r.   rK   zEmbeddings.__init__S   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ð 	õ 	
ó    NÚ	input_idsÚinputs_embedsrF   Úreturnc                 ó¦  — |�| j                  |«      }|j                  d«      }|€rt        | d«      r| j                  d d …d |…f   }nPt	        j
                  |t        j                  |j                  ¬«      }|j                  d«      j                  |«      }| j                  |«      }||z   }| j                  |«      }| j                  |«      }|S )Nr   rF   )ÚdtypeÚdevicer   )rO   ÚsizeÚhasattrrF   r*   rV   Úlongra   Ú	unsqueezeÚ	expand_asrQ   rR   rT   )rY   r\   r]   rF   Ú
seq_lengthrQ   Ú
embeddingss          r.   ÚforwardzEmbeddings.forward^   sÊ   € ð Ð Ø ×0Ñ0°Ó;ˆMà"×'Ñ'¨Ó*ˆ
àÐô �t˜^Ô,Ø#×0Ñ0²°K°Z°K°Ñ@‘ä$Ÿ|™|¨J¼e¿j¹jÐQZ×QaÑQaÔb�Ø+×5Ñ5°aÓ8×BÑBÀ9ÓM�à"×6Ñ6°|ÓDÐà"Ð%8Ñ8ˆ
Ø—^‘^ JÓ/ˆ
Ø—\‘\ *Ó-ˆ
ØÐr[   )NN)
Ú__name__Ú
__module__Ú__qualname__r   rK   r*   ÚTensorÚ
LongTensorri   Ú__classcell__©rZ   s   @r.   r?   r?   R   s_   ø„ ð	
Ð/õ 	
ð .2Ø04ñ	à—<‘<ðð —|‘| dÑ*ðð ×&Ñ&¨Ñ-ð	ð
 
�‰÷r[   r?   ÚmoduleÚqueryÚkeyÚvalueÚattention_maskÚscalingrT   Úkwargsc                 óœ  — |€|j                  d«      dz  }t        j                  ||j                  dd«      «      |z  }|�||z   }t        j
                  j                  |d¬«      }t        j
                  j                  ||| j                  ¬«      }t        j                  ||«      }	|	j                  dd«      j                  «       }	|	|fS )NrH   ç      à¿r1   r   ©r"   )ÚpÚtrainingr   )
rb   r*   ÚmatmulÚ	transposer   Ú
functionalÚsoftmaxrT   r|   Ú
contiguous)
rq   rr   rs   rt   ru   rv   rT   rw   Úattn_weightsÚattn_outputs
             r.   Úeager_attention_forwardr„   |   s»   € ð €Ø—*‘*˜R“. DÑ(ˆô —<‘<  s§}¡}°Q¸Ó':Ó;¸gÑE€LàÐ!Ø# nÑ4ˆä—=‘=×(Ñ(¨¸2Ð(Ó>€LÜ—=‘=×(Ñ(¨¸È6Ï?É?Ð(Ó[€Lä—,‘,˜|¨UÓ3€KØ×'Ñ'¨¨1Ó-×8Ñ8Ó:€Kà˜Ð$Ð$r[   c            
       óŽ   ‡ — e Zd Zdefˆ fd„Z	 d	dej                  dej                  dz  dee	   de
ej                     fd„Zˆ xZS )
ÚDistilBertSelfAttentionr@   c                 ó4  •— t         ‰| �  «        || _        |j                  | _        |j                  | _        | j                  | j                  z  | _        | j
                  dz  | _        | 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                  ¬«      | _        d| _        y )	Nry   r   zself.n_heads: z must divide self.dim: ú evenly©Úin_featuresÚout_features©r{   F)rJ   rK   r@   Ún_headsr"   Úattention_head_sizerv   Ú
ValueErrorr   ÚLinearÚq_linÚk_linÚv_linÚout_linrS   Úattention_dropoutrT   Ú	is_causalrX   s     €r.   rK   z DistilBertSelfAttention.__init__™   s  ø€ Ü‰ÑÔØˆŒà—~‘~ˆŒØ—:‘:ˆŒØ#'§8¡8¨t¯|©|Ñ#;ˆÔ Ø×/Ñ/°Ñ5ˆŒð �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ˆŒä—z‘z F×$<Ñ$<Ô=ˆŒØˆ�r[   NÚhidden_statesru   rw   r^   c                 ó¢  — |j                   d d }g |¢d‘| j                  ‘­} | j                  |«      j                  |Ž j	                  dd«      } | j                  |«      j                  |Ž j	                  dd«      } | j                  |«      j                  |Ž j	                  dd«      }t        j                  | j                  j                  t        «      }	 |	| ||||f| j                  sdn| j                  j                  | j                  dœ|¤Ž\  }
} |
j                   g |¢d‘­Ž j#                  «       }
| j%                  |
«      }
|
|fS )NrH   r   r1   ç        )rT   rv   )ÚshaperŽ   r‘   Úviewr~   r’   r“   r   Úget_interfacer@   Ú_attn_implementationr„   r|   rT   r{   rv   Úreshaper�   r”   )rY   r—   ru   rw   Úinput_shapeÚhidden_shapeÚquery_layerÚ	key_layerÚvalue_layerÚattention_interfacerƒ   r‚   s               r.   ri   zDistilBertSelfAttention.forward¯   sV  € ð $×)Ñ)¨#¨2Ð.ˆØC˜ÐC bÐC¨$×*BÑ*BÑCˆð 5�d—j‘j Ó/×4Ñ4°lÐC×MÑMÈaÐQRÓSˆØ2�D—J‘J˜}Ó-×2Ñ2°LÐA×KÑKÈAÈqÓQˆ	Ø4�d—j‘j Ó/×4Ñ4°lÐC×MÑMÈaÐQRÓSˆä(?×(MÑ(MØ�K‰K×,Ñ,Ô.Eó)
Ðñ %8ØØØØØð	%
ð  $Ÿ}š}‘C°$·,±,·.±.Ø—L‘Lñ	%
ð ñ	%
Ñ!ˆ�\ð *�k×)Ñ)Ð;¨;Ð;¸Ò;×FÑFÓHˆØ—l‘l ;Ó/ˆØ˜LÐ(Ð(r[   ©N)rj   rk   rl   r   rK   r*   rm   r7   r   r   Útupleri   ro   rp   s   @r.   r†   r†   ˜   s^   ø„ ðÐ/õ ð2 48ñ)à—|‘|ð)ð ×)Ñ)¨DÑ0ð)ð Ð+Ñ,ð	)ð
 
ˆu�|‰|Ñ	÷)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 )ÚFFNr@   c                 ó�  •— t         ‰| �  «        t        j                  |j                  ¬«      | _        |j
                  | _        d| _        t        j                  |j                  |j                  ¬«      | _
        t        j                  |j                  |j                  ¬«      | _        t        |j                  «      | _        y )NrŒ   r   r‰   )rJ   rK   r   rS   rT   Úchunk_size_feed_forwardÚseq_len_dimr�   r"   Ú
hidden_dimÚlin1Úlin2r
   Ú
activationrX   s     €r.   rK   zFFN.__init__Ñ   s‚   ø€ Ü‰ÑÔÜ—z‘z F§N¡NÔ3ˆŒØ'-×'EÑ'EˆÔ$ØˆÔÜ—I‘I¨&¯*©*À6×CTÑCTÔUˆŒ	Ü—I‘I¨&×*;Ñ*;È&Ï*É*ÔUˆŒ	Ü(¨×):Ñ):Ó;ˆ�r[   Úinputr^   c                 óZ   — t        | j                  | j                  | j                  |«      S r¥   )r   Úff_chunkrª   r«   )rY   r°   s     r.   ri   zFFN.forwardÚ   s%   € Ü(¨¯©¸×8TÑ8TÐVZ×VfÑVfÐhmÓnÐnr[   c                 óŽ   — | j                  |«      }| j                  |«      }| j                  |«      }| j                  |«      }|S r¥   )r­   r¯   r®   rT   )rY   r°   Úxs      r.   r²   zFFN.ff_chunkÝ   s=   € Ø�I‰I�eÓˆØ�O‰O˜AÓˆØ�I‰I�a‹LˆØ�L‰L˜‹OˆØˆr[   )
rj   rk   rl   r   rK   r*   rm   ri   r²   ro   rp   s   @r.   r¨   r¨   Ð   sI   ø„ ð<Ð/õ <ðo˜UŸ\™\ð o¨e¯l©ló oð˜eŸl™lð ¨u¯|©|÷ r[   r¨   c                   ó’   ‡ — e Zd Zdefˆ fd„Z	 d
dej                  dej                  dz  dee   de	ej                  df   fd	„Z
ˆ xZS )ÚTransformerBlockr@   c                 ó~  •— t         ‰| �  «        |j                  |j                  z  dk7  r&t	        d|j                  › d|j                  › d�«      ‚t        |«      | _        t        j                  |j                  d¬«      | _	        t        |«      | _        t        j                  |j                  d¬«      | _        y )Nr   zconfig.n_heads z must divide config.dim rˆ   rC   )Únormalized_shaperE   )rJ   rK   r"   r�   r�   r†   Ú	attentionr   rR   Úsa_layer_normr¨   ÚffnÚoutput_layer_normrX   s     €r.   rK   zTransformerBlock.__init__æ   s“   ø€ Ü‰ÑÔð �:‰:˜Ÿ™Ñ&¨!Ò+Ü˜¨v¯~©~Ð.>Ð>VÐW]×WaÑWaÐVbÐbiÐjÓkÐkä0°Ó8ˆŒÜŸ\™\¸6¿:¹:È5ÔQˆÔä�v“;ˆŒÜ!#§¡¸v¿z¹zÈuÔ!UˆÕr[   Nr—   ru   rw   r^   .c                 ó¨   —  | j                   |fd|i|¤Ž\  }}| j                  ||z   «      }| j                  |«      }| j                  ||z   «      }|S )Nru   )r¹   rº   r»   r¼   )rY   r—   ru   rw   Úattention_outputÚ_Ú
ffn_outputs          r.   ri   zTransformerBlock.forwardó   su   € ð -˜dŸn™nØñ
à)ð
ð ñ
ÑÐ˜!ð
  ×-Ñ-Ð.>ÀÑ.NÓOÐð —X‘XÐ.Ó/ˆ
Ø×+Ñ+¨JÐ9IÑ,IÓJˆ
àÐr[   r¥   )rj   rk   rl   r   rK   r*   rm   r   r   r¦   ri   ro   rp   s   @r.   r¶   r¶   å   sc   ø„ ðVÐ/õ Vð  /3ñà—|‘|ðð Ÿ™ tÑ+ðð Ð+Ñ,ð	ð
 
ˆu�|‰|˜SÐ Ñ	!÷r[   r¶   c            	       ót   ‡ — e Zd Zdefˆ fd„Z	 d	dej                  dej                  dz  dee   de	fd„Z
ˆ xZS )
ÚTransformerr@   c                 óä   •— t         ‰| �  «        |j                  | _        t        j                  t        |j                  «      D �cg c]  }t        |«      ‘Œ c}«      | _        d| _        y c c}w )NF)	rJ   rK   Ún_layersr   Ú
ModuleListr4   r¶   ÚlayerÚgradient_checkpointing)rY   r@   r¿   rZ   s      €r.   rK   zTransformer.__init__	  sQ   ø€ Ü‰ÑÔØŸ™ˆŒÜ—]‘]ÄeÈFÏOÉOÓF\Ö#]ÀÔ$4°VÕ$<Ò#]Ó^ˆŒ
Ø&+ˆÕ#ùò $^s   ÁA-Nr—   ru   rw   r^   c                 óP   — | j                   D ]  } |||fi |¤Ž}Œ t        |¬«      S )N)Úlast_hidden_state)rÆ   r   )rY   r—   ru   rw   Úlayer_modules        r.   ri   zTransformer.forward  s>   € ð !ŸJ™Jò 	ˆLÙ(ØØñð ñ‰Mð	ô °Ô?Ð?r[   r¥   )rj   rk   rl   r   rK   r*   rm   r   r   r   ri   ro   rp   s   @r.   rÂ   rÂ     sX   ø„ ð,Ð/õ ,ð /3ñ@à—|‘|ð@ð Ÿ™ tÑ+ð@ð Ð+Ñ,ð	@ð
 
÷@r[   rÂ   c                   óŽ   ‡ — e Zd ZU eed<   dZdZdZdZdZ	dZ
eedœZ ej                  «       dej"                  fˆ fd„«       Zˆ xZS )ÚDistilBertPreTrainedModelr@   Ú
distilbertT)r—   Ú
attentionsrq   c           
      ó,  •— t         ‰| �  |«       t        |t        «      rô| j                  j
                  r„t        j                  |j                  j                  t        | j                  j                  | j                  j                  t        j                  |j                  j                  «      «      «       t        j                  |j                  t        j                   |j                  j"                  d   «      j%                  d«      «       yy)zInitialize the weights.rH   rG   N)rJ   Ú_init_weightsÚ
isinstancer?   r@   Úsinusoidal_pos_embdsÚinitÚcopy_rQ   Úweightr/   rP   r"   r*   Ú
empty_likerF   rV   rš   rW   )rY   rq   rZ   s     €r.   rÐ   z'DistilBertPreTrainedModel._init_weights.  sÀ   ø€ ô 	‰Ñ˜fÔ%Ü�fœjÔ)Ø�{‰{×/Ò/Ü—
‘
Ø×.Ñ.×5Ñ5Ü0ØŸ™×;Ñ;ØŸ™Ÿ™Ü×(Ñ(¨×)CÑ)C×)JÑ)JÓKóôô �J‰J�v×*Ñ*¬E¯L©L¸×9LÑ9L×9RÑ9RÐSUÑ9VÓ,W×,^Ñ,^Ð_fÓ,gÕhð *r[   )rj   rk   rl   r    Ú__annotations__Úbase_model_prefixÚsupports_gradient_checkpointingÚ_supports_flash_attnÚ_supports_sdpaÚ_supports_flex_attnÚ_supports_attention_backendr¶   r†   Ú_can_record_outputsr*   Úno_gradr   ÚModulerÐ   ro   rp   s   @r.   rÌ   rÌ      sd   ø… àÓØ$ÐØ&*Ð#ØÐØ€NØÐØ"&Ðà)Ø-ñÐð
 €U‡]�]ƒ_ði B§I¡Iô ió ôir[   rÌ   c                   ój  ‡ — 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eee	 	 	 	 ddej                   d
z  dej                   d
z  dej                   d
z  dej                   d
z  dee   deeej                   df   z  fd„«       «       «       Zˆ xZS )ÚDistilBertModelr@   c                 ó„   •— t         ‰| �  |«       t        |«      | _        t	        |«      | _        | j                  «        y r¥   )rJ   rK   r?   rh   rÂ   ÚtransformerÚ	post_initrX   s     €r.   rK   zDistilBertModel.__init__A  s5   ø€ Ü‰Ñ˜Ô ä$ VÓ,ˆŒÜ& vÓ.ˆÔð 	�‰Õr[   r^   c                 ó.   — | j                   j                  S ©z1
        Returns the position embeddings
        )rh   rQ   ©rY   s    r.   Úget_position_embeddingsz'DistilBertModel.get_position_embeddingsJ  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&   )r@   rP   ÚloggerÚinforh   rQ   rÕ   Úcloner   rL   r"   rÒ   r/   r*   rß   Ú	ParameterÚtora   )rY   rê   Únum_position_embeds_diffÚold_position_embeddings_weights       r.   Úresize_position_embeddingsz*DistilBertModel.resize_position_embeddingsP  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 r¥   ©rh   rO   rè   s    r.   Úget_input_embeddingsz$DistilBertModel.get_input_embeddingsz  s   € Ø�‰×.Ñ.Ð.r[   Únew_embeddingsc                 ó&   — || j                   _        y r¥   rö   ©rY   rø   s     r.   Úset_input_embeddingsz$DistilBertModel.set_input_embeddings}  s   € Ø*8ˆ�‰Õ'r[   Nr\   ru   r]   rF   rw   .c                 óª   — |du |duz  rt        d«      ‚| j                  |||«      }t        | j                  ||¬«      } | j                  d||dœ|¤ŽS )á   
        input_ids (`torch.LongTensor` of shape `(batch_size, num_choices)`):
            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)
        inputs_embeds (`torch.FloatTensor` of shape `(batch_size, num_choices, 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.
        Nz:You must specify exactly one of input_ids or inputs_embeds)r@   r]   ru   )r—   ru   © )r�   rh   r   r@   rä   )rY   r\   ru   r]   rF   rw   rh   s          r.   ri   zDistilBertModel.forward€  sw   € ð0 ˜Ð -°tÐ";Ò<ÜÐYÓZÐZà—_‘_ Y°¸|ÓLˆ
ä2Ø—;‘;Ø$Ø)ô
ˆð  ˆt×Ñð 
Ø$Ø)ñ
ð ñ
ð 	
r[   )NNNN)rj   rk   rl   r   rK   r   rL   ré   Úintrô   r÷   rû   r   r   r   r*   rm   r   r   r   r¦   ri   ro   rp   s   @r.   râ   râ   ?  sö   ø„ ðÐ/õ ð3¨¯©ó 3ð(<Àcó (<ðT/ b§l¡ló /ð9°2·<±<ó 9ð  ØØð *.Ø.2Ø-1Ø,0ñ$
à—<‘< $Ñ&ð$
ð Ÿ™ tÑ+ð$
ð —|‘| dÑ*ð	$
ð
 —l‘l TÑ)ð$
ð Ð+Ñ,ð$
ð 
˜5 §¡¨sÐ!2Ñ3Ñ	3ò$
ó ó ó  ô$
r[   râ   zI
    DistilBert Model with a `masked language modeling` head on top.
    )Úcustom_introc                   óˆ  ‡ — e Zd Zddi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	 	 	 	 	 ddej"                  dz  dej"                  dz  dej"                  dz  dej$                  dz  dej"                  dz  dee   deeej"                  df   z  fd„«       «       Zˆ xZS )ÚDistilBertForMaskedLMzvocab_projector.weightz,distilbert.embeddings.word_embeddings.weightr@   c                 óÒ  •— t         ‰| �  |«       t        |j                  «      | _        t	        |«      | _        t        j                  |j                  |j                  «      | _	        t        j                  |j                  d¬«      | _        t        j                  |j                  |j                  «      | _        | j                  «        t        j                  «       | _        y )NrC   rD   )rJ   rK   r
   r¯   râ   rÍ   r   r�   r"   Úvocab_transformrR   Úvocab_layer_normrM   Úvocab_projectorrå   r   Úmlm_loss_fctrX   s     €r.   rK   zDistilBertForMaskedLM.__init__²  sš   ø€ Ü‰Ñ˜Ô ä(¨×):Ñ):Ó;ˆŒä)¨&Ó1ˆŒÜ!Ÿy™y¨¯©°V·Z±ZÓ@ˆÔÜ "§¡¨V¯Z©Z¸UÔ CˆÔÜ!Ÿy™y¨¯©°V×5FÑ5FÓGˆÔð 	�‰Ôä×/Ñ/Ó1ˆÕr[   r^   c                 ó6   — | j                   j                  «       S rç   ©rÍ   ré   rè   s    r.   ré   z-DistilBertForMaskedLM.get_position_embeddingsÁ  ó   € ð �‰×6Ñ6Ó8Ð8r[   rê   c                 ó:   — | j                   j                  |«       y©rì   N©rÍ   rô   ©rY   rê   s     r.   rô   z0DistilBertForMaskedLM.resize_position_embeddingsÇ  ó   € ð 	�‰×2Ñ2Ð3NÕOr[   c                 ó   — | j                   S r¥   ©r  rè   s    r.   Úget_output_embeddingsz+DistilBertForMaskedLM.get_output_embeddingsÕ  s   € Ø×#Ñ#Ð#r[   rø   c                 ó   — || _         y r¥   r  rú   s     r.   Úset_output_embeddingsz+DistilBertForMaskedLM.set_output_embeddingsØ  s
   € Ø-ˆÕr[   Nr\   ru   r]   ÚlabelsrF   rw   .c           	      ó’  —  | j                   d||||ddœ|¤Ž}|d   }| j                  |«      }	| j                  |	«      }	| j                  |	«      }	| j	                  |	«      }	d}
|�@| j                  |	j                  d|	j                  d«      «      |j                  d«      «      }
t        |
|	|j                  |j                  ¬«      S )aš  
        input_ids (`torch.LongTensor` of shape `(batch_size, num_choices)`):
            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)
        inputs_embeds (`torch.FloatTensor` of shape `(batch_size, num_choices, 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.
        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]`.
        T©r\   ru   r]   rF   Úreturn_dictr   NrH   ©ÚlossÚlogitsr—   rÎ   rþ   )rÍ   r  r¯   r  r  r  r›   rb   r   r—   rÎ   )rY   r\   ru   r]   r  rF   rw   Údlbrt_outputr—   Úprediction_logitsÚmlm_losss              r.   ri   zDistilBertForMaskedLM.forwardÛ  sì   € ð8 '�t—‘ð 
ØØ)Ø'Ø%Øñ
ð ñ
ˆð % Q™ˆØ ×0Ñ0°Ó?ÐØ ŸO™OÐ,=Ó>ÐØ ×1Ñ1Ð2CÓDÐØ ×0Ñ0Ð1BÓCÐàˆØÐØ×(Ñ(Ð):×)?Ñ)?ÀÐDU×DZÑDZÐ[]ÓD^Ó)_Ðag×alÑalÐmoÓapÓqˆHäØØ$Ø&×4Ñ4Ø#×.Ñ.ô	
ð 	
r[   ©NNNNN)rj   rk   rl   Ú_tied_weights_keysr   rK   r   rL   ré   rÿ   rô   rà   r  r  r   r   r*   rm   rn   r   r   r   r¦   ri   ro   rp   s   @r.   r  r  ª  s  ø„ ð 3Ð4bÐcÐð2Ð/õ 2ð9¨¯©ó 9ðPÀcó Pð$ r§y¡yó $ð.°B·I±Ió .ð Øð *.Ø.2Ø-1Ø*.Ø,0ñ1
à—<‘< $Ñ&ð1
ð Ÿ™ tÑ+ð1
ð —|‘| dÑ*ð	1
ð
 × Ñ  4Ñ'ð1
ð —l‘l TÑ)ð1
ð Ð+Ñ,ð1
ð 
˜% §¡¨cÐ 1Ñ2Ñ	2ò1
ó ó ô1
r[   r  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	 	 	 	 	 ddej                  dz  d	ej                  dz  d
ej                  dz  dej                  dz  dej                  dz  dee   deeej                  df   z  fd„«       «       Zˆ xZS )Ú#DistilBertForSequenceClassificationr@   c                 ó˜  •— t         ‰| �  |«       |j                  | _        || _        t	        |«      | _        t        j                  |j                  |j                  «      | _	        t        j                  |j                  |j                  «      | _
        t        j                  |j                  «      | _        | j                  «        y r¥   )rJ   rK   Ú
num_labelsr@   râ   rÍ   r   r�   r"   Úpre_classifierÚ
classifierrS   Úseq_classif_dropoutrT   rå   rX   s     €r.   rK   z,DistilBertForSequenceClassification.__init__  s‰   ø€ Ü‰Ñ˜Ô Ø ×+Ñ+ˆŒØˆŒä)¨&Ó1ˆŒÜ Ÿi™i¨¯
©
°F·J±JÓ?ˆÔÜŸ)™) F§J¡J°×0AÑ0AÓBˆŒÜ—z‘z &×"<Ñ"<Ó=ˆŒð 	�‰Õr[   r^   c                 ó6   — | j                   j                  «       S rç   r	  rè   s    r.   ré   z;DistilBertForSequenceClassification.get_position_embeddings%  r
  r[   rê   c                 ó:   — | j                   j                  |«       yr  r  r  s     r.   rô   z>DistilBertForSequenceClassification.resize_position_embeddings+  r  r[   Nr\   ru   r]   r  rF   rw   .c           	      óF  —  | j                   d||||ddœ|¤Ž}|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#        «       } ||
|«      }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).
        Tr  r   Nr   Ú
regressionÚsingle_label_classificationÚmulti_label_classificationrH   r  rþ   )rÍ   r%  r   ÚReLUrT   r&  r@   Úproblem_typer$  r`   r*   rd   rÿ   r   Úsqueezer   r›   r   r   r—   rÎ   )rY   r\   ru   r]   r  rF   rw   Údistilbert_outputÚhidden_stateÚpooled_outputr  r  Úloss_fcts                r.   ri   z+DistilBertForSequenceClassification.forward9  sØ  € ð" ,˜DŸO™Oð 
ØØ)Ø'Ø%Øñ
ð ñ
Ðð )¨Ñ+ˆØ$¢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Ü,Ó.�Ù ¨Ó/�ä'ØØØ+×9Ñ9Ø(×3Ñ3ô	
ð 	
r[   r  )rj   rk   rl   r   rK   r   rL   ré   rÿ   rô   r   r   r*   rm   rn   r   r   r   r¦   ri   ro   rp   s   @r.   r"  r"    sç   ø„ ðÐ/õ ð9¨¯©ó 9ðPÀcó Pð Øð *.Ø.2Ø-1Ø*.Ø,0ñ:
à—<‘< $Ñ&ð:
ð Ÿ™ tÑ+ð:
ð —|‘| dÑ*ð	:
ð
 × Ñ  4Ñ'ð:
ð —l‘l TÑ)ð:
ð Ð+Ñ,ð:
ð 
" E¨%¯,©,¸Ð*;Ñ$<Ñ	<ò:
ó ó ô:
r[   r"  c                   ó`  ‡ — e Zd Zdefˆ fd„Zdej                  fd„Zdefd„Z	e
e	 	 	 	 	 	 ddej                  dz  d	ej                  dz  d
ej                  dz  dej                  dz  dej                  dz  dej                  dz  dee   deeej                  df   z  fd„«       «       Zˆ xZS )ÚDistilBertForQuestionAnsweringr@   c                 óX  •— t         ‰| �  |«       t        |«      | _        t	        j
                  |j                  |j                  «      | _        |j                  dk7  rt        d|j                  › �«      ‚t	        j                  |j                  «      | _        | j                  «        y )Nr1   z)config.num_labels should be 2, but it is )rJ   rK   râ   rÍ   r   r�   r"   r$  Ú
qa_outputsr�   rS   Ú
qa_dropoutrT   rå   rX   s     €r.   rK   z'DistilBertForQuestionAnswering.__init__z  s‚   ø€ Ü‰Ñ˜Ô ä)¨&Ó1ˆŒÜŸ)™) F§J¡J°×0AÑ0AÓBˆŒØ×Ñ Ò!ÜÐHÈ×IZÑIZÐH[Ð\Ó]Ð]ä—z‘z &×"3Ñ"3Ó4ˆŒð 	�‰Õr[   r^   c                 ó6   — | j                   j                  «       S rç   r	  rè   s    r.   ré   z6DistilBertForQuestionAnswering.get_position_embeddings‡  r
  r[   rê   c                 ó:   — | j                   j                  |«       yr  r  r  s     r.   rô   z9DistilBertForQuestionAnswering.resize_position_embeddings�  r  r[   Nr\   ru   r]   Ústart_positionsÚend_positionsrF   rw   .c           	      óú  —  | j                   d||||ddœ|¤Ž}|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  }t        ||||j                  |j                  ¬
«      S )rý   Tr  r   r   rH   rz   N)Úignore_indexr1   )r  Ústart_logitsÚ
end_logitsr—   rÎ   rþ   )rÍ   rT   r8  Úsplitr0  r�   Úlenrb   Úclampr   r   r   r—   rÎ   )rY   r\   ru   r]   r<  r=  rF   rw   r1  r—   r  r@  rA  Ú
total_lossÚignored_indexr4  Ú
start_lossÚend_losss                     r.   ri   z&DistilBertForQuestionAnswering.forward›  s“  € ð2 ,˜DŸO™Oð 
ØØ)Ø'Ø%Øñ
ð ñ
Ðð *¨!Ñ,ˆàŸ™ ]Ó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ä+ØØ%Ø!Ø+×9Ñ9Ø(×3Ñ3ô
ð 	
r[   )NNNNNN)rj   rk   rl   r   rK   r   rL   ré   rÿ   rô   r   r   r*   rm   r   r   r   r¦   ri   ro   rp   s   @r.   r6  r6  x  sû   ø„ ðÐ/õ ð9¨¯©ó 9ðPÀcó Pð Øð *.Ø.2Ø-1Ø/3Ø-1Ø,0ñ>
à—<‘< $Ñ&ð>
ð Ÿ™ tÑ+ð>
ð —|‘| dÑ*ð	>
ð
 Ÿ™¨Ñ,ð>
ð —|‘| dÑ*ð>
ð —l‘l TÑ)ð>
ð Ð+Ñ,ð>
ð 
&¨¨e¯l©l¸CÐ.?Ñ(@Ñ	@ò>
ó ó ô>
r[   r6  c                   ó@  ‡ — e Zd Zdefˆ fd„Zdej                  fd„Zdefd„Z	e
e	 	 	 	 	 ddej                  dz  d	ej                  dz  d
ej                  dz  dej                  dz  dej                  dz  dee   deeej                  df   z  fd„«       «       Zˆ xZS )Ú DistilBertForTokenClassificationr@   c                 ó,  •— t         ‰| �  |«       |j                  | _        t        |«      | _        t        j                  |j                  «      | _        t        j                  |j                  |j                  «      | _
        | j                  «        y r¥   )rJ   rK   r$  râ   rÍ   r   rS   rT   r�   Úhidden_sizer&  rå   rX   s     €r.   rK   z)DistilBertForTokenClassification.__init__à  sg   ø€ Ü‰Ñ˜Ô Ø ×+Ñ+ˆŒä)¨&Ó1ˆŒÜ—z‘z &§.¡.Ó1ˆŒÜŸ)™) F×$6Ñ$6¸×8IÑ8IÓJˆŒð 	�‰Õr[   r^   c                 ó6   — | j                   j                  «       S rç   r	  rè   s    r.   ré   z8DistilBertForTokenClassification.get_position_embeddingsë  r
  r[   rê   c                 ó:   — | j                   j                  |«       yr  r  r  s     r.   rô   z;DistilBertForTokenClassification.resize_position_embeddingsñ  r  r[   Nr\   ru   r]   r  rF   rw   .c                 óF  —  | j                   |f|||ddœ|¤Ž}|d   }| j                  |«      }| j                  |«      }	d}
|�<t        «       } ||	j	                  d| j
                  «      |j	                  d«      «      }
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]`.
        T©ru   r]   rF   r  r   NrH   r  )	rÍ   rT   r&  r   r›   r$  r   r—   rÎ   )rY   r\   ru   r]   r  rF   rw   ÚoutputsÚsequence_outputr  r  r4  s               r.   ri   z(DistilBertForTokenClassification.forwardÿ  s´   € ð "�$—/‘/Øð
à)Ø'Ø%Øñ
ð ñ
ˆð " !™*ˆàŸ,™, Ó7ˆØ—‘ Ó1ˆàˆØÐÜ'Ó)ˆHÙ˜FŸK™K¨¨D¯O©OÓ<¸f¿k¹kÈ"»oÓNˆDä$ØØØ!×/Ñ/Ø×)Ñ)ô	
ð 	
r[   r  )rj   rk   rl   r   rK   r   rL   ré   rÿ   rô   r   r   r*   rm   rn   r   r   r   r¦   ri   ro   rp   s   @r.   rJ  rJ  Þ  sç   ø„ ð	Ð/õ 	ð9¨¯©ó 9ðPÀcó Pð Øð *.Ø.2Ø-1Ø*.Ø,0ñ%
à—<‘< $Ñ&ð%
ð Ÿ™ tÑ+ð%
ð —|‘| dÑ*ð	%
ð
 × Ñ  4Ñ'ð%
ð —l‘l TÑ)ð%
ð Ð+Ñ,ð%
ð 
  u§|¡|°SÐ'8Ñ!9Ñ	9ò%
ó ó ô%
r[   rJ  c                   ó@  ‡ — e Zd Zdefˆ fd„Zdej                  fd„Zdefd„Z	e
e	 	 	 	 	 ddej                  dz  d	ej                  dz  d
ej                  dz  dej                  dz  dej                  dz  dee   deeej                  df   z  fd„«       «       Zˆ xZS )ÚDistilBertForMultipleChoicer@   c                 óT  •— t         ‰| �  |«       t        |«      | _        t	        j
                  |j                  |j                  «      | _        t	        j
                  |j                  d«      | _        t	        j                  |j                  «      | _        | j                  «        y )Nr   )rJ   rK   râ   rÍ   r   r�   r"   r%  r&  rS   r'  rT   rå   rX   s     €r.   rK   z$DistilBertForMultipleChoice.__init__+  so   ø€ Ü‰Ñ˜Ô ä)¨&Ó1ˆŒÜ Ÿi™i¨¯
©
°F·J±JÓ?ˆÔÜŸ)™) F§J¡J°Ó2ˆŒÜ—z‘z &×"<Ñ"<Ó=ˆŒð 	�‰Õr[   r^   c                 ó6   — | j                   j                  «       S rç   r	  rè   s    r.   ré   z3DistilBertForMultipleChoice.get_position_embeddings6  r
  r[   rê   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     r.   rô   z6DistilBertForMultipleChoice.resize_position_embeddings<  r  r[   Nr\   ru   r]   r  rF   rw   .c                 ó¾  — |�|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                  |f|||ddœ|¤Ž}|d   }	|	dd…df   }
| j	                  |
«      }
 t        j                  «       |
«      }
| j                  |
«      }
| j                  |
«      }|j                  d|«      }d}|�t        «       } |||«      }t        |||j                  |j                  ¬«      S )	a^  
        input_ids (`torch.LongTensor` of shape `(batch_size, num_choices, sequence_length)`):
            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)
        inputs_embeds (`torch.FloatTensor` of shape `(batch_size, num_choices, sequence_length, 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.
        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)

        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   rH   éþÿÿÿTrP  r   r  )rš   r›   rb   rÍ   r%  r   r.  rT   r&  r   r   r—   rÎ   )rY   r\   ru   r]   r  rF   rw   Únum_choicesrQ  r2  r3  r  Úreshaped_logitsr  r4  s                  r.   ri   z#DistilBertForMultipleChoice.forwardJ  s�  € ðb -6Ð,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àð 	ð "�$—/‘/Øð
à)Ø'Ø%Øñ
ð ñ
ˆð ˜q‘zˆØ$¢Q¨ TÑ*ˆØ×+Ñ+¨MÓ:ˆØ!œŸ™›	 -Ó0ˆØŸ™ ]Ó3ˆØ—‘ Ó/ˆà Ÿ+™+ b¨+Ó6ˆàˆØÐÜ'Ó)ˆHÙ˜O¨VÓ4ˆDä(ØØ"Ø!×/Ñ/Ø×)Ñ)ô	
ð 	
r[   r  )rj   rk   rl   r   rK   r   rL   ré   rÿ   rô   r   r   r*   rm   rn   r   r   r   r¦   ri   ro   rp   s   @r.   rT  rT  )  sð   ø„ ð	Ð/õ 	ð9¨¯©ó 9ðPÀcó Pð Øð *.Ø.2Ø-1Ø*.Ø,0ñU
à—<‘< $Ñ&ðU
ð Ÿ™ tÑ+ðU
ð —|‘| dÑ*ð	U
ð
 × Ñ  4Ñ'ðU
ð —l‘l TÑ)ðU
ð Ð+Ñ,ðU
ð 
# U¨5¯<©<¸Ð+<Ñ%=Ñ	=òU
ó ó ôU
r[   rT  )r  rT  r6  r"  rJ  râ   rÌ   )Nr™   )HÚ__doc__Úcollections.abcr   Únumpyr2   r*   r   Útorch.nnr   r   r   Ú r	   rÓ   Úactivationsr
   Úconfiguration_utilsr   Úintegrations.deepspeedr   Úmasking_utilsr   Úmodeling_layersr   Úmodeling_outputsr   r   r   r   r   r   Úmodeling_utilsr   r   Úprocessing_utilsr   Úpytorch_utilsr   Úutilsr   r   r   Úutils.genericr   r   Úutils.output_capturingr   Úconfiguration_distilbertr    Ú
get_loggerrj   rí   rÿ   rm   r/   r-   rà   r?   Úfloatr„   r†   r¨   r¶   rÂ   rÌ   râ   r  r"  r6  rJ  rT  Ú__all__rþ   r[   r.   ú<module>rq     sy  ðñõ
 %ã Û Ý ß AÑ Aå &Ý )Ý 3Ý @Ý 6Ý 9÷÷ ÷ GÝ &õ÷ñ ÷
 JÝ 5Ý 6ð 
ˆ×	Ñ	˜HÓ	%€ðL¨ð L°#ð L¸E¿L¹Ló Lð¨ð °3ð ¸U¿\¹\ó ô&�—‘ô &ð` !Øñ%Ø�I‰Ið%à�<‰<ð%ð 
�‰ð%ð �<‰<ð	%ð
 —L‘L 4Ñ'ð%ð �T‰\ð%ð ð%ð Ð'Ñ(ó%ô85)˜bŸi™iô 5)ôpˆ"�)‰)ô ô* Ð1ô  ôF@�"—)‘)ô @ð0 ôi ó ió ðið< ôg
Ð/ó g
ó ðg
ñT ðôô
_
Ð5ó _
óð
_
ñD ðôô^
Ð*Có ^
óð^
ðB ôb
Ð%>ó b
ó ðb
ðJ ôG
Ð'@ó G
ó ðG
ðT ôw
Ð";ó w
ó ðw
òt�r[   