Ë
    S^(hØ  ã                   óJ  — d Z ddlZddlZddlZddlmZ ddl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mZ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" ddl#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z) ddl*m+Z+  e(jX                  e-«      Z.dZ/dZ0d„ Z1 G d„ dejd                  «      Z3 G d„ dejd                  «      Z4 G d„ dejd                  «      Z5 G d„ dejd                  «      Z6 G d„ dejd                  «      Z7 G d„ dejd                  «      Z8 G d„ dejd                  «      Z9 G d „ d!ejd                  «      Z: G d"„ d#ejd                  «      Z; G d$„ d%ejd                  «      Z< G d&„ d'ejd                  «      Z= G d(„ d)ejd                  «      Z> G d*„ d+ejd                  «      Z? G d,„ d-ejd                  «      Z@ G d.„ d/ejd                  «      ZA G d0„ d1e«      ZBe G d2„ d3e$«      «       ZCd4ZDd5ZE e&d6eD«       G d7„ d8eB«      «       ZF e&d9eD«       G d:„ d;eB«      «       ZG e&d<eD«       G d=„ d>eB«      «       ZH e&d?eD«       G d@„ dAeB«      «       ZI e&dBeD«       G dC„ dDeB«      «       ZJ e&dEeD«       G dF„ dGeB«      «       ZK e&dHeD«       G dI„ dJeB«      «       ZL e&dKeD«       G dL„ dMeB«      «       ZMy)NzPyTorch Nezha model.é    N)Ú	dataclass)ÚListÚOptionalÚTupleÚUnion)Únn)ÚBCEWithLogitsLossÚCrossEntropyLossÚMSELossé   )ÚACT2FN)Ú)BaseModelOutputWithPastAndCrossAttentionsÚ,BaseModelOutputWithPoolingAndCrossAttentionsÚMaskedLMOutputÚMultipleChoiceModelOutputÚNextSentencePredictorOutputÚQuestionAnsweringModelOutputÚSequenceClassifierOutputÚTokenClassifierOutput)ÚPreTrainedModel)Úapply_chunking_to_forwardÚ find_pruneable_heads_and_indicesÚprune_linear_layer)ÚModelOutputÚadd_code_sample_docstringsÚadd_start_docstringsÚ%add_start_docstrings_to_model_forwardÚloggingÚreplace_return_docstringsé   )ÚNezhaConfigzsijunhe/nezha-cn-baser!   c           	      óL  — 	 ddl }ddl}ddl}t        j                  j                  |«      }t        j                  d|› �«       |j                  j                  |«      }g }g }	|D ]^  \  }
}t        j                  d|
› d|› �«       |j                  j                  ||
«      }|j                  |
«       |	j                  |«       Œ` t        ||	«      D �]¶  \  }
}|
j                  d«      }
t!        d„ |
D «       «      r(t        j                  d	dj#                  |
«      › �«       ŒR| }|
D ]À  }|j%                  d
|«      r|j                  d|«      }n|g}|d   dk(  s|d   dk(  rt'        |d«      }nW|d   dk(  s|d   dk(  rt'        |d«      }n:|d   dk(  rt'        |d«      }n%|d   dk(  rt'        |d«      }n	 t'        ||d   «      }t+        |«      dk\  sŒ®t-        |d   «      }||   }ŒÂ dd dk(  rt'        |d«      }n|dk(  r|j/                  |«      }	 |j0                  |j0                  k7  r&t3        d|j0                  › d|j0                  › d�«      ‚	 t        j                  d|
› �«       t9        j:                  |«      |_        �Œ¹ | S # t        $ r t        j                  d«       ‚ w xY w# t(        $ r+ t        j                  d	dj#                  |
«      › �«       Y �Œ¼w xY w# t4        $ r1}|xj6                  |j0                  |j0                  fz  c_        ‚ d}~ww xY w)z'Load tf checkpoints in a pytorch model.r   Nz™Loading a TensorFlow model in PyTorch, requires TensorFlow to be installed. Please see https://www.tensorflow.org/install/ for installation instructions.z&Converting TensorFlow checkpoint from zLoading TF weight z with shape ú/c              3   ó$   K  — | ]  }|d v –— Œ
 y­w))Úadam_vÚadam_mÚAdamWeightDecayOptimizerÚAdamWeightDecayOptimizer_1Úglobal_stepN© )Ú.0Úns     úq/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/deprecated/nezha/modeling_nezha.pyú	<genexpr>z+load_tf_weights_in_nezha.<locals>.<genexpr>W   s   è ø€ ò 
àð ÐnÔnñ
ùó   ‚z	Skipping z[A-Za-z]+_\d+z_(\d+)ÚkernelÚgammaÚweightÚoutput_biasÚbetaÚbiasÚoutput_weightsÚsquadÚ
classifieré   r    iõÿÿÿÚ_embeddingszPointer shape z and array shape z mismatchedzInitialize PyTorch weight )ÚreÚnumpyÚ
tensorflowÚImportErrorÚloggerÚerrorÚosÚpathÚabspathÚinfoÚtrainÚlist_variablesÚload_variableÚappendÚzipÚsplitÚanyÚjoinÚ	fullmatchÚgetattrÚAttributeErrorÚlenÚintÚ	transposeÚshapeÚ
ValueErrorÚAssertionErrorÚargsÚtorchÚ
from_numpyÚdata)ÚmodelÚconfigÚtf_checkpoint_pathr;   ÚnpÚtfÚtf_pathÚ	init_varsÚnamesÚarraysÚnamerS   ÚarrayÚpointerÚm_nameÚscope_namesÚnumÚes                     r-   Úload_tf_weights_in_nezharj   :   s,  € ð
ÛãÛô �g‰g�o‰oÐ0Ó1€GÜ
‡K�KÐ8¸¸	ÐBÔCà—‘×'Ñ'¨Ó0€IØ€EØ€FØ ò ‰ˆˆeÜ�‰Ð(¨¨¨l¸5¸'ÐBÔCØ—‘×&Ñ& w°Ó5ˆØ�‰�TÔØ�‰�eÕð	ô ˜5 &Ó)ó ,/‰ˆˆeØ�z‰z˜#‹ˆô ñ 
àô
ô 
ô �K‰K˜) C§H¡H¨T£NÐ#3Ð4Ô5ØØˆØò 	'ˆFØ�|‰|Ð,¨fÔ5Ø Ÿh™h y°&Ó9‘à%˜h�Ø˜1‰~ Ò)¨[¸©^¸wÒ-FÜ! '¨8Ó4‘Ø˜Q‘ =Ò0°KÀ±NÀfÒ4LÜ! '¨6Ó2‘Ø˜Q‘Ð#3Ò3Ü! '¨8Ó4‘Ø˜Q‘ 7Ò*Ü! '¨<Ó8‘ðÜ% g¨{¸1©~Ó>�Gô �;Ó 1Ó$Ü˜+ a™.Ó)�Ø! #™,‘ð+	'ð, �#�$ˆ<˜=Ò(Ü˜g xÓ0‰GØ�xÒØ—L‘L Ó'ˆEð	Ø�}‰} §¡Ò+Ü  >°'·-±-°Ð@QÐRW×R]ÑR]ÐQ^Ð^iÐ!jÓkÐkð ,ô
 	�‰Ð0°°Ð7Ô8Ü×'Ñ'¨Ó.ˆŽðY,/ðZ €Løô ò Ü�‰ðQô	
ð 	ðûôZ &ò Ü—K‘K )¨C¯H©H°T«NÐ+;Ð <Ô=Úðûô ò 	Ø�FŠF�w—}‘} e§k¡kÐ2Ñ2�FØûð	ús5   ‚J Æ9J2È?K)Ê J/Ê20K&Ë%K&Ë)	L#Ë2,LÌL#c                   ó*   ‡ — e Zd ZdZdˆ fd„	Zd„ Zˆ xZS )ÚNezhaRelativePositionsEncodingz3Implement the Functional Relative Position Encodingc                 óD  •— t         ‰| �  «        |dz  dz   }t        j                  |«      }|j	                  |«      j                  ||«      }|t        j                  |«      z
  }t        j                  || |«      }||z   }	t        j                  ||«      }
t        j                  d|t        j                  ¬«      j                  «       j                  d«      }t        j                  t        j                  d|d«      j                  «       t        j                  d«       |z  z  «      }t        j                  ||z  «      |
d d …dd d…f<   t        j                   ||z  «      |
d d …dd d…f<   |	j                  d«      }t        j"                  j$                  j'                  ||¬«      j                  «       }t        j(                  ||
«      }t+        |	j-                  «       «      }|j/                  |«       |j                  |«      }| j1                  d|d	¬
«       y )Nr9   r    r   ©Údtypeg     ˆÃ@éÿÿÿÿ)Únum_classesÚpositions_encodingF©Ú
persistent)ÚsuperÚ__init__rW   ÚarangeÚrepeatÚviewÚtÚclampÚzerosÚint64ÚfloatÚ	unsqueezeÚexpÚmathÚlogÚsinÚcosr   Ú
functionalÚone_hotÚmatmulÚlistÚsizerH   Úregister_buffer)ÚselfÚlengthÚdepthÚmax_relative_positionÚ
vocab_sizeÚ	range_vecÚ	range_matÚdistance_matÚdistance_mat_clippedÚ	final_matÚembeddings_tableÚpositionÚdiv_termÚflat_relative_positions_matrixÚ!one_hot_relative_positions_matrixrr   Úmy_shapeÚ	__class__s                    €r-   rv   z'NezhaRelativePositionsEncoding.__init__†   sÔ  ø€ Ü‰ÑÔØ*¨QÑ.°Ñ2ˆ
Ü—L‘L Ó(ˆ	Ø×$Ñ$ VÓ,×1Ñ1°&¸&ÓAˆ	Ø ¤5§7¡7¨9Ó#5Ñ5ˆÜ$Ÿ{™{¨<Ð:OÐ9OÐQfÓgÐØ(Ð+@Ñ@ˆ	ä Ÿ;™; z°5Ó9ÐÜ—<‘<  :´U·[±[ÔA×GÑGÓI×SÑSÐTUÓVˆÜ—9‘9œUŸ\™\¨!¨U°AÓ6×<Ñ<Ó>Ä4Ç8Á8ÈGÓCTÐBTÐW\ÑB\Ñ]Ó^ˆÜ$)§I¡I¨h¸Ñ.AÓ$BÐš˜A˜D˜q˜D˜Ñ!Ü$)§I¡I¨h¸Ñ.AÓ$BÐš˜A˜D˜q˜D˜Ñ!à)2¯©¸Ó);Ð&Ü,1¯H©H×,?Ñ,?×,GÑ,GØ*¸
ð -Hó -
ç
‰%‹'ð 	*ô #Ÿ\™\Ð*KÐM]Ó^ÐÜ˜	Ÿ™Ó(Ó)ˆØ�‰˜ÔØ/×4Ñ4°XÓ>ÐØ×ÑÐ1Ð3EÐRWÐÕXó    c                 ó2   — | j                   d |…d |…d d …f   S ©N)rr   )r‹   rŒ   s     r-   Úforwardz&NezhaRelativePositionsEncoding.forwardŸ   s"   € Ø×&Ñ& w¨ w°°°ºÐ':Ñ;Ð;rœ   )é   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__rv   rŸ   Ú__classcell__©r›   s   @r-   rl   rl   ƒ   s   ø„ Ù=õYö2<rœ   rl   c            	       ó¤   ‡ — e Zd ZdZˆ fd„Z	 	 	 ddeej                     deej                     deej                     dej                  fd„Z
ˆ xZS )	ÚNezhaEmbeddingsz=Construct the embeddings from word and token_type embeddings.c                 ó$  •— t         ‰| �  «        t        j                  |j                  |j
                  |j                  ¬«      | _        t        j                  |j                  |j
                  «      | _	        t        j                  |j
                  |j                  ¬«      | _
        t        j                  |j                  «      | _        | j                  dt!        j"                  d|j$                  ft         j&                  ¬«      d¬«       y )N)Úpadding_idx©ÚepsÚtoken_type_idsr    rn   Frs   )ru   rv   r   Ú	Embeddingr�   Úhidden_sizeÚpad_token_idÚword_embeddingsÚtype_vocab_sizeÚtoken_type_embeddingsÚ	LayerNormÚlayer_norm_epsÚDropoutÚhidden_dropout_probÚdropoutrŠ   rW   r|   Úmax_position_embeddingsÚlong©r‹   r[   r›   s     €r-   rv   zNezhaEmbeddings.__init__¦   sÃ   ø€ Ü‰ÑÔÜ!Ÿ|™|¨F×,=Ñ,=¸v×?QÑ?QÐ_e×_rÑ_rÔsˆÔÜ%'§\¡\°&×2HÑ2HÈ&×J\ÑJ\Ó%]ˆÔ"ô Ÿ™ f×&8Ñ&8¸f×>SÑ>SÔTˆŒÜ—z‘z &×"<Ñ"<Ó=ˆŒØ×ÑØœeŸk™k¨1¨f×.LÑ.LÐ*MÔUZ×U_ÑU_Ô`Ðmrð 	õ 	
rœ   Ú	input_idsr­   Úinputs_embedsÚreturnc                 óÈ  — |�|j                  «       }n|j                  «       d d }|d   }|€| j                  |«      }|€it        | d«      r-| j                  d d …d |…f   }|j	                  |d   |«      }|}n0t        j                  |t
        j                  |j                  ¬«      }| j                  |«      }||z   }	| j                  |	«      }	| j                  |	«      }	|	S )Nrp   r    r­   r   ©ro   Údevice)r‰   r±   Úhasattrr­   ÚexpandrW   r|   rº   rÁ   r³   r´   r¸   )
r‹   r¼   r­   r½   Úinput_shapeÚ
seq_lengthÚbuffered_token_type_idsÚ buffered_token_type_ids_expandedr³   Ú
embeddingss
             r-   rŸ   zNezhaEmbeddings.forward³   sñ   € ð Ð Ø#Ÿ.™.Ó*‰Kà'×,Ñ,Ó.¨s°Ð3ˆKà  ‘^ˆ
àÐ Ø ×0Ñ0°Ó;ˆMð
 Ð!Ü�tÐ-Ô.Ø*.×*=Ñ*=ºaÀÀ*À¸nÑ*MÐ'Ø3J×3QÑ3QÐR]Ð^_ÑR`ÐblÓ3mÐ0Ø!A‘ä!&§¡¨[ÄÇ
Á
ÐS`×SgÑSgÔ!h�à $× :Ñ :¸>Ó JÐà"Ð%:Ñ:ˆ
Ø—^‘^ JÓ/ˆ
Ø—\‘\ *Ó-ˆ
ØÐrœ   )NNN)r¡   r¢   r£   r¤   rv   r   rW   Ú
LongTensorÚFloatTensorÚTensorrŸ   r¥   r¦   s   @r-   r¨   r¨   £   sf   ø„ ÙGô
ð 15Ø59Ø59ñ	 à˜E×,Ñ,Ñ-ð ð ! ×!1Ñ!1Ñ2ð ð   × 1Ñ 1Ñ2ð	 ð
 
�‰÷ rœ   r¨   c                   óN  ‡ — e Zd Zˆ fd„Zdej
                  dej
                  fd„Z	 	 	 	 	 	 ddej
                  deej                     deej                     deej                     d	eej                     d
ee	e	ej                           dee
   de	ej
                     fd„Zˆ xZS )ÚNezhaSelfAttentionc                 ó8  •— t         ‰| �  «        |j                  |j                  z  dk7  r&t	        d|j                  › d|j                  › d�«      ‚|j                  | _        t        |j                  |j                  z  «      | _        | j                  | j                  z  | _        t        j                  |j                  | j                  «      | _
        t        j                  |j                  | j                  «      | _        t        j                  |j                  | j                  «      | _        t        j                  |j                  «      | _        t!        |j"                  | j                  |j$                  ¬«      | _        |j(                  | _        y )Nr   zThe hidden size (z6) is not a multiple of the number of attention heads (ú))rŒ   r�   rŽ   )ru   rv   r¯   Únum_attention_headsrT   rQ   Úattention_head_sizeÚall_head_sizer   ÚLinearÚqueryÚkeyÚvaluer¶   Úattention_probs_dropout_probr¸   rl   r¹   rŽ   Úrelative_positions_encodingÚ
is_decoderr»   s     €r-   rv   zNezhaSelfAttention.__init__×   sH  ø€ Ü‰ÑÔØ×Ñ × :Ñ :Ñ:¸aÒ?ÜØ# F×$6Ñ$6Ð#7ð 8Ø ×4Ñ4Ð5°Qð8óð ð
 $*×#=Ñ#=ˆÔ Ü#& v×'9Ñ'9¸F×<VÑ<VÑ'VÓ#WˆÔ Ø!×5Ñ5¸×8PÑ8PÑPˆÔä—Y‘Y˜v×1Ñ1°4×3EÑ3EÓFˆŒ
Ü—9‘9˜V×/Ñ/°×1CÑ1CÓDˆŒÜ—Y‘Y˜v×1Ñ1°4×3EÑ3EÓFˆŒ
ä—z‘z &×"EÑ"EÓFˆŒÜ+IØ×1Ñ1Ø×*Ñ*Ø"(×">Ñ">ô,
ˆÔ(ð
 !×+Ñ+ˆ�rœ   Úxr¾   c                 ó¤   — |j                  «       d d | j                  | j                  fz   }|j                  |«      }|j	                  dddd«      S )Nrp   r   r9   r    é   )r‰   rÐ   rÑ   ry   Úpermute)r‹   rÚ   Únew_x_shapes      r-   Útranspose_for_scoresz'NezhaSelfAttention.transpose_for_scoresï   sL   € Ø—f‘f“h˜s �m t×'?Ñ'?À×AYÑAYÐ&ZÑZˆØ�F‰F�;ÓˆØ�y‰y˜˜A˜q !Ó$Ð$rœ   Úhidden_statesÚattention_maskÚ	head_maskÚencoder_hidden_statesÚencoder_attention_maskÚpast_key_valueÚoutput_attentionsc                 óT  — | j                  |«      }|d u}	|	r|�|d   }
|d   }|}�n |	rC| j                  | j                  |«      «      }
| j                  | j                  |«      «      }|}n»|�y| j                  | j                  |«      «      }
| j                  | j                  |«      «      }t	        j
                  |d   |
gd¬«      }
t	        j
                  |d   |gd¬«      }n@| j                  | j                  |«      «      }
| j                  | j                  |«      «      }| j                  |«      }| j                  r|
|f}t	        j                  ||
j                  dd«      «      }|j                  «       \  }}}}| j                  |«      }|j                  dddd«      }|j                  «       j                  |||z  | j                  «      }t	        j                  ||j                  ddd«      «      }|j                  ||||«      }|j                  dddd«      }||z   }|t        j                   | j                  «      z  }|�||z   }t"        j$                  j'                  |d¬«      }| j)                  |«      }|�||z  }t	        j                  ||«      }| j                  |«      }|j                  dddd«      }|j                  «       j                  |||z  |«      }t	        j                  ||«      }|j                  |||| j                  «      }|j                  dddd«      }||z   }|j                  dddd«      j                  «       }|j                  «       d d | j*                  fz   } |j                  | «      }|r||fn|f}!| j                  r|!|fz   }!|!S )Nr   r    r9   ©Údimrp   éþÿÿÿrÜ   )rÔ   rß   rÕ   rÖ   rW   ÚcatrÙ   r‡   rR   r‰   rØ   rÝ   Ú
contiguousry   rÑ   r�   Úsqrtr   r…   Úsoftmaxr¸   rÒ   )"r‹   rà   rá   râ   rã   rä   rå   ræ   Úmixed_query_layerÚis_cross_attentionÚ	key_layerÚvalue_layerÚquery_layerÚattention_scoresÚ
batch_sizerÐ   Úfrom_seq_lengthÚto_seq_lengthÚrelations_keysÚquery_layer_tÚquery_layer_rÚkey_position_scoresÚkey_position_scores_rÚkey_position_scores_r_tÚattention_probsÚcontext_layerÚrelations_valuesÚattention_probs_tÚattentions_probs_rÚvalue_position_scoresÚvalue_position_scores_rÚvalue_position_scores_r_tÚnew_context_layer_shapeÚoutputss"                                     r-   rŸ   zNezhaSelfAttention.forwardô   sÎ  € ð !ŸJ™J }Ó5Ðð
 3¸$Ð>Ðá .Ð"<à& qÑ)ˆIØ(¨Ñ+ˆKØ3ŠNÙØ×1Ñ1°$·(±(Ð;PÓ2QÓRˆIØ×3Ñ3°D·J±JÐ?TÓ4UÓVˆKØ3‰NØÐ'Ø×1Ñ1°$·(±(¸=Ó2IÓJˆIØ×3Ñ3°D·J±J¸}Ó4MÓNˆKÜŸ	™	 >°!Ñ#4°iÐ"@ÀaÔHˆIÜŸ)™) ^°AÑ%6¸Ð$DÈ!ÔL‰Kà×1Ñ1°$·(±(¸=Ó2IÓJˆIØ×3Ñ3°D·J±J¸}Ó4MÓNˆKà×/Ñ/Ð0AÓBˆà�?Š?ð (¨Ð5ˆNô !Ÿ<™<¨°Y×5HÑ5HÈÈRÓ5PÓQÐàJZ×J_ÑJ_ÓJaÑGˆ
Ð'¨¸-Ø×9Ñ9¸-ÓHˆØ#×+Ñ+¨A¨q°!°QÓ7ˆà%×0Ñ0Ó2×7Ñ7Ø˜ZÐ*=Ñ=¸t×?WÑ?Wó
ˆô $Ÿl™l¨=¸.×:PÑ:PÐQRÐTUÐWXÓ:YÓZÐØ 3× 8Ñ 8Ø˜ZÐ)<¸oó!
Ðð #8×"?Ñ"?ÀÀ1ÀaÈÓ"KÐØ+Ð.EÑEÐà+¬d¯i©i¸×8PÑ8PÓ.QÑQÐàÐ%à/°.Ñ@Ðô Ÿ-™-×/Ñ/Ð0@ÀbÐ/ÓIˆð Ÿ,™, Ó7ˆð Ð Ø-°	Ñ9ˆOäŸ™ _°kÓBˆØ×;Ñ;¸MÓJÐØ+×3Ñ3°A°q¸!¸QÓ?ÐØ.×9Ñ9Ó;×@Ñ@Ø˜ZÐ*=Ñ=¸}ó
Ðô !&§¡Ð-?ÐAQÓ RÐØ"7×"<Ñ"<Ø˜ZÐ)<¸d×>VÑ>Vó#
Ðð %<×$CÑ$CÀAÀqÈ!ÈQÓ$OÐ!Ø%Ð(AÑAˆà%×-Ñ-¨a°°A°qÓ9×DÑDÓFˆØ"/×"4Ñ"4Ó"6°s¸Ð";¸t×?QÑ?QÐ>SÑ"SÐØ%×*Ñ*Ð+BÓCˆá6G�= /Ñ2ÈmÐM]ˆà�?Š?Ø Ð 1Ñ1ˆGØˆrœ   ©NNNNNF)r¡   r¢   r£   rv   rW   rË   rß   r   rÊ   r   ÚboolrŸ   r¥   r¦   s   @r-   rÍ   rÍ   Ö   så   ø„ ô,ð0% e§l¡lð %°u·|±|ó %ð 7;Ø15Ø=AØ>BØDHØ,1ñfà—|‘|ðfð ! ×!2Ñ!2Ñ3ðfð ˜E×-Ñ-Ñ.ð	fð
  (¨×(9Ñ(9Ñ:ðfð !)¨×):Ñ):Ñ ;ðfð !  u¨U×->Ñ->Ñ'?Ñ!@ÑAðfð $ D™>ðfð 
ˆu�|‰|Ñ	÷frœ   rÍ   c                   ón   ‡ — e Zd Zˆ fd„Zdej
                  dej
                  dej
                  fd„Zˆ xZS )ÚNezhaSelfOutputc                 ó(  •— t         ‰| �  «        t        j                  |j                  |j                  «      | _        t        j                  |j                  |j                  ¬«      | _        t        j                  |j                  «      | _
        y ©Nr«   )ru   rv   r   rÓ   r¯   Údenser´   rµ   r¶   r·   r¸   r»   s     €r-   rv   zNezhaSelfOutput.__init__^  s`   ø€ Ü‰ÑÔÜ—Y‘Y˜v×1Ñ1°6×3EÑ3EÓFˆŒ
ÜŸ™ f×&8Ñ&8¸f×>SÑ>SÔTˆŒÜ—z‘z &×"<Ñ"<Ó=ˆ�rœ   rà   Úinput_tensorr¾   c                 ór   — | j                  |«      }| j                  |«      }| j                  ||z   «      }|S rž   ©r  r¸   r´   ©r‹   rà   r  s      r-   rŸ   zNezhaSelfOutput.forwardd  ó7   € ØŸ
™
 =Ó1ˆØŸ™ ]Ó3ˆØŸ™ }°|Ñ'CÓDˆØÐrœ   ©r¡   r¢   r£   rv   rW   rË   rŸ   r¥   r¦   s   @r-   r  r  ]  ó1   ø„ ô>ð U§\¡\ð ÀÇÁð ÐRW×R^ÑR^÷ rœ   r  c                   ó  ‡ — e Zd Zˆ fd„Zd„ Z	 	 	 	 	 	 ddej                  deej                     deej                     deej                     deej                     dee	e	ej                           d	ee
   d
e	ej                     fd„Zˆ xZS )ÚNezhaAttentionc                 ó€   •— t         ‰| �  «        t        |«      | _        t	        |«      | _        t        «       | _        y rž   )ru   rv   rÍ   r‹   r  ÚoutputÚsetÚpruned_headsr»   s     €r-   rv   zNezhaAttention.__init__l  s0   ø€ Ü‰ÑÔÜ& vÓ.ˆŒ	Ü% fÓ-ˆŒÜ›EˆÕrœ   c                 ó>  — t        |«      dk(  ry t        || j                  j                  | j                  j                  | j
                  «      \  }}t        | j                  j                  |«      | j                  _        t        | j                  j                  |«      | j                  _        t        | j                  j                  |«      | j                  _	        t        | j                  j                  |d¬«      | j                  _        | j                  j                  t        |«      z
  | j                  _        | j                  j                  | j                  j                  z  | j                  _        | j
                  j                  |«      | _        y )Nr   r    rè   )rP   r   r‹   rÐ   rÑ   r  r   rÔ   rÕ   rÖ   r  r  rÒ   Úunion)r‹   ÚheadsÚindexs      r-   Úprune_headszNezhaAttention.prune_headsr  s  € Üˆu‹:˜Š?ØÜ7Ø�4—9‘9×0Ñ0°$·)±)×2OÑ2OÐQU×QbÑQbó
‰ˆˆuô
 -¨T¯Y©Y¯_©_¸eÓDˆ�	‰	ŒÜ*¨4¯9©9¯=©=¸%Ó@ˆ�	‰	ŒÜ,¨T¯Y©Y¯_©_¸eÓDˆ�	‰	ŒÜ.¨t¯{©{×/@Ñ/@À%ÈQÔOˆ�‰Ôð )-¯	©	×(EÑ(EÌÈEË
Ñ(Rˆ�	‰	Ô%Ø"&§)¡)×"?Ñ"?À$Ç)Á)×B_ÑB_Ñ"_ˆ�	‰	ÔØ ×-Ñ-×3Ñ3°EÓ:ˆÕrœ   rà   rá   râ   rã   rä   rå   ræ   r¾   c           	      óp   — | j                  |||||||«      }| j                  |d   |«      }	|	f|dd  z   }
|
S )Nr   r    )r‹   r  )r‹   rà   rá   râ   rã   rä   rå   ræ   Úself_outputsÚattention_outputr  s              r-   rŸ   zNezhaAttention.forward„  sW   € ð —y‘yØØØØ!Ø"ØØó
ˆð  Ÿ;™; |°A¡¸ÓFÐØ#Ð%¨°Q°RÐ(8Ñ8ˆØˆrœ   r  )r¡   r¢   r£   rv   r   rW   rË   r   rÊ   r   r	  rŸ   r¥   r¦   s   @r-   r  r  k  sÆ   ø„ ô"ò;ð* 7;Ø15Ø=AØ>BØDHØ,1ñà—|‘|ðð ! ×!2Ñ!2Ñ3ðð ˜E×-Ñ-Ñ.ð	ð
  (¨×(9Ñ(9Ñ:ðð !)¨×):Ñ):Ñ ;ðð !  u¨U×->Ñ->Ñ'?Ñ!@ÑAðð $ D™>ðð 
ˆu�|‰|Ñ	÷rœ   r  c                   óV   ‡ — e Zd Zˆ fd„Zdej
                  dej
                  fd„Zˆ xZS )ÚNezhaIntermediatec                 ó  •— t         ‰| �  «        t        j                  |j                  |j
                  «      | _        t        |j                  t        «      rt        |j                     | _        y |j                  | _        y rž   )ru   rv   r   rÓ   r¯   Úintermediate_sizer  Ú
isinstanceÚ
hidden_actÚstrr   Úintermediate_act_fnr»   s     €r-   rv   zNezhaIntermediate.__init__�  s]   ø€ Ü‰ÑÔÜ—Y‘Y˜v×1Ñ1°6×3KÑ3KÓLˆŒ
Ü�f×'Ñ'¬Ô-Ü'-¨f×.?Ñ.?Ñ'@ˆDÕ$à'-×'8Ñ'8ˆDÕ$rœ   rà   r¾   c                 óJ   — | j                  |«      }| j                  |«      }|S rž   )r  r+  ©r‹   rà   s     r-   rŸ   zNezhaIntermediate.forward¥  s&   € ØŸ
™
 =Ó1ˆØ×0Ñ0°Ó?ˆØÐrœ   r  r¦   s   @r-   r%  r%  œ  s#   ø„ ô9ð U§\¡\ð °e·l±l÷ rœ   r%  c                   ón   ‡ — e Zd Zˆ fd„Zdej
                  dej
                  dej
                  fd„Zˆ xZS )ÚNezhaOutputc                 ó(  •— t         ‰| �  «        t        j                  |j                  |j
                  «      | _        t        j                  |j
                  |j                  ¬«      | _        t        j                  |j                  «      | _        y r  )ru   rv   r   rÓ   r'  r¯   r  r´   rµ   r¶   r·   r¸   r»   s     €r-   rv   zNezhaOutput.__init__¬  s`   ø€ Ü‰ÑÔÜ—Y‘Y˜v×7Ñ7¸×9KÑ9KÓLˆŒ
ÜŸ™ f×&8Ñ&8¸f×>SÑ>SÔTˆŒÜ—z‘z &×"<Ñ"<Ó=ˆ�rœ   rà   r  r¾   c                 ór   — | j                  |«      }| j                  |«      }| j                  ||z   «      }|S rž   r  r  s      r-   rŸ   zNezhaOutput.forward²  r  rœ   r  r¦   s   @r-   r/  r/  «  r  rœ   r/  c                   ó  ‡ — e Zd Zˆ fd„Z	 	 	 	 	 	 ddej
                  deej                     deej                     deej                     deej                     deeeej                           dee	   d	eej
                     fd
„Z
d„ Zˆ xZS )Ú
NezhaLayerc                 ób  •— t         ‰| �  «        |j                  | _        d| _        t	        |«      | _        |j                  | _        |j                  | _        | j                  r*| j                  st        | › d�«      ‚t	        |«      | _	        t        |«      | _        t        |«      | _        y )Nr    z> should be used as a decoder model if cross attention is added)ru   rv   Úchunk_size_feed_forwardÚseq_len_dimr  Ú	attentionrÙ   Úadd_cross_attentionrT   Úcrossattentionr%  Úintermediater/  r  r»   s     €r-   rv   zNezhaLayer.__init__º  s”   ø€ Ü‰ÑÔØ'-×'EÑ'EˆÔ$ØˆÔÜ'¨Ó/ˆŒØ ×+Ñ+ˆŒØ#)×#=Ñ#=ˆÔ Ø×#Ò#Ø—?’?Ü  D 6Ð)gÐ!hÓiÐiÜ"0°Ó"8ˆDÔÜ-¨fÓ5ˆÔÜ! &Ó)ˆ�rœ   rà   rá   râ   rã   rä   rå   ræ   r¾   c           	      óÒ  — |�|d d nd }| j                  |||||¬«      }	|	d   }
| j                  r|	dd }|	d   }n|	dd  }d }| j                  rT|�Rt        | d«      st        d| › d�«      ‚|�|d	d  nd }| j	                  |
||||||«      }|d   }
||dd z   }|d   }|z   }t        | j                  | j                  | j                  |
«      }|f|z   }| j                  r|fz   }|S )
Nr9   )ræ   rå   r   r    rp   r9  z'If `encoder_hidden_states` are passed, z` has to be instantiated with cross-attention layers by setting `config.add_cross_attention=True`rê   )	r7  rÙ   rÂ   rT   r9  r   Úfeed_forward_chunkr5  r6  )r‹   rà   rá   râ   rã   rä   rå   ræ   Úself_attn_past_key_valueÚself_attention_outputsr#  r  Úpresent_key_valueÚcross_attn_present_key_valueÚcross_attn_past_key_valueÚcross_attention_outputsÚlayer_outputs                    r-   rŸ   zNezhaLayer.forwardÈ  s}  € ð :HÐ9S >°"°1Ñ#5ÐY]Ð Ø!%§¡ØØØØ/Ø3ð "0ó "
Ðð 2°!Ñ4Ðð �?Š?Ø,¨Q¨rÐ2ˆGØ 6°rÑ :Ñà,¨Q¨RÐ0ˆGà'+Ð$Ø�?Š?Ð4Ð@Ü˜4Ð!1Ô2Ü Ø=¸d¸Vð DDð Dóð ð @NÐ?Y¨°r°sÑ(;Ð_cÐ%Ø&*×&9Ñ&9Ø ØØØ%Ø&Ø)Ø!ó'Ð#ð  7°qÑ9ÐØÐ 7¸¸"Ð =Ñ=ˆGð ,CÀ2Ñ+FÐ(Ø 1Ð4PÑ PÐä0Ø×#Ñ# T×%AÑ%AÀ4×CSÑCSÐUeó
ˆð  �/ GÑ+ˆð �?Š?ØÐ!2Ð 4Ñ4ˆGàˆrœ   c                 óL   — | j                  |«      }| j                  ||«      }|S rž   )r:  r  )r‹   r#  Úintermediate_outputrC  s       r-   r<  zNezhaLayer.feed_forward_chunk	  s,   € Ø"×/Ñ/Ð0@ÓAÐØ—{‘{Ð#6Ð8HÓIˆØÐrœ   r  )r¡   r¢   r£   rv   rW   rË   r   rÊ   r   r	  rŸ   r<  r¥   r¦   s   @r-   r3  r3  ¹  sÇ   ø„ ô*ð" 7;Ø15Ø=AØ>BØDHØ,1ñ?à—|‘|ð?ð ! ×!2Ñ!2Ñ3ð?ð ˜E×-Ñ-Ñ.ð	?ð
  (¨×(9Ñ(9Ñ:ð?ð !)¨×):Ñ):Ñ ;ð?ð !  u¨U×->Ñ->Ñ'?Ñ!@ÑAð?ð $ D™>ð?ð 
ˆu�|‰|Ñ	ó?öBrœ   r3  c                   óD  ‡ — e Zd Zˆ fd„Z	 	 	 	 	 	 	 	 	 ddej
                  deej                     deej                     deej                     deej                     deeeej                           dee	   d	ee	   d
ee	   dee	   de
eej
                     ef   fd„Zˆ xZS )ÚNezhaEncoderc                 óÐ   •— t         ‰| �  «        || _        t        j                  t        |j                  «      D �cg c]  }t        |«      ‘Œ c}«      | _        d| _	        y c c}w )NF)
ru   rv   r[   r   Ú
ModuleListÚrangeÚnum_hidden_layersr3  ÚlayerÚgradient_checkpointing)r‹   r[   Ú_r›   s      €r-   rv   zNezhaEncoder.__init__  sN   ø€ Ü‰ÑÔØˆŒÜ—]‘]ÄÀf×F^ÑF^Ó@_Ö#`¸1¤J¨vÕ$6Ò#`ÓaˆŒ
Ø&+ˆÕ#ùò $as   ½A#rà   rá   râ   rã   rä   Úpast_key_valuesÚ	use_cacheræ   Úoutput_hidden_statesÚreturn_dictr¾   c                 óš  — |	rdnd }|rdnd }|r| j                   j                  rdnd }| j                  r%| j                  r|rt        j                  d«       d}|rdnd }t        | j                  «      D ]¤  \  }}|	r||fz   }|�||   nd }|�||   nd }| j                  r/| j                  r#| j                  |j                  |||||||«      }n ||||||||«      }|d   }|r	||d   fz  }|sŒ|||d   fz   }| j                   j                  sŒœ||d   fz   }Œ¦ |	r||fz   }|
st        d„ |||||fD «       «      S t        |||||¬	«      S )
Nr*   zZ`use_cache=True` is incompatible with gradient checkpointing. Setting `use_cache=False`...Fr   rp   r    r9   c              3   ó$   K  — | ]  }|�|–— Œ
 y ­wrž   r*   )r+   Úvs     r-   r.   z'NezhaEncoder.forward.<locals>.<genexpr>X  s   è ø€ ò 
àð �=ô ñ
ùr/   )Úlast_hidden_staterO  rà   Ú
attentionsÚcross_attentions)r[   r8  rM  Útrainingr?   Úwarning_onceÚ	enumeraterL  Ú_gradient_checkpointing_funcÚ__call__Útupler   )r‹   rà   rá   râ   rã   rä   rO  rP  ræ   rQ  rR  Úall_hidden_statesÚall_self_attentionsÚall_cross_attentionsÚnext_decoder_cacheÚiÚlayer_moduleÚlayer_head_maskrå   Úlayer_outputss                       r-   rŸ   zNezhaEncoder.forward  sÎ  € ñ #7™B¸DÐÙ$5™b¸4ÐÙ%6¸4¿;¹;×;ZÒ;Z™rÐ`dÐà×&Ò&¨4¯=ª=ÙÜ×#Ñ#Øpôð "�	á#,™R°$ÐÜ(¨¯©Ó4ò #	V‰OˆAˆ|Ù#Ø$5¸Ð8HÑ$HÐ!à.7Ð.C˜i¨šlÈˆOØ3BÐ3N˜_¨QÒ/ÐTXˆNà×*Ò*¨t¯}ª}Ø $× AÑ AØ ×)Ñ)Ø!Ø"Ø#Ø)Ø*Ø"Ø%ó	!‘ñ !-Ø!Ø"Ø#Ø)Ø*Ø"Ø%ó!�ð *¨!Ñ,ˆMÙØ" }°RÑ'8Ð&:Ñ:Ð"Ú Ø&9¸]È1Ñ=MÐ<OÑ&OÐ#Ø—;‘;×2Ó2Ø+?À=ÐQRÑCSÐBUÑ+UÑ(ðG#	VñJ  Ø 1°]Ð4DÑ DÐáÜñ 
ð "Ø&Ø%Ø'Ø(ðô
ó 
ð 
ô 9Ø+Ø.Ø+Ø*Ø1ô
ð 	
rœ   )	NNNNNNFFT)r¡   r¢   r£   rv   rW   rË   r   rÊ   r   r	  r   r   rŸ   r¥   r¦   s   @r-   rG  rG    s  ø„ ô,ð 7;Ø15Ø=AØ>BØEIØ$(Ø,1Ø/4Ø&*ñS
à—|‘|ðS
ð ! ×!2Ñ!2Ñ3ðS
ð ˜E×-Ñ-Ñ.ð	S
ð
  (¨×(9Ñ(9Ñ:ðS
ð !)¨×):Ñ):Ñ ;ðS
ð " %¨¨e×.?Ñ.?Ñ(@Ñ"AÑBðS
ð ˜D‘>ðS
ð $ D™>ðS
ð ' t™nðS
ð ˜d‘^ðS
ð 
ˆu�U—\‘\Ñ"Ð$MÐMÑ	N÷S
rœ   rG  c                   óV   ‡ — e Zd Zˆ fd„Zdej
                  dej
                  fd„Zˆ xZS )ÚNezhaPoolerc                 ó²   •— t         ‰| �  «        t        j                  |j                  |j                  «      | _        t        j                  «       | _        y rž   )ru   rv   r   rÓ   r¯   r  ÚTanhÚ
activationr»   s     €r-   rv   zNezhaPooler.__init__m  s9   ø€ Ü‰ÑÔÜ—Y‘Y˜v×1Ñ1°6×3EÑ3EÓFˆŒ
ÜŸ'™'›)ˆ�rœ   rà   r¾   c                 ó\   — |d d …df   }| j                  |«      }| j                  |«      }|S )Nr   )r  rk  )r‹   rà   Úfirst_token_tensorÚpooled_outputs       r-   rŸ   zNezhaPooler.forwardr  s6   € ð +ª1¨a¨4Ñ0ÐØŸ
™
Ð#5Ó6ˆØŸ™¨Ó6ˆØÐrœ   r  r¦   s   @r-   rh  rh  l  s#   ø„ ô$ð
 U§\¡\ð °e·l±l÷ rœ   rh  c                   óV   ‡ — e Zd Zˆ fd„Zdej
                  dej
                  fd„Zˆ xZS )ÚNezhaPredictionHeadTransformc                 óh  •— t         ‰| �  «        t        j                  |j                  |j                  «      | _        t        |j                  t        «      rt        |j                     | _
        n|j                  | _
        t        j                  |j                  |j                  ¬«      | _        y r  )ru   rv   r   rÓ   r¯   r  r(  r)  r*  r   Útransform_act_fnr´   rµ   r»   s     €r-   rv   z%NezhaPredictionHeadTransform.__init__|  s{   ø€ Ü‰ÑÔÜ—Y‘Y˜v×1Ñ1°6×3EÑ3EÓFˆŒ
Ü�f×'Ñ'¬Ô-Ü$*¨6×+<Ñ+<Ñ$=ˆDÕ!à$*×$5Ñ$5ˆDÔ!ÜŸ™ f×&8Ñ&8¸f×>SÑ>SÔTˆ�rœ   rà   r¾   c                 ól   — | j                  |«      }| j                  |«      }| j                  |«      }|S rž   )r  rr  r´   r-  s     r-   rŸ   z$NezhaPredictionHeadTransform.forward…  s4   € ØŸ
™
 =Ó1ˆØ×-Ñ-¨mÓ<ˆØŸ™ }Ó5ˆØÐrœ   r  r¦   s   @r-   rp  rp  {  s$   ø„ ôUð U§\¡\ð °e·l±l÷ rœ   rp  c                   ó*   ‡ — e Zd Zˆ fd„Zd„ Zd„ Zˆ xZS )ÚNezhaLMPredictionHeadc                 óH  •— t         ‰| �  «        t        |«      | _        t	        j
                  |j                  |j                  d¬«      | _        t	        j                  t        j                  |j                  «      «      | _        | j                  | j                  _        y )NF)r5   )ru   rv   rp  Ú	transformr   rÓ   r¯   r�   ÚdecoderÚ	ParameterrW   r|   r5   r»   s     €r-   rv   zNezhaLMPredictionHead.__init__�  sm   ø€ Ü‰ÑÔÜ5°fÓ=ˆŒô —y‘y ×!3Ñ!3°V×5FÑ5FÈUÔSˆŒä—L‘L¤§¡¨V×->Ñ->Ó!?Ó@ˆŒ	ð !ŸI™Iˆ�‰Õrœ   c                 ó:   — | j                   | j                  _         y rž   )r5   rx  ©r‹   s    r-   Ú_tie_weightsz"NezhaLMPredictionHead._tie_weightsš  s   € Ø ŸI™Iˆ�‰Õrœ   c                 óJ   — | j                  |«      }| j                  |«      }|S rž   )rw  rx  r-  s     r-   rŸ   zNezhaLMPredictionHead.forward�  s$   € ØŸ™ }Ó5ˆØŸ™ ]Ó3ˆØÐrœ   )r¡   r¢   r£   rv   r|  rŸ   r¥   r¦   s   @r-   ru  ru  Œ  s   ø„ ô&ò&örœ   ru  c                   óV   ‡ — e Zd Zˆ fd„Zdej
                  dej
                  fd„Zˆ xZS )ÚNezhaOnlyMLMHeadc                 óB   •— t         ‰| �  «        t        |«      | _        y rž   )ru   rv   ru  Úpredictionsr»   s     €r-   rv   zNezhaOnlyMLMHead.__init__¤  s   ø€ Ü‰ÑÔÜ0°Ó8ˆÕrœ   Úsequence_outputr¾   c                 ó(   — | j                  |«      }|S rž   )r�  )r‹   r‚  Úprediction_scoress      r-   rŸ   zNezhaOnlyMLMHead.forward¨  s   € Ø ×,Ñ,¨_Ó=ÐØ Ð rœ   r  r¦   s   @r-   r  r  £  s#   ø„ ô9ð! u§|¡|ð !¸¿¹÷ !rœ   r  c                   ó$   ‡ — e Zd Zˆ fd„Zd„ Zˆ xZS )ÚNezhaOnlyNSPHeadc                 ól   •— t         ‰| �  «        t        j                  |j                  d«      | _        y ©Nr9   )ru   rv   r   rÓ   r¯   Úseq_relationshipr»   s     €r-   rv   zNezhaOnlyNSPHead.__init__®  s'   ø€ Ü‰ÑÔÜ "§	¡	¨&×*<Ñ*<¸aÓ @ˆÕrœ   c                 ó(   — | j                  |«      }|S rž   )r‰  )r‹   rn  Úseq_relationship_scores      r-   rŸ   zNezhaOnlyNSPHead.forward²  s   € Ø!%×!6Ñ!6°}Ó!EÐØ%Ð%rœ   ©r¡   r¢   r£   rv   rŸ   r¥   r¦   s   @r-   r†  r†  ­  s   ø„ ôAö&rœ   r†  c                   ó$   ‡ — e Zd Zˆ fd„Zd„ Zˆ xZS )ÚNezhaPreTrainingHeadsc                 óŒ   •— t         ‰| �  «        t        |«      | _        t	        j
                  |j                  d«      | _        y rˆ  )ru   rv   ru  r�  r   rÓ   r¯   r‰  r»   s     €r-   rv   zNezhaPreTrainingHeads.__init__¸  s4   ø€ Ü‰ÑÔÜ0°Ó8ˆÔÜ "§	¡	¨&×*<Ñ*<¸aÓ @ˆÕrœ   c                 óN   — | j                  |«      }| j                  |«      }||fS rž   )r�  r‰  )r‹   r‚  rn  r„  r‹  s        r-   rŸ   zNezhaPreTrainingHeads.forward½  s0   € Ø ×,Ñ,¨_Ó=ÐØ!%×!6Ñ!6°}Ó!EÐØ Ð"8Ð8Ð8rœ   rŒ  r¦   s   @r-   rŽ  rŽ  ·  s   ø„ ôAö
9rœ   rŽ  c                   ó&   — e Zd ZdZeZeZdZdZ	d„ Z
y)ÚNezhaPreTrainedModelz†
    An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
    models.
    ÚnezhaTc                 ó  — 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y)zInitialize the weightsg        )ÚmeanÚstdNg      ð?)r(  r   rÓ   r2   rY   Únormal_r[   Úinitializer_ranger5   Úzero_r®   rª   r´   Úfill_)r‹   Úmodules     r-   Ú_init_weightsz"NezhaPreTrainedModel._init_weightsÎ  s  € ä�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Õ)ð .rœ   N)r¡   r¢   r£   r¤   r!   Úconfig_classrj   Úload_tf_weightsÚbase_model_prefixÚsupports_gradient_checkpointingrœ  r*   rœ   r-   r’  r’  Ã  s$   „ ñð
 €LØ.€OØÐØ&*Ð#ó*rœ   r’  c                   óæ   — e Zd ZU dZdZeej                     ed<   dZ	eej                     ed<   dZ
eej                     ed<   dZeeej                        ed<   dZeeej                        ed<   y)ÚNezhaForPreTrainingOutputa]  
    Output type of [`NezhaForPreTraining`].

    Args:
        loss (*optional*, returned when `labels` is provided, `torch.FloatTensor` of shape `(1,)`):
            Total loss as the sum of the masked language modeling loss and the next sequence prediction
            (classification) loss.
        prediction_logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`):
            Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
        seq_relationship_logits (`torch.FloatTensor` of shape `(batch_size, 2)`):
            Prediction scores of the next sequence prediction (classification) head (scores of True/False continuation
            before SoftMax).
        hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
            Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
            shape `(batch_size, sequence_length, hidden_size)`.

            Hidden-states of the model at the output of each layer plus the initial embedding outputs.
        attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`):
            Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
            sequence_length)`.

            Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
            heads.
    NÚlossÚprediction_logitsÚseq_relationship_logitsrà   rW  )r¡   r¢   r£   r¤   r£  r   rW   rÊ   Ú__annotations__r¤  r¥  rà   r   rW  r*   rœ   r-   r¢  r¢  ß  s~   … ñð2 )-€Dˆ(�5×$Ñ$Ñ
%Ó,Ø59Ð�x × 1Ñ 1Ñ2Ó9Ø;?Ð˜X e×&7Ñ&7Ñ8Ó?Ø8<€M�8˜E %×"3Ñ"3Ñ4Ñ5Ó<Ø59€J�˜˜u×0Ñ0Ñ1Ñ2Ô9rœ   r¢  a?  

    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 ([`NezhaConfig`]): 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)
        token_type_ids (`torch.LongTensor` of shape `({0})`, *optional*):
            Segment token indices to indicate first and second portions of the inputs. Indices are selected in `[0,
            1]`:

            - 0 corresponds to a *sentence A* token,
            - 1 corresponds to a *sentence B* token.

            [What are token type IDs?](../glossary#token-type-ids)
        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.
z_The bare Nezha Model transformer outputting raw hidden-states without any specific head on top.c                   óî  ‡ — e Zd ZdZdˆ fd„	Zd„ Zd„ Z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j"                     deeej&                        dee   dee   dee   dee   deeej"                     ef   fd„«       «       Zˆ xZS )Ú
NezhaModela  

    The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a layer of
    cross-attention is added between the self-attention layers, following the architecture described in [Attention is
    all you need](https://arxiv.org/abs/1706.03762) by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
    Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin.

    To behave as an decoder the model needs to be initialized with the `is_decoder` argument of the configuration set
    to `True`. To be used in a Seq2Seq model, the model needs to initialized with both `is_decoder` argument and
    `add_cross_attention` set to `True`; an `encoder_hidden_states` is then expected as an input to the forward pass.
    c                 óº   •— t         ‰| �  |«       || _        t        |«      | _        t        |«      | _        |rt        |«      nd | _        | j                  «        y rž   )
ru   rv   r[   r¨   rÈ   rG  Úencoderrh  ÚpoolerÚ	post_init)r‹   r[   Úadd_pooling_layerr›   s      €r-   rv   zNezhaModel.__init__O  sK   ø€ Ü‰Ñ˜Ô ØˆŒä)¨&Ó1ˆŒÜ# FÓ+ˆŒá->”k &Ô)ÀDˆŒð 	�‰Õrœ   c                 ó.   — | j                   j                  S rž   ©rÈ   r±   r{  s    r-   Úget_input_embeddingszNezhaModel.get_input_embeddings[  s   € Ø�‰×.Ñ.Ð.rœ   c                 ó&   — || j                   _        y rž   r¯  )r‹   rÖ   s     r-   Úset_input_embeddingszNezhaModel.set_input_embeddings^  s   € Ø*/ˆ�‰Õ'rœ   c                 ó˜   — |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)Úitemsrª  rL  r7  r   )r‹   Úheads_to_prunerL  r  s       r-   Ú_prune_headszNezhaModel._prune_headsa  sE   € ð
 +×0Ñ0Ó2ò 	C‰LˆE�5Ø�L‰L×Ñ˜uÑ%×/Ñ/×;Ñ;¸EÕBñ	Crœ   úbatch_size, sequence_length©Ú
checkpointÚoutput_typer�  r¼   rá   r­   râ   r½   rã   rä   rO  rP  ræ   rQ  rR  r¾   c                 ó˜  — |
�|
n| j                   j                  }
|�|n| j                   j                  }|�|n| j                   j                  }| j                   j                  r|	�|	n| j                   j
                  }	nd}	|�|�t        d«      ‚|�#| j                  ||«       |j                  «       }n!|�|j                  «       dd }nt        d«      ‚|\  }}|�|j                  n|j                  }|�|d   d   j                  d   nd}|€t        j                  |||z   f|¬«      }|€pt        | j                  d	«      r4| j                  j                  dd…d|…f   }|j!                  ||«      }|}n&t        j"                  |t        j$                  |¬
«      }| j'                  ||«      }| j                   j                  rE|�C|j                  «       \  }}}||f}|€t        j                  ||¬«      }| j)                  |«      }nd}| j+                  || j                   j,                  «      }| j                  |||¬«      }| j/                  |||||||	|
||¬«
      }|d   }| j0                  �| j1                  |«      nd}|s
||f|dd z   S t3        |||j4                  |j6                  |j8                  |j:                  ¬«      S )a  
        encoder_hidden_states  (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`, *optional*):
            Sequence of hidden-states at the output of the last layer of the encoder. Used in the cross-attention if
            the model is configured as a decoder.
        encoder_attention_mask (`torch.FloatTensor` of shape `(batch_size, sequence_length)`, *optional*):
            Mask to avoid performing attention on the padding token indices of the encoder input. This mask is used in
            the cross-attention if the model is configured as a decoder. Mask values selected in `[0, 1]`:

            - 1 for tokens that are **not masked**,
            - 0 for tokens that are **masked**.
        past_key_values (`tuple(tuple(torch.FloatTensor))` of length `config.n_layers` with each tuple having 4 tensors of shape `(batch_size, num_heads, sequence_length - 1, embed_size_per_head)`):
            Contains precomputed key and value hidden states of the attention blocks. Can be used to speed up decoding.

            If `past_key_values` are used, the user can optionally input only the last `decoder_input_ids` (those that
            don't have their past key value states given to this model) of shape `(batch_size, 1)` instead of all
            `decoder_input_ids` of shape `(batch_size, sequence_length)`.
        use_cache (`bool`, *optional*):
            If set to `True`, `past_key_values` key value states are returned and can be used to speed up decoding (see
            `past_key_values`).
        NFzDYou cannot specify both input_ids and inputs_embeds at the same timerp   z5You have to specify either input_ids or inputs_embedsr   r9   )rÁ   r­   rÀ   )r¼   r­   r½   )	rá   râ   rã   rä   rO  rP  ræ   rQ  rR  r    )rV  Úpooler_outputrO  rà   rW  rX  )r[   ræ   rQ  Úuse_return_dictrÙ   rP  rT   Ú%warn_if_padding_and_no_attention_maskr‰   rÁ   rS   rW   ÚonesrÂ   rÈ   r­   rÃ   r|   rº   Úget_extended_attention_maskÚinvert_attention_maskÚget_head_maskrK  rª  r«  r   rO  rà   rW  rX  )r‹   r¼   rá   r­   râ   r½   rã   rä   rO  rP  ræ   rQ  rR  rÄ   rõ   rÅ   rÁ   Úpast_key_values_lengthrÆ   rÇ   Úextended_attention_maskÚencoder_batch_sizeÚencoder_sequence_lengthrN  Úencoder_hidden_shapeÚencoder_extended_attention_maskÚembedding_outputÚencoder_outputsr‚  rn  s                                 r-   rŸ   zNezhaModel.forwardi  s  € ðR 2CÐ1NÑ-ÐTX×T_ÑT_×TqÑTqÐà$8Ð$DÑ È$Ï+É+×JjÑJjð 	ð &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆà�;‰;×!Ò!Ø%.Ð%:™	ÀÇÁ×@UÑ@U‰IàˆIàÐ  ]Ð%>ÜÐcÓdÐdØÐ"Ø×6Ñ6°yÀ.ÔQØ#Ÿ.™.Ó*‰KØÐ&Ø'×,Ñ,Ó.¨s°Ð3‰KäÐTÓUÐUà!,Ñˆ
�JØ%.Ð%:�×!Ò!À×@TÑ@Tˆð DSÐC^ °Ñ!3°AÑ!6×!<Ñ!<¸QÒ!?ÐdeÐàÐ!Ü"ŸZ™Z¨*°jÐCYÑ6YÐ)ZÐdjÔkˆNàÐ!Ü�t—‘Ð(8Ô9Ø*.¯/©/×*HÑ*HÊÈKÈZÈKÈÑ*XÐ'Ø3J×3QÑ3QÐR\Ð^hÓ3iÐ0Ø!A‘ä!&§¡¨[ÄÇ
Á
ÐSYÔ!Z�ð 15×0PÑ0PÐQ_ÐalÓ0mÐð �;‰;×!Ò!Ð&;Ð&GØ=R×=WÑ=WÓ=YÑ:ÐÐ 7¸Ø$6Ð8OÐ#PÐ Ø%Ð-Ü).¯©Ð4HÐQWÔ)XÐ&Ø.2×.HÑ.HÐI_Ó.`Ñ+à.2Ð+ð ×&Ñ& y°$·+±+×2OÑ2OÓPˆ	àŸ?™?ØØ)Ø'ð +ó 
Ðð
 Ÿ,™,ØØ2ØØ"7Ø#BØ+ØØ/Ø!5Ø#ð 'ó 
ˆð *¨!Ñ,ˆØ8<¿¹Ð8O˜Ÿ™ OÔ4ÐUYˆáØ# ]Ð3°oÀaÀbÐ6IÑIÐIä;Ø-Ø'Ø+×;Ñ;Ø)×7Ñ7Ø&×1Ñ1Ø,×=Ñ=ô
ð 	
rœ   )T)NNNNNNNNNNNN)r¡   r¢   r£   r¤   rv   r°  r²  r¶  r   ÚNEZHA_INPUTS_DOCSTRINGÚformatr   Ú_CHECKPOINT_FOR_DOCr   Ú_CONFIG_FOR_DOCr   rW   rË   r   rÊ   r	  r   r   rŸ   r¥   r¦   s   @r-   r¨  r¨  >  s‚  ø„ ñ

õ
ò/ò0òCñ +Ð+A×+HÑ+HÐIfÓ+gÓhÙØ&Ø@Ø$ôð -1Ø15Ø15Ø,0Ø04Ø8<Ø9=Ø=AØ$(Ø,0Ø/3Ø&*ñ}
à˜EŸL™LÑ)ð}
ð ! §¡Ñ.ð}
ð ! §¡Ñ.ð	}
ð
 ˜EŸL™LÑ)ð}
ð   §¡Ñ-ð}
ð  (¨¯©Ñ5ð}
ð !)¨¯©Ñ 6ð}
ð " $ u×'8Ñ'8Ñ"9Ñ:ð}
ð ˜D‘>ð}
ð $ D™>ð}
ð ' t™nð}
ð ˜d‘^ð}
ð 
ˆu�U—\‘\Ñ"Ð$PÐPÑ	Qò}
óó iô}
rœ   r¨  z©
    Nezha Model with two heads on top as done during the pretraining: a `masked language modeling` head and a `next
    sentence prediction (classification)` head.
    c                   ó´  ‡ — e Zd ZdgZˆ fd„Zd„ Z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j                     deej                     dee   dee   dee   deeej                     ef   fd„«       «       Zˆ xZS )ÚNezhaForPreTrainingúcls.predictions.decoderc                 ó„   •— t         ‰| �  |«       t        |«      | _        t	        |«      | _        | j                  «        y rž   )ru   rv   r¨  r“  rŽ  Úclsr¬  r»   s     €r-   rv   zNezhaForPreTraining.__init__ù  s4   ø€ Ü‰Ñ˜Ô ä Ó'ˆŒ
Ü(¨Ó0ˆŒð 	�‰Õrœ   c                 óB   — | j                   j                  j                  S rž   ©rÓ  r�  rx  r{  s    r-   Úget_output_embeddingsz)NezhaForPreTraining.get_output_embeddings  ó   € Ø�x‰x×#Ñ#×+Ñ+Ð+rœ   c                 ó„   — || j                   j                  _        |j                  | j                   j                  _        y rž   ©rÓ  r�  rx  r5   ©r‹   Únew_embeddingss     r-   Úset_output_embeddingsz)NezhaForPreTraining.set_output_embeddings  ó,   € Ø'5ˆ�‰×ÑÔ$Ø$2×$7Ñ$7ˆ�‰×ÑÕ!rœ   r·  ©rº  r�  r¼   rá   r­   râ   r½   ÚlabelsÚnext_sentence_labelræ   rQ  rR  r¾   c           
      ó  — |
�|
n| j                   j                  }
| j                  |||||||	|
¬«      }|dd \  }}| j                  ||«      \  }}d}|�u|�st	        «       } ||j                  d| j                   j                  «      |j                  d«      «      } ||j                  dd«      |j                  d«      «      }||z   }|
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]`
            next_sentence_label (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
                Labels for computing the next sequence prediction (classification) loss. Input should be a sequence
                pair (see `input_ids` docstring) Indices should be in `[0, 1]`:

                - 0 indicates sequence B is a continuation of sequence A,
                - 1 indicates sequence B is a random sequence.
            kwargs (`Dict[str, any]`, optional, defaults to *{}*):
                Used to hide legacy arguments that have been deprecated.

        Returns:

        Example:

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

        >>> tokenizer = AutoTokenizer.from_pretrained("sijunhe/nezha-cn-base")
        >>> model = NezhaForPreTraining.from_pretrained("sijunhe/nezha-cn-base")

        >>> inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
        >>> outputs = model(**inputs)

        >>> prediction_logits = outputs.prediction_logits
        >>> seq_relationship_logits = outputs.seq_relationship_logits
        ```
        N©rá   r­   râ   r½   ræ   rQ  rR  r9   rp   )r£  r¤  r¥  rà   rW  )
r[   r½  r“  rÓ  r
   ry   r�   r¢  rà   rW  )r‹   r¼   rá   r­   râ   r½   rß  rà  ræ   rQ  rR  r  r‚  rn  r„  r‹  Ú
total_lossÚloss_fctÚmasked_lm_lossÚnext_sentence_lossr  s                        r-   rŸ   zNezhaForPreTraining.forward	  sD  € ð^ &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆà—*‘*ØØ)Ø)ØØ'Ø/Ø!5Ø#ð ó 	
ˆð *1°°!¨Ñ&ˆ˜Ø48·H±H¸_ÈmÓ4\Ñ1ÐÐ1àˆ
ØÐÐ"5Ð"AÜ'Ó)ˆHÙ%Ð&7×&<Ñ&<¸RÀÇÁ×AWÑAWÓ&XÐZ`×ZeÑZeÐfhÓZiÓjˆNÙ!)Ð*@×*EÑ*EÀbÈ!Ó*LÐNa×NfÑNfÐgiÓNjÓ!kÐØ'Ð*<Ñ<ˆJáØ'Ð)?Ð@À7È1È2À;ÑNˆFØ/9Ð/E�Z�M FÑ*ÐQÈ6ÐQä(ØØ/Ø$:Ø!×/Ñ/Ø×)Ñ)ô
ð 	
rœ   ©
NNNNNNNNNN)r¡   r¢   r£   Ú_tied_weights_keysrv   rÖ  rÜ  r   rË  rÌ  r   r¢  rÎ  r   rW   rË   r	  r   r   rŸ   r¥   r¦   s   @r-   rÐ  rÐ  ï  sN  ø„ ð 4Ð4Ðôò,ò8ñ +Ð+A×+HÑ+HÐIfÓ+gÓhÙÐ+DÐSbÔcð -1Ø15Ø15Ø,0Ø04Ø)-Ø6:Ø,0Ø/3Ø&*ñN
à˜EŸL™LÑ)ðN
ð ! §¡Ñ.ðN
ð ! §¡Ñ.ð	N
ð
 ˜EŸL™LÑ)ðN
ð   §¡Ñ-ðN
ð ˜Ÿ™Ñ&ðN
ð & e§l¡lÑ3ðN
ð $ D™>ðN
ð ' t™nðN
ð ˜d‘^ðN
ð 
ˆu�U—\‘\Ñ"Ð$=Ð=Ñ	>òN
ó dó iôN
rœ   rÐ  z3Nezha Model with a `language modeling` head on top.c                   óÞ  ‡ — e Zd ZdgZˆ fd„Zd„ Z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j                      deej                      dee   dee   dee   deeej                      ef   fd„«       «       Zdd„Zˆ xZS )ÚNezhaForMaskedLMrÑ  c                 óÊ   •— t         ‰| �  |«       |j                  rt        j	                  d«       t        |d¬«      | _        t        |«      | _        | j                  «        y )NzlIf you want to use `NezhaForMaskedLM` make sure `config.is_decoder=False` for bi-directional self-attention.F©r­  )
ru   rv   rÙ   r?   Úwarningr¨  r“  r  rÓ  r¬  r»   s     €r-   rv   zNezhaForMaskedLM.__init__`  sR   ø€ Ü‰Ñ˜Ô à×ÒÜ�N‰Nð1ôô
   ¸%Ô@ˆŒ
Ü# FÓ+ˆŒð 	�‰Õrœ   c                 óB   — | j                   j                  j                  S rž   rÕ  r{  s    r-   rÖ  z&NezhaForMaskedLM.get_output_embeddingso  r×  rœ   c                 ó„   — || j                   j                  _        |j                  | j                   j                  _        y rž   rÙ  rÚ  s     r-   rÜ  z&NezhaForMaskedLM.set_output_embeddingsr  rÝ  rœ   r·  r¸  r¼   rá   r­   râ   r½   rã   rä   rß  ræ   rQ  rR  r¾   c                 óœ  — |�|n| j                   j                  }| j                  ||||||||	|
|¬«
      }|d   }| j                  |«      }d}|�Ft	        «       } ||j                  d| j                   j                  «      |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)	rá   r­   râ   r½   rã   rä   ræ   rQ  rR  r   rp   r9   ©r£  Úlogitsrà   rW  )
r[   r½  r“  rÓ  r
   ry   r�   r   rà   rW  )r‹   r¼   rá   r­   râ   r½   rã   rä   rß  ræ   rQ  rR  r  r‚  r„  rå  rä  r  s                     r-   rŸ   zNezhaForMaskedLM.forwardv  sý   € ð6 &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆà—*‘*ØØ)Ø)ØØ'Ø"7Ø#9Ø/Ø!5Ø#ð ó 
ˆð " !™*ˆØ ŸH™H _Ó5ÐàˆØÐÜ'Ó)ˆHÙ%Ð&7×&<Ñ&<¸RÀÇÁ×AWÑAWÓ&XÐZ`×ZeÑZeÐfhÓZiÓjˆNáØ'Ð)¨G°A°B¨KÑ7ˆFØ3AÐ3M�^Ð%¨Ñ.ÐYÐSYÐYäØØ$Ø!×/Ñ/Ø×)Ñ)ô	
ð 	
rœ   c                 óž  — |j                   }|d   }| j                  j                  €t        d«      ‚t	        j
                  ||j                  |j                   d   df«      gd¬«      }t	        j                  |df| j                  j                  t        j                  |j                  ¬«      }t	        j
                  ||gd¬«      }||dœS )Nr   z.The PAD token should be defined for generationr    rp   rè   rÀ   )r¼   rá   )
rS   r[   r°   rT   rW   rë   Ú	new_zerosÚfullrº   rÁ   )r‹   r¼   rá   Úmodel_kwargsrÄ   Úeffective_batch_sizeÚdummy_tokens          r-   Úprepare_inputs_for_generationz.NezhaForMaskedLM.prepare_inputs_for_generation³  s¹   € Ø—o‘oˆØ*¨1™~Ðð �;‰;×#Ñ#Ð+ÜÐMÓNÐNäŸ™ N°N×4LÑ4LÈn×NbÑNbÐcdÑNeÐghÐMiÓ4jÐ#kÐqsÔtˆÜ—j‘jØ! 1Ð% t§{¡{×'?Ñ'?ÄuÇzÁzÐZc×ZjÑZjô
ˆô —I‘I˜y¨+Ð6¸AÔ>ˆ	à&¸.ÑIÐIrœ   )NNNNNNNNNNNrž   )r¡   r¢   r£   rè  rv   rÖ  rÜ  r   rË  rÌ  r   rÍ  r   rÎ  r   rW   rË   r	  r   r   rŸ   rù  r¥   r¦   s   @r-   rê  rê  \  s_  ø„ à3Ð4Ðôò,ò8ñ +Ð+A×+HÑ+HÐIfÓ+gÓhÙØ&Ø"Ø$ôð -1Ø15Ø15Ø,0Ø04Ø8<Ø9=Ø)-Ø,0Ø/3Ø&*ñ5
à˜EŸL™LÑ)ð5
ð ! §¡Ñ.ð5
ð ! §¡Ñ.ð	5
ð
 ˜EŸL™LÑ)ð5
ð   §¡Ñ-ð5
ð  (¨¯©Ñ5ð5
ð !)¨¯©Ñ 6ð5
ð ˜Ÿ™Ñ&ð5
ð $ D™>ð5
ð ' t™nð5
ð ˜d‘^ð5
ð 
ˆu�U—\‘\Ñ" NÐ2Ñ	3ò5
óó ið5
÷nJrœ   rê  zKNezha Model with a `next sentence prediction (classification)` head on top.c                   ó‚  ‡ — e Zd Zˆ 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j                     d
e
e   de
e   de
e   deeej                     ef   fd„«       «       Zˆ xZS )ÚNezhaForNextSentencePredictionc                 ó„   •— t         ‰| �  |«       t        |«      | _        t	        |«      | _        | j                  «        y rž   )ru   rv   r¨  r“  r†  rÓ  r¬  r»   s     €r-   rv   z'NezhaForNextSentencePrediction.__init__É  s4   ø€ Ü‰Ñ˜Ô ä Ó'ˆŒ
Ü# FÓ+ˆŒð 	�‰Õrœ   r·  rÞ  r¼   rá   r­   râ   r½   rß  ræ   rQ  rR  r¾   c
           
      óÎ  — d|
v r+t        j                  dt        «       |
j                  d«      }|	�|	n| j                  j
                  }	| j                  ||||||||	¬«      }|d   }| j                  |«      }d}|�2t        «       } ||j                  dd«      |j                  d«      «      }|	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 next sequence prediction (classification) loss. Input should be a sequence pair
            (see `input_ids` docstring). Indices should be in `[0, 1]`:

            - 0 indicates sequence B is a continuation of sequence A,
            - 1 indicates sequence B is a random sequence.

        Returns:

        Example:

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

        >>> tokenizer = AutoTokenizer.from_pretrained("sijunhe/nezha-cn-base")
        >>> model = NezhaForNextSentencePrediction.from_pretrained("sijunhe/nezha-cn-base")

        >>> prompt = "In Italy, pizza served in formal settings, such as at a restaurant, is presented unsliced."
        >>> next_sentence = "The sky is blue due to the shorter wavelength of blue light."
        >>> encoding = tokenizer(prompt, next_sentence, return_tensors="pt")

        >>> outputs = model(**encoding, labels=torch.LongTensor([1]))
        >>> logits = outputs.logits
        >>> assert logits[0, 0] < logits[0, 1]  # next sentence was random
        ```
        rà  zoThe `next_sentence_label` argument is deprecated and will be removed in a future version, use `labels` instead.Nrâ  r    rp   r9   rñ  )ÚwarningsÚwarnÚFutureWarningÚpopr[   r½  r“  rÓ  r
   ry   r   rà   rW  )r‹   r¼   rá   r­   râ   r½   rß  ræ   rQ  rR  Úkwargsr  rn  Úseq_relationship_scoresræ  rä  r  s                    r-   rŸ   z&NezhaForNextSentencePrediction.forwardÒ  s  € ðX ! FÑ*Ü�M‰Mð%äôð
 —Z‘ZÐ 5Ó6ˆFà%0Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆà—*‘*ØØ)Ø)ØØ'Ø/Ø!5Ø#ð ó 	
ˆð   ™
ˆà"&§(¡(¨=Ó"9Ðà!ÐØÐÜ'Ó)ˆHÙ!)Ð*A×*FÑ*FÀrÈ1Ó*MÈvÏ{É{Ð[]ËÓ!_ÐáØ-Ð/°'¸!¸"°+Ñ=ˆFØ7IÐ7UÐ'Ð)¨FÑ2ÐaÐ[aÐaä*Ø#Ø*Ø!×/Ñ/Ø×)Ñ)ô	
ð 	
rœ   ©	NNNNNNNNN)r¡   r¢   r£   rv   r   rË  rÌ  r   r   rÎ  r   rW   rË   r	  r   r   rŸ   r¥   r¦   s   @r-   rû  rû  Ä  s"  ø„ ô
ñ +Ð+A×+HÑ+HÐIfÓ+gÓhÙÐ+FÐUdÔeð -1Ø15Ø15Ø,0Ø04Ø)-Ø,0Ø/3Ø&*ñQ
à˜EŸL™LÑ)ðQ
ð ! §¡Ñ.ðQ
ð ! §¡Ñ.ð	Q
ð
 ˜EŸL™LÑ)ðQ
ð   §¡Ñ-ðQ
ð ˜Ÿ™Ñ&ðQ
ð $ D™>ðQ
ð ' t™nðQ
ð ˜d‘^ðQ
ð 
ˆu�U—\‘\Ñ"Ð$?Ð?Ñ	@òQ
ó fó iôQ
rœ   rû  z�
    Nezha 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ˆ 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j                     e	f   fd„«       «       Zˆ xZS )ÚNezhaForSequenceClassificationc                 ón  •— t         ‰| �  |«       |j                  | _        || _        t	        |«      | _        |j                  �|j                  n|j                  }t        j                  |«      | _
        t        j                  |j                  |j                  «      | _        | j                  «        y rž   )ru   rv   Ú
num_labelsr[   r¨  r“  Úclassifier_dropoutr·   r   r¶   r¸   rÓ   r¯   r8   r¬  ©r‹   r[   r	  r›   s      €r-   rv   z'NezhaForSequenceClassification.__init__0  s�   ø€ Ü‰Ñ˜Ô Ø ×+Ñ+ˆŒØˆŒä Ó'ˆŒ
à)/×)BÑ)BÐ)NˆF×%Ò%ÐTZ×TnÑTnð 	ô —z‘zÐ"4Ó5ˆŒÜŸ)™) F×$6Ñ$6¸×8IÑ8IÓJˆŒð 	�‰Õrœ   r·  r¸  r¼   rá   r­   râ   r½   rß  ræ   rQ  rR  r¾   c
           
      ó>  — |	�|	n| j                   j                  }	| j                  ||||||||	¬«      }
|
d   }| 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    Ú
regressionÚsingle_label_classificationÚmulti_label_classificationrp   r9   rñ  )r[   r½  r“  r¸   r8   Úproblem_typer  ro   rW   rº   rQ   r   Úsqueezer
   ry   r	   r   rà   rW  )r‹   r¼   rá   r­   râ   r½   rß  ræ   rQ  rR  r  rn  rò  r£  rä  r  s                   r-   rŸ   z&NezhaForSequenceClassification.forward?  så  € ð0 &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆà—*‘*ØØ)Ø)ØØ'Ø/Ø!5Ø#ð ó 	
ˆð   ™
ˆàŸ™ ]Ó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 ¨¨ Ñ,ˆFØ)-Ð)9�T�G˜fÑ$ÐE¸vÐEä'ØØØ!×/Ñ/Ø×)Ñ)ô	
ð 	
rœ   r  )r¡   r¢   r£   rv   r   rË  rÌ  r   rÍ  r   rÎ  r   rW   rË   r	  r   r   rŸ   r¥   r¦   s   @r-   r  r  (  s&  ø„ ôñ +Ð+A×+HÑ+HÐIfÓ+gÓhÙØ&Ø,Ø$ôð -1Ø15Ø15Ø,0Ø04Ø)-Ø,0Ø/3Ø&*ñC
à˜EŸL™LÑ)ðC
ð ! §¡Ñ.ðC
ð ! §¡Ñ.ð	C
ð
 ˜EŸL™LÑ)ðC
ð   §¡Ñ-ðC
ð ˜Ÿ™Ñ&ðC
ð $ D™>ðC
ð ' t™nðC
ð ˜d‘^ðC
ð 
ˆu�U—\‘\Ñ"Ð$<Ð<Ñ	=òC
óó iôC
rœ   r  z¦
    Nezha 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ˆ 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j                     e	f   fd„«       «       Zˆ xZS )ÚNezhaForMultipleChoicec                 ó*  •— t         ‰| �  |«       t        |«      | _        |j                  �|j                  n|j
                  }t        j                  |«      | _        t        j                  |j                  d«      | _        | j                  «        y )Nr    )ru   rv   r¨  r“  r	  r·   r   r¶   r¸   rÓ   r¯   r8   r¬  r
  s      €r-   rv   zNezhaForMultipleChoice.__init__“  su   ø€ Ü‰Ñ˜Ô ä Ó'ˆŒ
à)/×)BÑ)BÐ)NˆF×%Ò%ÐTZ×TnÑTnð 	ô —z‘zÐ"4Ó5ˆŒÜŸ)™) F×$6Ñ$6¸Ó:ˆŒð 	�‰Õrœ   z(batch_size, num_choices, sequence_lengthr¸  r¼   rá   r­   râ   r½   rß  ræ   rQ  rR  r¾   c
           
      ój  — |	�|	n| j                   j                  }	|�|j                  d   n|j                  d   }
|�!|j                  d|j	                  d«      «      nd}|�!|j                  d|j	                  d«      «      nd}|�!|j                  d|j	                  d«      «      nd}|�1|j                  d|j	                  d«      |j	                  d«      «      nd}| j                  ||||||||	¬«      }|d   }t        |j                  «       | j                  |«      }| j                  |«      }t        |j                  «       t        |
«       |j                  d|
«      }d}|�t        «       } |||«      }|	s|f|dd z   }|�|f|z   S |S t        |||j                  |j                  ¬«      S )aJ  
        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)
        Nr    rp   rê   râ  r9   rñ  )r[   r½  rS   ry   r‰   r“  Úprintr¸   r8   r
   r   rà   rW  )r‹   r¼   rá   r­   râ   r½   rß  ræ   rQ  rR  Únum_choicesr  rn  rò  Úreshaped_logitsr£  rä  r  s                     r-   rŸ   zNezhaForMultipleChoice.forward   s×  € ð0 &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ˆØM[ÐMg˜×,Ñ,¨R°×1DÑ1DÀRÓ1HÔIÐmqˆð Ð(ð ×Ñ˜r =×#5Ñ#5°bÓ#9¸=×;MÑ;MÈbÓ;QÔRàð 	ð —*‘*ØØ)Ø)ØØ'Ø/Ø!5Ø#ð ó 	
ˆð   ™
ˆÜˆm×!Ñ!Ô"ØŸ™ ]Ó3ˆØ—‘ Ó/ˆÜˆf�l‰lÔÜˆkÔØ Ÿ+™+ b¨+Ó6ˆàˆØÐÜ'Ó)ˆHÙ˜O¨VÓ4ˆDáØ%Ð'¨'°!°"¨+Ñ5ˆFØ)-Ð)9�T�G˜fÑ$ÐE¸vÐEä(ØØ"Ø!×/Ñ/Ø×)Ñ)ô	
ð 	
rœ   r  )r¡   r¢   r£   rv   r   rË  rÌ  r   rÍ  r   rÎ  r   rW   rË   r	  r   r   rŸ   r¥   r¦   s   @r-   r  r  ‹  s  ø„ ôñ +Ð+A×+HÑ+HÐIsÓ+tÓuÙØ&Ø-Ø$ôð -1Ø15Ø15Ø,0Ø04Ø)-Ø,0Ø/3Ø&*ñ>
à˜EŸL™LÑ)ð>
ð ! §¡Ñ.ð>
ð ! §¡Ñ.ð	>
ð
 ˜EŸL™LÑ)ð>
ð   §¡Ñ-ð>
ð ˜Ÿ™Ñ&ð>
ð $ D™>ð>
ð ' t™nð>
ð ˜d‘^ð>
ð 
ˆu�U—\‘\Ñ"Ð$=Ð=Ñ	>ò>
óó vô>
rœ   r  z¤
    Nezha 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ˆ 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j                     e	f   fd„«       «       Zˆ xZS )ÚNezhaForTokenClassificationc                 ód  •— t         ‰| �  |«       |j                  | _        t        |d¬«      | _        |j
                  �|j
                  n|j                  }t        j                  |«      | _	        t        j                  |j                  |j                  «      | _        | j                  «        y ©NFrì  )ru   rv   r  r¨  r“  r	  r·   r   r¶   r¸   rÓ   r¯   r8   r¬  r
  s      €r-   rv   z$NezhaForTokenClassification.__init__ï  sŠ   ø€ Ü‰Ñ˜Ô Ø ×+Ñ+ˆŒä ¸%Ô@ˆŒ
à)/×)BÑ)BÐ)NˆF×%Ò%ÐTZ×TnÑTnð 	ô —z‘zÐ"4Ó5ˆŒÜŸ)™) F×$6Ñ$6¸×8IÑ8IÓJˆŒð 	�‰Õrœ   r·  r¸  r¼   rá   r­   râ   r½   rß  ræ   rQ  rR  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]`.
        Nrâ  r   rp   r9   rñ  )r[   r½  r“  r¸   r8   r
   ry   r  r   rà   rW  )r‹   r¼   rá   r­   râ   r½   rß  ræ   rQ  rR  r  r‚  rò  r£  rä  r  s                   r-   rŸ   z#NezhaForTokenClassification.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  )r¡   r¢   r£   rv   r   rË  rÌ  r   rÍ  r   rÎ  r   rW   rË   r	  r   r   rŸ   r¥   r¦   s   @r-   r  r  ç  s  ø„ ôñ +Ð+A×+HÑ+HÐIfÓ+gÓhÙØ&Ø)Ø$ôð -1Ø15Ø15Ø,0Ø04Ø)-Ø,0Ø/3Ø&*ñ0
à˜EŸL™LÑ)ð0
ð ! §¡Ñ.ð0
ð ! §¡Ñ.ð	0
ð
 ˜EŸL™LÑ)ð0
ð   §¡Ñ-ð0
ð ˜Ÿ™Ñ&ð0
ð $ D™>ð0
ð ' t™nð0
ð ˜d‘^ð0
ð 
ˆu�U—\‘\Ñ"Ð$9Ð9Ñ	:ò0
óó iô0
rœ   r  zÞ
    Nezha 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ˆ 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j                     dee   dee   dee   deeej                     e	f   fd„«       «       Zˆ xZS )ÚNezhaForQuestionAnsweringc                 óè   •— t         ‰| �  |«       |j                  | _        t        |d¬«      | _        t        j                  |j                  |j                  «      | _        | j                  «        y r  )
ru   rv   r  r¨  r“  r   rÓ   r¯   Ú
qa_outputsr¬  r»   s     €r-   rv   z"NezhaForQuestionAnswering.__init__>  sU   ø€ Ü‰Ñ˜Ô Ø ×+Ñ+ˆŒä ¸%Ô@ˆŒ
ÜŸ)™) F×$6Ñ$6¸×8IÑ8IÓJˆŒð 	�‰Õrœ   r·  r¸  r¼   rá   r­   râ   r½   Ústart_positionsÚend_positionsræ   rQ  rR  r¾   c           
      ó&  — |
�|
n| j                   j                  }
| j                  |||||||	|
¬«      }|d   }| 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        |¬«      } |||«      } |||«      }||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    rp   rè   )Úignore_indexr9   )r£  Ústart_logitsÚ
end_logitsrà   rW  )r[   r½  r“  r   rJ   r  rì   rP   r‰   r{   r
   r   rà   rW  )r‹   r¼   rá   r­   râ   r½   r!  r"  ræ   rQ  rR  r  r‚  rò  r%  r&  rã  Úignored_indexrä  Ú
start_lossÚend_lossr  s                         r-   rŸ   z!NezhaForQuestionAnswering.forwardH  s¿  € ð: &1Ð%<‘kÀ$Ç+Á+×B]ÑB]ˆà—*‘*ØØ)Ø)ØØ'Ø/Ø!5Ø#ð ó 	
ˆð " !™*ˆà—‘ Ó1ˆØ#)§<¡<°°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ä'°]ÔCˆHÙ! ,°Ó@ˆJÙ 
¨MÓ:ˆHØ$ xÑ/°1Ñ4ˆJáØ" JÐ/°'¸!¸"°+Ñ=ˆFØ/9Ð/E�Z�M FÑ*ÐQÈ6ÐQä+ØØ%Ø!Ø!×/Ñ/Ø×)Ñ)ô
ð 	
rœ   rç  )r¡   r¢   r£   rv   r   rË  rÌ  r   rÍ  r   rÎ  r   rW   rË   r	  r   r   rŸ   r¥   r¦   s   @r-   r  r  6  s=  ø„ ôñ +Ð+A×+HÑ+HÐIfÓ+gÓhÙØ&Ø0Ø$ôð -1Ø15Ø15Ø,0Ø04Ø26Ø04Ø,0Ø/3Ø&*ñF
à˜EŸL™LÑ)ðF
ð ! §¡Ñ.ðF
ð ! §¡Ñ.ð	F
ð
 ˜EŸL™LÑ)ðF
ð   §¡Ñ-ðF
ð " %§,¡,Ñ/ðF
ð   §¡Ñ-ðF
ð $ D™>ðF
ð ' t™nðF
ð ˜d‘^ðF
ð 
ˆu�U—\‘\Ñ"Ð$@Ð@Ñ	AòF
óó iôF
rœ   r  )Nr¤   r�   rA   rþ  Údataclassesr   Útypingr   r   r   r   rW   Útorch.utils.checkpointr   Útorch.nnr	   r
   r   Úactivationsr   Úmodeling_outputsr   r   r   r   r   r   r   r   Úmodeling_utilsr   Úpytorch_utilsr   r   r   Úutilsr   r   r   r   r   r   Úconfiguration_nezhar!   Ú
get_loggerr¡   r?   rÍ  rÎ  rj   ÚModulerl   r¨   rÍ   r  r  r%  r/  r3  rG  rh  rp  ru  r  r†  rŽ  r’  r¢  ÚNEZHA_START_DOCSTRINGrË  r¨  rÐ  rê  rû  r  r  r  r  r*   rœ   r-   ú<module>r7     s  ðñ ã Û 	Û Ý !ß /Ó /ã Û Ý ß AÑ Aå "÷	÷ 	ó 	õ /ß mÑ m÷÷ õ -ð 
ˆ×	Ñ	˜HÓ	%€à-Ð Ø€òFôR< R§Y¡Yô <ô@0�b—i‘iô 0ôfD˜Ÿ™ô DôN�b—i‘iô ô.�R—Y‘Yô .ôb˜Ÿ	™	ô ô�"—)‘)ô ôS�—‘ô SôlZ
�2—9‘9ô Z
ôz�"—)‘)ô ô 2§9¡9ô ô"˜BŸI™Iô ô.!�r—y‘yô !ô&�r—y‘yô &ô	9˜BŸI™Iô 	9ô*˜?ô *ð8 ô: ó :ó ð:ðBÐ ð *Ð ñZ ØeØóôj
Ð%ó j
ó	ðj
ñZ ðð óôc
Ð.ó c
óðc
ñL ÐOÐQfÓgôdJÐ+ó dJó hðdJñN ØUØóô]
Ð%9ó ]
ó	ð]
ñ@ ðð óôY
Ð%9ó Y
óðY
ñx ðð óôR
Ð1ó R
óðR
ñj ðð óôE
Ð"6ó E
óðE
ñP ðð óôW
Ð 4ó W
óñW
rœ   